27
27
28
28
29
29
jobs :
30
- build-oss :
30
+ build :
31
31
runs-on : ubuntu-latest
32
32
services :
33
33
registry :
36
36
- 5000:5000
37
37
# Note that uploading the artifact won't work. We will need to build and push it to a local registry.
38
38
# See here https://docs.docker.com/build/ci/github-actions/named-contexts/#using-with-a-container-builder
39
-
39
+ # This person has my problem: https://stackoverflow.com/questions/75831482/how-to-use-a-local-docker-registry2-from-one-job-as-a-container-for-another-job
40
+ # The issue is that the docker container that is the registery does not persist between jobs.
41
+ # So I"d need to do something dumb like use the artifact upload and download to get to to the next
42
+ # step then do it there.
43
+ # Time to cut my losses and do it mostly in one run.
40
44
if : github.ref != 'refs/heads/master'
41
45
steps :
42
46
- uses : actions/checkout@v4
@@ -47,175 +51,60 @@ jobs:
47
51
with :
48
52
# network=host driver-opt needed to push to local registry
49
53
driver-opts : network=host
50
- - name : Build and export
54
+ - name : Build and export oss image
51
55
uses : docker/build-push-action@v5
52
56
with :
53
57
file : Dockerfile.oss
54
58
context : .
55
- tags : nginx-s3-gateway , nginx-s3-gateway:oss
59
+ tags : localhost:5000/ nginx-s3-gateway , localhost:5000/ nginx-s3-gateway:oss
56
60
push : true
57
-
58
- test-oss :
59
- runs-on : ubuntu-latest
60
- needs : build-oss
61
- services :
62
- registry :
63
- image : registry:2
64
- ports :
65
- - 5000:5000
66
-
67
- if : github.ref != 'refs/heads/master'
68
- steps :
69
- - uses : actions/checkout@v4
70
- - name : Install dependencies
71
- run : sudo apt-get update -qq && sudo apt-get install -y curl wait-for-it
72
- - name : Restore cached binaries
73
- id : cache-binaries-restore
74
- uses : actions/cache/restore@v3
75
- with :
76
- path : .bin
77
- key : ${{ runner.os }}-binaries
78
- - name : Install MinIO Client
61
+ - name : save image for upload
79
62
run : |
80
- mkdir .bin || exit 0
81
- cd .bin
82
- curl --insecure --retry 6 --fail --location --output mc.RELEASE.2023-06-19T19-31-19Z "https://dl.min.io/client/mc/release/linux-$(dpkg --print-architecture)/archive/mc.RELEASE.2023-06-19T19-31-19Z"
83
- curl --insecure --retry 6 --fail --silent --location "https://dl.min.io/client/mc/release/linux-$(dpkg --print-architecture)/archive/mc.RELEASE.2023-06-19T19-31-19Z.sha256sum" | sha256sum --check -
84
- mv mc.RELEASE.2023-06-19T19-31-19Z mc
85
- chmod +x mc
86
- - name : Save cached binaries
87
- id : cache-binaries-save
88
- uses : actions/cache/save@v3
63
+ docker save localhost:5000/nginx-s3-gateway > oss.tar
64
+ - name : Upload artifact - oss
65
+ uses : actions/upload-artifact@v3
89
66
with :
90
- path : .bin
91
- key : ${{ steps.cache-binaries-restore.outputs.cache-primary-key }}
92
- - name : Load image
93
- run : |
94
- docker pull localhost:5000/nginx-s3-gateway:oss
95
- docker tag nginx-s3-gateway:oss nginx-s3-gateway
96
- - name : Run tests - stable njs version
97
- run : ./test.sh --type oss
98
-
99
- build-latest-njs :
100
- runs-on : ubuntu-latest
101
- needs : test-oss
102
- services :
103
- registry :
104
- image : registry:2
105
- ports :
106
- - 5000:5000
67
+ name : oss
68
+ path : /tmp/oss.tar
107
69
108
- if : github.ref != 'refs/heads/master'
109
- steps :
110
- - uses : actions/checkout@v4
111
- - name : Set up QEMU
112
- uses : docker/setup-qemu-action@v3
113
- - name : Set up Docker Buildx
114
- uses : docker/setup-buildx-action@v3
115
- with :
116
- # network=host driver-opt needed to push to local registry
117
- driver-opts : network=host
118
- - name : Build and export
70
+ - name : Build and export latest-njs image
119
71
uses : docker/build-push-action@v5
120
72
with :
121
73
file : Dockerfile.latest-njs
122
74
context : .
123
- tags : nginx-s3-gateway:latest-njs-oss
124
- push : true
75
+ tags : localhost:5000/nginx-s3-gateway:latest-njs-oss
76
+ push : false
77
+ outputs : type=docker,dest=/tmp/latest-njs.tar
125
78
build-contexts : |
126
79
nginx-s3-gateway=docker-image://localhost:5000/nginx-s3-gateway:oss
127
-
128
- test-latest-njs :
129
- runs-on : ubuntu-latest
130
- needs : build-latest-njs
131
- services :
132
- registry :
133
- image : registry:2
134
- ports :
135
- - 5000:5000
136
-
137
- if : github.ref != 'refs/heads/master'
138
- steps :
139
- - uses : actions/checkout@v4
140
- - name : Install dependencies
141
- run : sudo apt-get update -qq && sudo apt-get install -y curl wait-for-it
142
- - name : Restore cached binaries
143
- id : cache-binaries-restore
144
- uses : actions/cache/restore@v3
145
- with :
146
- path : .bin
147
- key : ${{ runner.os }}-binaries
148
- - name : Install MinIO Client
149
- run : |
150
- mkdir .bin || exit 0
151
- cd .bin
152
- curl --insecure --retry 6 --fail --location --output mc.RELEASE.2023-06-19T19-31-19Z "https://dl.min.io/client/mc/release/linux-$(dpkg --print-architecture)/archive/mc.RELEASE.2023-06-19T19-31-19Z"
153
- curl --insecure --retry 6 --fail --silent --location "https://dl.min.io/client/mc/release/linux-$(dpkg --print-architecture)/archive/mc.RELEASE.2023-06-19T19-31-19Z.sha256sum" | sha256sum --check -
154
- mv mc.RELEASE.2023-06-19T19-31-19Z mc
155
- chmod +x mc
156
- - name : Save cached binaries
157
- id : cache-binaries-save
158
- uses : actions/cache/save@v3
80
+ - name : Upload artifact - latest-njs
81
+ uses : actions/upload-artifact@v3
159
82
with :
160
- path : .bin
161
- key : ${{ steps.cache-binaries-restore.outputs.cache-primary-key }}
162
- - name : Load image
163
- run : |
164
- docker pull localhost:5000/nginx-s3-gateway:latest-njs-oss
165
- docker tag nginx-s3-gateway:latest-njs-oss nginx-s3-gateway
166
- - name : Run tests - latest njs version
167
- run : ./test.sh --latest-njs --type oss
83
+ name : latest-njs
84
+ path : /tmp/latest-njs.tar
168
85
169
- build-oss-unprivileged :
170
- runs-on : ubuntu-latest
171
- needs : test-oss
172
- services :
173
- registry :
174
- image : registry:2
175
- ports :
176
- - 5000:5000
177
-
178
- if : github.ref != 'refs/heads/master'
179
- steps :
180
- - uses : actions/checkout@v4
181
- - name : Set up QEMU
182
- uses : docker/setup-qemu-action@v3
183
- - name : Set up Docker Buildx
184
- uses : docker/setup-buildx-action@v3
185
- with :
186
- # network=host driver-opt needed to push to local registry
187
- driver-opts : network=host
188
- - name : Build and export
86
+ - name : Build and export - unprivileged
189
87
uses : docker/build-push-action@v5
190
88
with :
191
89
file : Dockerfile.unprivileged
192
90
context : .
193
- tags : nginx-s3-gateway:unprivileged
194
- push : true
91
+ tags : localhost:5000/nginx-s3-gateway:unprivileged
92
+ push : false
93
+ outputs : type=docker,dest=/tmp/unprivileged.tar
195
94
build-contexts : |
196
95
nginx-s3-gateway=docker-image://localhost:5000/nginx-s3-gateway:oss
197
-
198
- # - name: Run tests - latest njs version
199
- # run: ./test.sh --latest-njs --type oss
200
- # - name: Run tests - stable njs version
201
- # run: ./test.sh --type oss
202
- # - name: Run tests - stable njs version - unprivileged process
203
- # run: ./test.sh --unprivileged --type oss
204
- # - name: Run tests - latest njs version - unprivileged process
205
- # run: ./test.sh --latest-njs --unprivileged --type oss
206
-
207
- test-oss-unprivileged :
96
+ - name : Upload artifact - unprivileged
97
+ uses : actions/upload-artifact@v3
98
+ with :
99
+ name : unprivileged
100
+ path : /tmp/unprivileged.tar
101
+ test :
208
102
runs-on : ubuntu-latest
209
- needs : build-oss-unprivileged
210
- services :
211
- registry :
212
- image : registry:2
213
- ports :
214
- - 5000:5000
215
-
216
103
if : github.ref != 'refs/heads/master'
217
104
steps :
218
105
- uses : actions/checkout@v4
106
+ # # Start tests. Keep things here because we can't keep the registry between jobs
107
+ # # TODO: Try saving the artifact after all are built? What happens to the other archs?
219
108
- name : Install dependencies
220
109
run : sudo apt-get update -qq && sudo apt-get install -y curl wait-for-it
221
110
- name : Restore cached binaries
@@ -232,18 +121,33 @@ jobs:
232
121
curl --insecure --retry 6 --fail --silent --location "https://dl.min.io/client/mc/release/linux-$(dpkg --print-architecture)/archive/mc.RELEASE.2023-06-19T19-31-19Z.sha256sum" | sha256sum --check -
233
122
mv mc.RELEASE.2023-06-19T19-31-19Z mc
234
123
chmod +x mc
235
- - name : Save cached binaries
236
- id : cache-binaries-save
237
- uses : actions/cache/save@v3
124
+
125
+ # # OSS Test. No retagging needed
126
+ - name : Download artifact
127
+ uses : actions/download-artifact@v3
238
128
with :
239
- path : .bin
240
- key : ${{ steps.cache-binaries-restore.outputs.cache-primary-key }}
129
+ name : oss
130
+ path : /tmp
241
131
- name : Load image
242
132
run : |
243
- docker pull localhost:5000/nginx-s3-gateway:unprivileged
244
- docker tag nginx-s3-gateway:unprivileged nginx-s3-gateway
245
- - name : Run tests - stable njs version - unprivileged process
246
- run : ./test.sh --unprivileged --type oss
133
+ docker load --input /tmp/oss.tar
134
+ - name : Run tests - stable njs version
135
+ run : ./test.sh --type oss
136
+
137
+ # ## Latest NJS test. Requires that we retag the latest njs one as the primary for now
138
+ # - name: Load image latest-oss
139
+ # run: |
140
+ # docker pull localhost:5000/nginx-s3-gateway:latest-njs-oss
141
+ # docker tag nginx-s3-gateway:latest-njs-oss nginx-s3-gateway
142
+ # - name: Run tests - latest njs version
143
+ # run: ./test.sh --latest-njs --type oss
144
+
145
+ # - name: Load image - unprivilegedp
146
+ # run: |
147
+ # docker pull localhost:5000/nginx-s3-gateway:unprivileged
148
+ # docker tag nginx-s3-gateway:unprivileged nginx-s3-gateway
149
+ # - name: Run tests - stable njs version - unprivileged process
150
+ # run: ./test.sh --unprivileged --type oss
247
151
248
152
# build_and_deploy:
249
153
# runs-on: ubuntu-latest
0 commit comments