Skip to content

Commit

Permalink
CI/CD: try with other form of parameter+variable interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
bertsky authored Oct 15, 2024
1 parent 03fe0f8 commit 9a5542a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ commands:
description: "image tag (full variant name) to be removed"
type:
string
environment:
- SHA1TAG: << parameters.tag >>-${CIRCLE_SHA1}
steps:
- run:
name: save image
command: |
docker tag ocrd/all:<< parameters.tag >> ocrd/all:<< parameters.tag >>-${CIRCLE_SHA1}
docker push ocrd/all:<< parameters.tag >>-${CIRCLE_SHA1}
docker tag ocrd/all:<< parameters.tag >> ocrd/all:$SHA1TAG
docker push ocrd/all:$SHA1TAG
no_output_timeout: 30m
dockerhub-load:
description: "load an image from Dockerhub"
Expand All @@ -22,24 +24,28 @@ commands:
description: "image tag (full variant name) to be pulled"
type:
string
environment:
- SHA1TAG: << parameters.tag >>-${CIRCLE_SHA1}
steps:
- run:
name: load previous image
command: |
docker pull ocrd/all:<< parameters.tag >>-${CIRCLE_SHA1}
docker tag ocrd/all:<< parameters.tag >>-${CIRCLE_SHA1} ocrd/all:<< parameters.tag >>
docker pull ocrd/all:$SHA1TAG
docker tag ocrd/all:$SHA1TAG ocrd/all:<< parameters.tag >>
dockerhub-remove:
description: "remove an image on Dockerhub"
parameters:
tag:
description: "image tag (full variant name) to be removed"
type:
string
environment:
- SHA1TAG: << parameters.tag >>-${CIRCLE_SHA1}
steps:
- run:
command: |
HUB_TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d "{\"username\": \"$DOCKERHUB_USERNAME\", \"password\": \"$DOCKERHUB_PASSWORD\"}" https://hub.docker.com/v2/users/login/ | jq -r .token)
curl -i -X DELETE -H "Accept: application/json" -H "Authorization: JWT $HUB_TOKEN" https://hub.docker.com/v2/namespaces/ocrd/repositories/all/tags/<< parameters.tag >>-${CIRCLE_SHA1}/
curl -i -X DELETE -H "Accept: application/json" -H "Authorization: JWT $HUB_TOKEN" https://hub.docker.com/v2/namespaces/ocrd/repositories/all/tags/$SHA1TAG/
build:
description: "template for all docker-* build jobs"
parameters:
Expand Down

0 comments on commit 9a5542a

Please sign in to comment.