11---
22kind : pipeline
3- name : default
3+ name : testing
4+ type : docker
45
56workspace :
67 base : /go
@@ -10,26 +11,45 @@ steps:
1011 - name : build
1112 image : golang:alpine
1213 environment :
14+ DOCKER_BUILDKIT : 1
1315 GOOS : linux
1416 CGO_ENABLED : 0
1517 commands :
16- - go build
1718 - go test ./...
19+ - go build
20+ when :
21+ event : [push]
22+ branch :
23+ exclude : [main]
1824
1925 - name : test
2026 image : golang:alpine
2127 environment :
28+ DOCKER_BUILDKIT : 1
2229 GOOS : linux
2330 CGO_ENABLED : 0
2431 TEST_DIRECTORY : example-tests
2532 TEST_HOST : httpbin.org
2633 TEST_ENV : dev
2734 commands :
2835 - ./httptest
36+ when :
37+ event : [push]
38+ branch :
39+ exclude : [main]
2940
30- - name : publish-dev
41+ ---
42+ kind : pipeline
43+ name : publish-dev
44+ type : docker
45+
46+ steps :
47+ - name : publish-dev-amd64
3148 image : plugins/docker
49+ environment :
50+ DOCKER_BUILDKIT : 1
3251 settings :
52+ platform : linux/amd64
3353 repo : nytimes/httptest
3454 build_args_from_env :
3555 - DRONE_BRANCH
@@ -38,15 +58,69 @@ steps:
3858 from_secret : docker_username
3959 password :
4060 from_secret : docker_password
41- tags : [dev]
61+ tags : [dev-amd64]
62+ when :
63+ event : [push]
64+ branch :
65+ exclude : [main]
66+
67+ - name : publish-dev-arm64
68+ image : plugins/docker
69+ environment :
70+ DOCKER_BUILDKIT : 1
71+ settings :
72+ platform : linux/arm64
73+ repo : nytimes/httptest
74+ build_args_from_env :
75+ - DRONE_BRANCH
76+ - DRONE_COMMIT
77+ username :
78+ from_secret : docker_username
79+ password :
80+ from_secret : docker_password
81+ tags : [dev-arm64]
82+ when :
83+ event : [push]
84+ branch :
85+ exclude : [main]
86+
87+ - name : manifest-dev
88+ image : plugins/manifest
89+ environment :
90+ DOCKER_BUILDKIT : 1
91+ settings :
92+ username :
93+ from_secret : docker_username
94+ password :
95+ from_secret : docker_password
96+ target : nytimes/httptest:dev
97+ template : nytimes/httptest:dev-ARCH
98+ platforms :
99+ - linux/amd64
100+ - linux/arm64
42101 when :
43102 event : [push]
44103 branch :
45- exclude : [master]
104+ exclude : [main]
105+ depends_on :
106+ - publish-dev-amd64
107+ - publish-dev-arm64
108+
109+ depends_on :
110+ - testing
111+
112+ ---
113+ kind : pipeline
114+ name : publish
115+ type : docker
46116
47- - name : publish
117+ steps :
118+ - name : publish-amd64
48119 image : plugins/docker
120+ environment :
121+ DOCKER_BUILDKIT : 1
49122 settings :
123+ platform : linux/amd64
50124 repo : nytimes/httptest
51125 build_args_from_env :
52126 - DRONE_BRANCH
@@ -55,5 +129,68 @@ steps:
55129 from_secret : docker_username
56130 password :
57131 from_secret : docker_password
58- # Information on auto_tag: http://plugins.drone.io/drone-plugins/drone-docker/
59- auto_tag : true
132+ tags :
133+ - ${DRONE_TAG}-amd64
134+ - latest-amd64
135+ when :
136+ event : [tag]
137+
138+ - name : publish-arm64
139+ image : plugins/docker
140+ environment :
141+ DOCKER_BUILDKIT : 1
142+ settings :
143+ platform : linux/arm64
144+ repo : nytimes/httptest
145+ build_args_from_env :
146+ - DRONE_BRANCH
147+ - DRONE_COMMIT
148+ username :
149+ from_secret : docker_username
150+ password :
151+ from_secret : docker_password
152+ tags :
153+ - ${DRONE_TAG}-arm64
154+ - latest-arm64
155+ when :
156+ event : [tag]
157+
158+ - name : manifest-tagged
159+ image : plugins/manifest
160+ environment :
161+ DOCKER_BUILDKIT : 1
162+ settings :
163+ username :
164+ from_secret : docker_username
165+ password :
166+ from_secret : docker_password
167+ target : " nytimes/httptest:${DRONE_TAG}"
168+ template : " nytimes/httptest:${DRONE_TAG}-ARCH"
169+ platforms :
170+ - linux/amd64
171+ - linux/arm64
172+ depends_on :
173+ - publish-amd64
174+ - publish-arm64
175+ when :
176+ event : [tag]
177+
178+ - name : manifest-latest
179+ image : plugins/manifest
180+ environment :
181+ DOCKER_BUILDKIT : 1
182+ settings :
183+ username :
184+ from_secret : docker_username
185+ password :
186+ from_secret : docker_password
187+ target : nytimes/httptest:latest
188+ template : nytimes/httptest:latest-ARCH
189+ platforms :
190+ - linux/amd64
191+ - linux/arm64
192+ depends_on :
193+ - publish-amd64
194+ - publish-arm64
195+ when :
196+ event : [tag]
0 commit comments