File tree Expand file tree Collapse file tree 7 files changed +63
-22
lines changed Expand file tree Collapse file tree 7 files changed +63
-22
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ workflows:
16
16
tags :
17
17
only : /.*/
18
18
- orb-tools/review :
19
- exclude : RC009
20
19
filters :
21
20
tags :
22
21
only : /.*/
Original file line number Diff line number Diff line change 16
16
steps :
17
17
- run :
18
18
name : Docker pull
19
- command : |
20
- echo "<<parameters.images>>" | sed -n 1'p' | tr ',' '\n' | while read image; do
21
- echo "Pulling ${image}";
22
- docker pull ${image} <<#parameters.ignore-docker-pull-error>>|| true<</parameters.ignore-docker-pull-error>>
23
- done
19
+ environment :
20
+ PARAM_IMAGES : <<parameters.images>>
21
+ PARAM_IGNORE_DOCKER_PULL_ERROR : <<parameters.ignore-docker-pull-error>>
22
+ command : << include(scripts/pull.sh) >>
Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ parameters:
29
29
steps :
30
30
- deploy :
31
31
name : <<parameters.step-name>>
32
+ environment :
33
+ PARAM_REGISTRY : <<parameters.registry>>
34
+ PARAM_IMAGE : <<parameters.image>>
35
+ PARAM_TAG : <<parameters.tag>>
36
+ PARAM_DIGEST_PATH : <<parameters.digest-path>>
32
37
command : |
33
38
IFS="," read -ra DOCKER_TAGS \<<< "<< parameters.tag >>"
34
39
for tag in "${DOCKER_TAGS[@]}"; do
Original file line number Diff line number Diff line change @@ -38,19 +38,11 @@ parameters:
38
38
steps :
39
39
- deploy :
40
40
name : Update description
41
- command : |
42
- if [ "<<parameters.registry>>" != "docker.io" ]; then
43
- echo "Registry is not set to Docker Hub. Exiting"
44
- exit 1
45
- fi
46
- DESCRIPTION="<<parameters.path>>/<<parameters.readme>>"
47
- PAYLOAD="username=$<<parameters.docker-username>>&password=$<<parameters.docker-password>>"
48
- JWT=$(curl -s -d $PAYLOAD https://hub.docker.com/v2/users/login/ | jq -r .token)
49
- HEADER="Authorization: JWT $JWT"
50
- URL="https://hub.docker.com/v2/repositories/<<parameters.image>>/"
51
- STATUS=$(curl -s -o /dev/null -w %{http_code} -X PATCH -H "$HEADER" --data-urlencode full_description@$DESCRIPTION $URL)
52
- if [ $STATUS -ne 200 ]; then
53
- echo "Could not update image description"
54
- echo "Error code: $STATUS"
55
- exit 1
56
- fi
41
+ environment :
42
+ PARAM_README : <<parameters.readme>>
43
+ PARAM_PATH : <<parameters.path>>
44
+ PARAM_REGISTRY : <<parameters.registry>>
45
+ PARAM_IMAGE : <<parameters.image>>
46
+ PARAM_DOCKER_USERNAME : <<parameters.docker-username>>
47
+ PARAM_DOCKER_PASSWORD : <<parameters.docker-password>>
48
+ command : << include(scripts/update-description.sh) >>
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ echo " $PARAM_IMAGES " | sed -n 1' p' | tr ' ,' ' \n' | while read -r image; do
4
+ echo " Pulling ${image} " ;
5
+
6
+ if [ " $PARAM_IGNORE_DOCKER_PULL_ERROR " -eq 1 ]; then
7
+ docker pull " ${image} " || true ;
8
+ else
9
+ docker pull " ${image} " ;
10
+ fi
11
+ done
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ IFS=" ," read -ra DOCKER_TAGS <<< " $PARAM_TAG"
4
+
5
+ for tag in " ${DOCKER_TAGS[@]} " ; do
6
+ docker push " $PARAM_REGISTRY " /" $PARAM_IMAGE " :${tag}
7
+ done
8
+
9
+ if [ -n " $PARAM_DIGEST_PATH " ]; then
10
+ mkdir -p " $( dirname " $PARAM_DIGEST_PATH " ) "
11
+ IFS=" ," read -ra DOCKER_TAGS <<< " $PARAM_TAG"
12
+ docker image inspect --format=" {{index .RepoDigests 0}}" " $PARAM_REGISTRY " /" $PARAM_IMAGE " :" ${DOCKER_TAGS[0]} " > " $PARAM_DIGEST_PATH "
13
+ fi
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [ " $PARAM_REGISTRY " != " docker.io" ]; then
4
+ echo " Registry is not set to Docker Hub. Exiting"
5
+ exit 1
6
+ fi
7
+
8
+ USERNAME=${! PARAM_DOCKER_USERNAME}
9
+ PASSWORD=${! PARAM_DOCKER_PASSWORD}
10
+
11
+ DESCRIPTION=" $PARAM_PATH /$PARAM_README "
12
+ PAYLOAD=" username=$USERNAME &password=$PASSWORD "
13
+ JWT=$( curl -s -d " $PAYLOAD " https://hub.docker.com/v2/users/login/ | jq -r .token)
14
+ HEADER=" Authorization: JWT $JWT "
15
+ URL=" https://hub.docker.com/v2/repositories/$PARAM_IMAGE /"
16
+ STATUS=$( curl -s -o /dev/null -w ' %{http_code}' -X PATCH -H " $HEADER " --data-urlencode full_description@$DESCRIPTION $URL )
17
+
18
+ if [ $STATUS -ne 200 ]; then
19
+ echo " Could not update image description"
20
+ echo " Error code: $STATUS "
21
+ exit 1
22
+ fi
You can’t perform that action at this time.
0 commit comments