Skip to content

Commit

Permalink
Use gitea/test_env image instead of golang (#23455)
Browse files Browse the repository at this point in the history
The `safe.directory` setting was not executed for pull requests, which
made subsequent `deps-backend` target fail at `go mod download`. To fix
it, split thep and perform the git config unconditionally.

Example: https://drone.gitea.io/go-gitea/gitea/69477/4/3

Co-authored-by: Lunny Xiao <[email protected]>
  • Loading branch information
silverwind and lunny authored Mar 15, 2023
1 parent f96eef8 commit ea1b926
Showing 1 changed file with 17 additions and 32 deletions.
49 changes: 17 additions & 32 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ steps:
- make deps-frontend

- name: deps-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -90,7 +90,7 @@ steps:
depends_on: [deps-frontend]

- name: checks-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
commands:
- make --always-make checks-backend # ensure the 'go-licenses' make target runs
depends_on: [deps-backend]
Expand All @@ -111,7 +111,7 @@ steps:
depends_on: [deps-frontend]

- name: build-backend-no-gcc
image: golang:1.19 # this step is kept as the lowest version of golang that we support
image: gitea/test_env:linux-1.19-amd64 # this step is kept as the lowest version of golang that we support
pull: always
environment:
GOPROXY: https://goproxy.io
Expand All @@ -123,7 +123,7 @@ steps:
path: /go

- name: build-backend-arm64
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
environment:
GOPROXY: https://goproxy.io
GOOS: linux
Expand All @@ -138,7 +138,7 @@ steps:
path: /go

- name: build-backend-windows
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
environment:
GOPROXY: https://goproxy.io
GOOS: windows
Expand All @@ -152,7 +152,7 @@ steps:
path: /go

- name: build-backend-386
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
environment:
GOPROXY: https://goproxy.io
GOOS: linux
Expand Down Expand Up @@ -213,15 +213,14 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
exclude:
- pull_request

- name: deps-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -313,15 +312,14 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
exclude:
- pull_request

- name: deps-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -399,7 +397,7 @@ steps:
path: /go

- name: generate-coverage
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
commands:
- make coverage
environment:
Expand Down Expand Up @@ -465,15 +463,14 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
exclude:
- pull_request

- name: deps-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -553,15 +550,14 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
exclude:
- pull_request

- name: deps-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -631,15 +627,14 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
exclude:
- pull_request

- name: deps-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-arm64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -721,7 +716,7 @@ steps:
depends_on: [deps-frontend]

- name: deps-backend
image: golang:1.18
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -830,7 +825,7 @@ trigger:

steps:
- name: download
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- timeout -s ABRT 40m make generate-license generate-gitignore
Expand Down Expand Up @@ -890,7 +885,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: deps-frontend
Expand All @@ -900,7 +894,7 @@ steps:
- make deps-frontend

- name: deps-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -1026,7 +1020,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: deps-frontend
Expand All @@ -1036,7 +1029,7 @@ steps:
- make deps-frontend

- name: deps-backend
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -1136,7 +1129,7 @@ trigger:

steps:
- name: build-docs
image: golang:1.20
image: gitea/test_env:linux-1.20-amd64
commands:
- cd docs
- make trans-copy clean build
Expand Down Expand Up @@ -1190,7 +1183,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: publish
Expand Down Expand Up @@ -1268,7 +1260,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: publish
Expand Down Expand Up @@ -1341,7 +1332,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: publish
Expand Down Expand Up @@ -1415,7 +1405,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: publish
Expand Down Expand Up @@ -1533,7 +1522,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: publish
Expand Down Expand Up @@ -1611,7 +1599,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: publish
Expand Down Expand Up @@ -1687,7 +1674,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: publish
Expand Down Expand Up @@ -1761,7 +1747,6 @@ steps:
image: docker:git
pull: always
commands:
- git config --global --add safe.directory /drone/src
- git fetch --tags --force

- name: publish
Expand Down

0 comments on commit ea1b926

Please sign in to comment.