Skip to content

Commit ea1b926

Browse files
silverwindlunny
andauthored
Use gitea/test_env image instead of golang (#23455)
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 <xiaolunwen@gmail.com>
1 parent f96eef8 commit ea1b926

File tree

1 file changed

+17
-32
lines changed

1 file changed

+17
-32
lines changed

.drone.yml

+17-32
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ steps:
2626
- make deps-frontend
2727

2828
- name: deps-backend
29-
image: golang:1.20
29+
image: gitea/test_env:linux-1.20-amd64
3030
pull: always
3131
commands:
3232
- make deps-backend
@@ -90,7 +90,7 @@ steps:
9090
depends_on: [deps-frontend]
9191

9292
- name: checks-backend
93-
image: golang:1.20
93+
image: gitea/test_env:linux-1.20-amd64
9494
commands:
9595
- make --always-make checks-backend # ensure the 'go-licenses' make target runs
9696
depends_on: [deps-backend]
@@ -111,7 +111,7 @@ steps:
111111
depends_on: [deps-frontend]
112112

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

125125
- name: build-backend-arm64
126-
image: golang:1.20
126+
image: gitea/test_env:linux-1.20-amd64
127127
environment:
128128
GOPROXY: https://goproxy.io
129129
GOOS: linux
@@ -138,7 +138,7 @@ steps:
138138
path: /go
139139

140140
- name: build-backend-windows
141-
image: golang:1.20
141+
image: gitea/test_env:linux-1.20-amd64
142142
environment:
143143
GOPROXY: https://goproxy.io
144144
GOOS: windows
@@ -152,7 +152,7 @@ steps:
152152
path: /go
153153

154154
- name: build-backend-386
155-
image: golang:1.20
155+
image: gitea/test_env:linux-1.20-amd64
156156
environment:
157157
GOPROXY: https://goproxy.io
158158
GOOS: linux
@@ -213,15 +213,14 @@ steps:
213213
image: docker:git
214214
pull: always
215215
commands:
216-
- git config --global --add safe.directory /drone/src
217216
- git fetch --tags --force
218217
when:
219218
event:
220219
exclude:
221220
- pull_request
222221

223222
- name: deps-backend
224-
image: golang:1.20
223+
image: gitea/test_env:linux-1.20-amd64
225224
pull: always
226225
commands:
227226
- make deps-backend
@@ -313,15 +312,14 @@ steps:
313312
image: docker:git
314313
pull: always
315314
commands:
316-
- git config --global --add safe.directory /drone/src
317315
- git fetch --tags --force
318316
when:
319317
event:
320318
exclude:
321319
- pull_request
322320

323321
- name: deps-backend
324-
image: golang:1.20
322+
image: gitea/test_env:linux-1.20-amd64
325323
pull: always
326324
commands:
327325
- make deps-backend
@@ -399,7 +397,7 @@ steps:
399397
path: /go
400398

401399
- name: generate-coverage
402-
image: golang:1.20
400+
image: gitea/test_env:linux-1.20-amd64
403401
commands:
404402
- make coverage
405403
environment:
@@ -465,15 +463,14 @@ steps:
465463
image: docker:git
466464
pull: always
467465
commands:
468-
- git config --global --add safe.directory /drone/src
469466
- git fetch --tags --force
470467
when:
471468
event:
472469
exclude:
473470
- pull_request
474471

475472
- name: deps-backend
476-
image: golang:1.20
473+
image: gitea/test_env:linux-1.20-amd64
477474
pull: always
478475
commands:
479476
- make deps-backend
@@ -553,15 +550,14 @@ steps:
553550
image: docker:git
554551
pull: always
555552
commands:
556-
- git config --global --add safe.directory /drone/src
557553
- git fetch --tags --force
558554
when:
559555
event:
560556
exclude:
561557
- pull_request
562558

563559
- name: deps-backend
564-
image: golang:1.20
560+
image: gitea/test_env:linux-1.20-amd64
565561
pull: always
566562
commands:
567563
- make deps-backend
@@ -631,15 +627,14 @@ steps:
631627
image: docker:git
632628
pull: always
633629
commands:
634-
- git config --global --add safe.directory /drone/src
635630
- git fetch --tags --force
636631
when:
637632
event:
638633
exclude:
639634
- pull_request
640635

641636
- name: deps-backend
642-
image: golang:1.20
637+
image: gitea/test_env:linux-1.20-arm64
643638
pull: always
644639
commands:
645640
- make deps-backend
@@ -721,7 +716,7 @@ steps:
721716
depends_on: [deps-frontend]
722717

723718
- name: deps-backend
724-
image: golang:1.18
719+
image: gitea/test_env:linux-1.20-amd64
725720
pull: always
726721
commands:
727722
- make deps-backend
@@ -830,7 +825,7 @@ trigger:
830825

831826
steps:
832827
- name: download
833-
image: golang:1.20
828+
image: gitea/test_env:linux-1.20-amd64
834829
pull: always
835830
commands:
836831
- timeout -s ABRT 40m make generate-license generate-gitignore
@@ -890,7 +885,6 @@ steps:
890885
image: docker:git
891886
pull: always
892887
commands:
893-
- git config --global --add safe.directory /drone/src
894888
- git fetch --tags --force
895889

896890
- name: deps-frontend
@@ -900,7 +894,7 @@ steps:
900894
- make deps-frontend
901895

902896
- name: deps-backend
903-
image: golang:1.20
897+
image: gitea/test_env:linux-1.20-amd64
904898
pull: always
905899
commands:
906900
- make deps-backend
@@ -1026,7 +1020,6 @@ steps:
10261020
image: docker:git
10271021
pull: always
10281022
commands:
1029-
- git config --global --add safe.directory /drone/src
10301023
- git fetch --tags --force
10311024

10321025
- name: deps-frontend
@@ -1036,7 +1029,7 @@ steps:
10361029
- make deps-frontend
10371030

10381031
- name: deps-backend
1039-
image: golang:1.20
1032+
image: gitea/test_env:linux-1.20-amd64
10401033
pull: always
10411034
commands:
10421035
- make deps-backend
@@ -1136,7 +1129,7 @@ trigger:
11361129

11371130
steps:
11381131
- name: build-docs
1139-
image: golang:1.20
1132+
image: gitea/test_env:linux-1.20-amd64
11401133
commands:
11411134
- cd docs
11421135
- make trans-copy clean build
@@ -1190,7 +1183,6 @@ steps:
11901183
image: docker:git
11911184
pull: always
11921185
commands:
1193-
- git config --global --add safe.directory /drone/src
11941186
- git fetch --tags --force
11951187

11961188
- name: publish
@@ -1268,7 +1260,6 @@ steps:
12681260
image: docker:git
12691261
pull: always
12701262
commands:
1271-
- git config --global --add safe.directory /drone/src
12721263
- git fetch --tags --force
12731264

12741265
- name: publish
@@ -1341,7 +1332,6 @@ steps:
13411332
image: docker:git
13421333
pull: always
13431334
commands:
1344-
- git config --global --add safe.directory /drone/src
13451335
- git fetch --tags --force
13461336

13471337
- name: publish
@@ -1415,7 +1405,6 @@ steps:
14151405
image: docker:git
14161406
pull: always
14171407
commands:
1418-
- git config --global --add safe.directory /drone/src
14191408
- git fetch --tags --force
14201409

14211410
- name: publish
@@ -1533,7 +1522,6 @@ steps:
15331522
image: docker:git
15341523
pull: always
15351524
commands:
1536-
- git config --global --add safe.directory /drone/src
15371525
- git fetch --tags --force
15381526

15391527
- name: publish
@@ -1611,7 +1599,6 @@ steps:
16111599
image: docker:git
16121600
pull: always
16131601
commands:
1614-
- git config --global --add safe.directory /drone/src
16151602
- git fetch --tags --force
16161603

16171604
- name: publish
@@ -1687,7 +1674,6 @@ steps:
16871674
image: docker:git
16881675
pull: always
16891676
commands:
1690-
- git config --global --add safe.directory /drone/src
16911677
- git fetch --tags --force
16921678

16931679
- name: publish
@@ -1761,7 +1747,6 @@ steps:
17611747
image: docker:git
17621748
pull: always
17631749
commands:
1764-
- git config --global --add safe.directory /drone/src
17651750
- git fetch --tags --force
17661751

17671752
- name: publish

0 commit comments

Comments
 (0)