@@ -174,7 +174,7 @@ def prepublish(config):
174174 "from_secret" : "internal_password" ,
175175 },
176176 "tags" : config ["internal" ],
177- "build_args_from_env " : ["DEB_MIRROR_URL" , "DEB_MIRROR_LOGIN" , "DEB_MIRROR_PWD " ],
177+ "secrets " : ["id=mirror-auth \\ \\ ,src=/drone/src/mirror-auth" , "id=mirror-url \\ \\ ,src=/drone/src/mirror-url " ],
178178 "dockerfile" : "%s/Dockerfile.multiarch" % (config ["version" ]["path" ]),
179179 "repo" : "registry.drone.owncloud.com/owncloud/%s" % config ["repo" ],
180180 "registry" : "registry.drone.owncloud.com" ,
@@ -183,15 +183,6 @@ def prepublish(config):
183183 },
184184 "environment" : {
185185 "BUILDKIT_NO_CLIENT_TOKEN" : True ,
186- "DEB_MIRROR_URL" : {
187- "from_secret" : "DEB_MIRROR_URL" ,
188- },
189- "DEB_MIRROR_LOGIN" : {
190- "from_secret" : "DEB_MIRROR_LOGIN" ,
191- },
192- "DEB_MIRROR_PWD" : {
193- "from_secret" : "DEB_MIRROR_PWD" ,
194- },
195186 },
196187 },
197188 ]
@@ -268,12 +259,26 @@ def publish(config):
268259 "linux/arm64" ,
269260 ],
270261 "tags" : config ["version" ]["tags" ],
271- "build_args_from_env " : ["DEB_MIRROR_URL" , "DEB_MIRROR_LOGIN" , "DEB_MIRROR_PWD " ],
262+ "secrets " : ["id=mirror-auth \\ \\ ,src=/drone/src/mirror-auth" , "id=mirror-url \\ \\ ,src=/drone/src/mirror-url " ],
272263 "dockerfile" : "%s/Dockerfile.multiarch" % (config ["version" ]["path" ]),
273264 "repo" : "owncloud/%s" % config ["repo" ],
274265 "context" : config ["version" ]["path" ],
275266 "pull_image" : False ,
276267 },
268+ "when" : {
269+ "ref" : [
270+ "refs/heads/master" ,
271+ ],
272+ },
273+ },
274+ ]
275+
276+ def setup (config ):
277+ return [
278+ {
279+ "name" : "setup" ,
280+ "image" : "docker.io/owncloudci/alpine" ,
281+ "failure" : "ignore" ,
277282 "environment" : {
278283 "DEB_MIRROR_URL" : {
279284 "from_secret" : "DEB_MIRROR_URL" ,
@@ -285,11 +290,10 @@ def publish(config):
285290 "from_secret" : "DEB_MIRROR_PWD" ,
286291 },
287292 },
288- "when" : {
289- "ref" : [
290- "refs/heads/master" ,
291- ],
292- },
293+ "commands" : [
294+ 'echo "machine $DEB_MIRROR_URL login $DEB_MIRROR_LOGIN password $DEB_MIRROR_PWD" > mirror-auth' ,
295+ 'echo "$DEB_MIRROR_URL" > mirror-url' ,
296+ ],
293297 },
294298 ]
295299
@@ -308,6 +312,8 @@ def cleanup(config):
308312 },
309313 },
310314 "commands" : [
315+ "rm -f mirror-auth" ,
316+ "rm -f mirror-url" ,
311317 "regctl registry login registry.drone.owncloud.com --user $DOCKER_USER --pass $DOCKER_PASSWORD" ,
312318 "regctl tag rm registry.drone.owncloud.com/owncloud/%s:%s" % (config ["repo" ], config ["internal" ]),
313319 ],
@@ -367,4 +373,4 @@ def shellcheck(config):
367373 ]
368374
369375def steps (config ):
370- return prepublish (config ) + sleep (config ) + trivy (config ) + publish (config ) + cleanup (config )
376+ return setup ( config ) + prepublish (config ) + sleep (config ) + trivy (config ) + publish (config ) + cleanup (config )
0 commit comments