Skip to content

Commit d21a5f3

Browse files
authored
Merge branch 'main' into acme-provider
2 parents 1ec10b8 + a60e8be commit d21a5f3

File tree

173 files changed

+2560
-1918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+2560
-1918
lines changed

.drone.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,67 @@ steps:
854854
exclude:
855855
- pull_request
856856

857+
---
858+
kind: pipeline
859+
name: docker-linux-amd64-release-branch
860+
861+
platform:
862+
os: linux
863+
arch: amd64
864+
865+
depends_on:
866+
- testing-amd64
867+
- testing-arm64
868+
869+
trigger:
870+
ref:
871+
- "refs/heads/release/v*"
872+
event:
873+
exclude:
874+
- cron
875+
876+
steps:
877+
- name: fetch-tags
878+
image: docker:git
879+
commands:
880+
- git fetch --tags --force
881+
882+
- name: publish
883+
pull: always
884+
image: techknowlogick/drone-docker:latest
885+
settings:
886+
auto_tag: false
887+
tags: ${DRONE_BRANCH##release/v}-dev-linux-amd64
888+
repo: gitea/gitea
889+
build_args:
890+
- GOPROXY=https://goproxy.cn
891+
password:
892+
from_secret: docker_password
893+
username:
894+
from_secret: docker_username
895+
when:
896+
event:
897+
exclude:
898+
- pull_request
899+
900+
- name: publish-rootless
901+
image: techknowlogick/drone-docker:latest
902+
settings:
903+
dockerfile: Dockerfile.rootless
904+
auto_tag: false
905+
tags: ${DRONE_BRANCH##release/v}-dev-linux-amd64-rootless
906+
repo: gitea/gitea
907+
build_args:
908+
- GOPROXY=https://goproxy.cn
909+
password:
910+
from_secret: docker_password
911+
username:
912+
from_secret: docker_username
913+
when:
914+
event:
915+
exclude:
916+
- pull_request
917+
857918
---
858919
kind: pipeline
859920
type: docker
@@ -1010,6 +1071,68 @@ steps:
10101071
event:
10111072
exclude:
10121073
- pull_request
1074+
1075+
---
1076+
kind: pipeline
1077+
name: docker-linux-arm64-release-branch
1078+
1079+
platform:
1080+
os: linux
1081+
arch: arm64
1082+
1083+
depends_on:
1084+
- testing-amd64
1085+
- testing-arm64
1086+
1087+
trigger:
1088+
ref:
1089+
- "refs/heads/release/v*"
1090+
event:
1091+
exclude:
1092+
- cron
1093+
1094+
steps:
1095+
- name: fetch-tags
1096+
image: docker:git
1097+
commands:
1098+
- git fetch --tags --force
1099+
1100+
- name: publish
1101+
pull: always
1102+
image: techknowlogick/drone-docker:latest
1103+
settings:
1104+
auto_tag: false
1105+
tags: ${DRONE_BRANCH##release/v}-dev-linux-arm64
1106+
repo: gitea/gitea
1107+
build_args:
1108+
- GOPROXY=https://goproxy.cn
1109+
password:
1110+
from_secret: docker_password
1111+
username:
1112+
from_secret: docker_username
1113+
when:
1114+
event:
1115+
exclude:
1116+
- pull_request
1117+
1118+
- name: publish-rootless
1119+
image: techknowlogick/drone-docker:latest
1120+
settings:
1121+
dockerfile: Dockerfile.rootless
1122+
auto_tag: false
1123+
tags: ${DRONE_BRANCH##release/v}-dev-linux-arm64-rootless
1124+
repo: gitea/gitea
1125+
build_args:
1126+
- GOPROXY=https://goproxy.cn
1127+
password:
1128+
from_secret: docker_password
1129+
username:
1130+
from_secret: docker_username
1131+
when:
1132+
event:
1133+
exclude:
1134+
- pull_request
1135+
10131136
---
10141137
kind: pipeline
10151138
type: docker
@@ -1098,6 +1221,8 @@ trigger:
10981221
depends_on:
10991222
- docker-linux-amd64-release
11001223
- docker-linux-arm64-release
1224+
- docker-linux-amd64-release-branch
1225+
- docker-linux-arm64-release-branch
11011226

11021227
---
11031228
kind: pipeline
@@ -1131,6 +1256,8 @@ depends_on:
11311256
- docker-linux-arm64-release
11321257
- docker-linux-amd64-release-version
11331258
- docker-linux-arm64-release-version
1259+
- docker-linux-amd64-release-branch
1260+
- docker-linux-arm64-release-branch
11341261
- docker-manifest
11351262
- docker-manifest-version
11361263
- docs

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,35 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.16.1](https://github.com/go-gitea/gitea/releases/tag/v1.16.1) - 2022-02-06
8+
9+
* SECURITY
10+
* Update JS dependencies, fix lint (#18389) (#18540)
11+
* ENHANCEMENTS
12+
* Add dropdown icon to label set template dropdown (#18564) (#18571)
13+
* BUGFIXES
14+
* comments on migrated issues/prs must link to the comment ID (#18630) (#18637)
15+
* Stop logging an error when notes are not found (#18626) (#18635)
16+
* Ensure that blob-excerpt links work for wiki (#18587) (#18624)
17+
* Only attempt to flush queue if the underlying worker pool is not finished (#18593) (#18620)
18+
* Ensure commit-statuses box is sized correctly in headers (#18538) (#18606)
19+
* Prevent merge messages from being sorted to the top of email chains (#18566) (#18588)
20+
* Prevent panic on prohibited user login with oauth2 (#18562) (#18563)
21+
* Collaborator trust model should trust collaborators (#18539) (#18557)
22+
* Detect conflicts with 3way merge (#18536) (#18537)
23+
* In docker rootless use $GITEA_APP_INI if provided (#18524) (#18535)
24+
* Add `GetUserTeams` (#18499) (#18531)
25+
* Fix review excerpt (#18502) (#18530)
26+
* Fix for AvatarURL database type (#18487) (#18529)
27+
* Use `ImagedProvider` for gplus oauth2 provider (#18504) (#18505)
28+
* Fix OAuth Source Edit Page (#18495) (#18503)
29+
* Use "read" value for General Access (#18496) (#18500)
30+
* Prevent NPE on partial match of compare URL and allow short SHA1 compare URLs (#18472) (#18473)
31+
* BUILD
32+
* Make docker gitea/gitea:v1.16-dev etc refer to the latest build on that branch (#18551) (#18569)
33+
* DOCS
34+
* Update 1.16.0 changelog to set #17846 as breaking (#18533) (#18534)
35+
736
## [1.16.0](https://github.com/go-gitea/gitea/releases/tag/v1.16.0) - 2022-01-30
837

938
* BREAKING

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ endif
6060

6161
EXTRA_GOFLAGS ?=
6262

63-
MAKE_VERSION := $(shell $(MAKE) -v | head -n 1)
63+
MAKE_VERSION := $(shell "$(MAKE)" -v | head -n 1)
6464
MAKE_EVIDENCE_DIR := .make_evidence
6565

6666
ifeq ($(RACE_ENABLED),true)
@@ -231,13 +231,11 @@ clean:
231231

232232
.PHONY: fmt
233233
fmt:
234-
@echo "Running gitea-fmt(with gofmt)..."
235-
@$(GO) run build/code-batch-process.go gitea-fmt -s -w '{file-list}'
236-
@echo "Running gofumpt"
237234
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
238235
$(GO) install mvdan.cc/gofumpt@latest; \
239236
fi
240-
@gofumpt -w -l -extra -lang 1.16 .
237+
@echo "Running gitea-fmt (with gofumpt)..."
238+
@$(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
241239

242240
.PHONY: vet
243241
vet:
@@ -285,8 +283,11 @@ errcheck:
285283

286284
.PHONY: fmt-check
287285
fmt-check:
286+
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
287+
$(GO) install mvdan.cc/gofumpt@latest; \
288+
fi
288289
# get all go files and run gitea-fmt (with gofmt) on them
289-
@diff=$$($(GO) run build/code-batch-process.go gitea-fmt -s -d '{file-list}'); \
290+
@diff=$$($(GO) run build/code-batch-process.go gitea-fmt -l '{file-list}'); \
290291
if [ -n "$$diff" ]; then \
291292
echo "Please run 'make fmt' and commit the result:"; \
292293
echo "$${diff}"; \

build/code-batch-process.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ func containsString(a []string, s string) bool {
229229
return false
230230
}
231231

232-
func giteaFormatGoImports(files []string) error {
232+
func giteaFormatGoImports(files []string, hasChangedFiles, doWriteFile bool) error {
233233
for _, file := range files {
234-
if err := codeformat.FormatGoImports(file); err != nil {
234+
if err := codeformat.FormatGoImports(file, hasChangedFiles, doWriteFile); err != nil {
235235
log.Printf("failed to format go imports: %s, err=%v", file, err)
236236
return err
237237
}
@@ -267,10 +267,11 @@ func main() {
267267
logVerbose("batch cmd: %s %v", subCmd, substArgs)
268268
switch subCmd {
269269
case "gitea-fmt":
270-
if containsString(subArgs, "-w") {
271-
cmdErrors = append(cmdErrors, giteaFormatGoImports(files))
270+
if containsString(subArgs, "-d") {
271+
log.Print("the -d option is not supported by gitea-fmt")
272272
}
273-
cmdErrors = append(cmdErrors, passThroughCmd("gofmt", substArgs))
273+
cmdErrors = append(cmdErrors, giteaFormatGoImports(files, containsString(subArgs, "-l"), containsString(subArgs, "-w")))
274+
cmdErrors = append(cmdErrors, passThroughCmd("gofumpt", append([]string{"-extra", "-lang", "1.16"}, substArgs...)))
274275
case "misspell":
275276
cmdErrors = append(cmdErrors, passThroughCmd("misspell", substArgs))
276277
default:

build/codeformat/formatimports.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package codeformat
77
import (
88
"bytes"
99
"errors"
10+
"fmt"
1011
"io"
1112
"os"
1213
"sort"
@@ -158,7 +159,7 @@ func formatGoImports(contentBytes []byte) ([]byte, error) {
158159
}
159160

160161
// FormatGoImports format the imports by our rules (see unit tests)
161-
func FormatGoImports(file string) error {
162+
func FormatGoImports(file string, doChangedFiles, doWriteFile bool) error {
162163
f, err := os.Open(file)
163164
if err != nil {
164165
return err
@@ -181,11 +182,20 @@ func FormatGoImports(file string) error {
181182
if bytes.Equal(contentBytes, formattedBytes) {
182183
return nil
183184
}
184-
f, err = os.OpenFile(file, os.O_TRUNC|os.O_WRONLY, 0o644)
185-
if err != nil {
185+
186+
if doChangedFiles {
187+
fmt.Println(file)
188+
}
189+
190+
if doWriteFile {
191+
f, err = os.OpenFile(file, os.O_TRUNC|os.O_WRONLY, 0o644)
192+
if err != nil {
193+
return err
194+
}
195+
defer f.Close()
196+
_, err = f.Write(formattedBytes)
186197
return err
187198
}
188-
defer f.Close()
189-
_, err = f.Write(formattedBytes)
199+
190200
return err
191201
}

cmd/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func runHookPostReceive(c *cli.Context) error {
309309
defer cancel()
310310

311311
// First of all run update-server-info no matter what
312-
if _, err := git.NewCommandContext(ctx, "update-server-info").Run(); err != nil {
312+
if _, err := git.NewCommand(ctx, "update-server-info").Run(); err != nil {
313313
return fmt.Errorf("Failed to call 'git update-server-info': %v", err)
314314
}
315315

contrib/upgrade.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# This is an update script for gitea installed via the binary distribution
5+
# from dl.gitea.io on linux as systemd service. It performs a backup and updates
6+
# Gitea in place.
7+
# NOTE: This adds the GPG Signing Key of the Gitea maintainers to the keyring.
8+
# Depends on: bash, curl, xz, sha256sum, gpg. optionally jq.
9+
# Usage: [environment vars] upgrade.sh [version]
10+
# See section below for available environment vars.
11+
# When no version is specified, updates to the latest release.
12+
# Examples:
13+
# upgrade.sh 1.15.10
14+
# giteahome=/opt/gitea giteaconf=$giteahome/app.ini upgrade.sh
15+
16+
# apply variables from environment
17+
: "${giteabin:="/usr/local/bin/gitea"}"
18+
: "${giteahome:="/var/lib/gitea"}"
19+
: "${giteaconf:="/etc/gitea/app.ini"}"
20+
: "${giteauser:="git"}"
21+
: "${sudocmd:="sudo"}"
22+
: "${arch:="linux-amd64"}"
23+
: "${backupopts:=""}" # see `gitea dump --help` for available options
24+
25+
function giteacmd {
26+
"$sudocmd" --user "$giteauser" "$giteabin" --config "$giteaconf" --work-path "$giteahome" "$@"
27+
}
28+
29+
function require {
30+
for exe in "$@"; do
31+
command -v "$exe" &>/dev/null || (echo "missing dependency '$exe'"; exit 1)
32+
done
33+
}
34+
require systemctl curl xz sha256sum gpg "$sudocmd"
35+
36+
# select version to install
37+
if [[ -z "${1:-}" ]]; then
38+
require jq
39+
giteaversion=$(curl --connect-timeout 10 -sL https://dl.gitea.io/gitea/version.json | jq -r .latest.version)
40+
else
41+
giteaversion="$1"
42+
fi
43+
44+
# confirm update
45+
current=$(giteacmd --version | cut --delimiter=' ' --fields=3)
46+
[[ "$current" == "$giteaversion" ]] && echo "$current is already installed, stopping." && exit 1
47+
echo "Make sure to read the changelog first: https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md"
48+
echo "Are you ready to update Gitea from ${current} to ${giteaversion}? (y/N)"
49+
read -r confirm
50+
[[ "$confirm" == "y" ]] || [[ "$confirm" == "Y" ]] || exit 1
51+
52+
pushd "$(pwd)" &>/dev/null
53+
cd "$giteahome" # needed for gitea dump later
54+
55+
# download new binary
56+
binname="gitea-${giteaversion}-${arch}"
57+
binurl="https://dl.gitea.io/gitea/${giteaversion}/${binname}.xz"
58+
echo "Downloading $binurl..."
59+
curl --connect-timeout 10 --silent --show-error --fail --location -O "$binurl{,.sha256,.asc}"
60+
61+
# validate checksum & gpg signature (exit script if error)
62+
sha256sum --check "${binname}.xz.sha256"
63+
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
64+
gpg --verify "${binname}.xz.asc" "${binname}.xz" || { echo 'Signature does not match'; exit 1; }
65+
rm "${binname}".xz.{sha256,asc}
66+
67+
# unpack binary + make executable
68+
xz --decompress "${binname}.xz"
69+
chown "$giteauser" "$binname"
70+
chmod +x "$binname"
71+
72+
# stop gitea, create backup, replace binary, restart gitea
73+
echo "Stopping gitea at $(date)"
74+
giteacmd manager flush-queues
75+
$sudocmd systemctl stop gitea
76+
echo "Creating backup in $giteahome"
77+
giteacmd dump $backupopts
78+
echo "Updating binary at $giteabin"
79+
mv --force --backup "$binname" "$giteabin"
80+
$sudocmd systemctl start gitea
81+
$sudocmd systemctl status gitea
82+
83+
popd

0 commit comments

Comments
 (0)