File tree Expand file tree Collapse file tree 4 files changed +37
-13
lines changed
publish-image-index-manifest Expand file tree Collapse file tree 4 files changed +37
-13
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- # Retries any command passed to this script a maximum number of $CMD_RETRIES and
4- # wait $CMD_TIMEOUT between each try. If the command failed $CMD_RETRIES, this
3+ # Initially, the retry args are empty. If the command fails, the retry args are
4+ # set to what the user provided via the RETRY_ARGS env var.
5+ retry_args=" "
6+
7+ # Retries any command passed to this script a maximum number of $RETRY_COUNT and
8+ # wait $RETRY_TIMEOUT between each try. If the command failed $RETRY_COUNT, this
59# script will return with exit code 1.
6- for TRY in $( seq 1 " $CMD_RETRIES " ) ; do
7- " $@ "
10+ for TRY in $( seq 1 " $RETRY_COUNT " ) ; do
11+ if [ -z " $retry_args " ]; then
12+ " $@ "
13+ else
14+ " $@ " " $retry_args "
15+ fi
816
917 EXIT_CODE=$?
1018 # If command ran successfully, exit the loop
@@ -15,11 +23,12 @@ for TRY in $(seq 1 "$CMD_RETRIES"); do
1523 echo " Command failed $TRY time(s)"
1624
1725 # Exit if we reached the number if retries and the command didn't run successfully
18- if [ " $TRY " == " $CMD_RETRIES " ]; then
26+ if [ " $TRY " == " $RETRY_COUNT " ]; then
1927 echo " Exiting"
2028 exit 1
2129 fi
2230
23- echo " Waiting for $CMD_TIMEOUT to try again"
24- sleep " $CMD_TIMEOUT "
31+ retry_args=" ${RETRY_ARGS:- } "
32+ echo " Waiting for $RETRY_TIMEOUT to try again"
33+ sleep " $RETRY_TIMEOUT "
2534done
Original file line number Diff line number Diff line change @@ -27,6 +27,15 @@ inputs:
2727 app-version :
2828 description : The app version to set in the Helm Chart
2929 required : true
30+ cosign-retries :
31+ description : The number of times cosign operations should be retried
32+ default : " 3"
33+ cosign-retry-timeout :
34+ description : |
35+ Duration to wait before a new cosign operation is retried, format: `NUMBER[SUFFIX]`.
36+ SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days.
37+ See `sleep --help` for the full details.
38+ default : " 30s"
3039runs :
3140 using : composite
3241 steps :
@@ -120,6 +129,9 @@ runs:
120129
121130 - name : Sign Helm Chart
122131 env :
132+ RETRY_TIMEOUT : ${{ inputs.cosign-retry-timeout }}
133+ RETRY_COUNT : ${{ inputs.cosign-retries }}
134+ RETRY_ARGS : --verbose
123135 CHART_REGISTRY_URI : ${{ inputs.chart-registry-uri }}
124136 CHART_REPOSITORY : ${{ inputs.chart-repository }}
125137 GITHUB_DEBUG : ${{ runner.debug }}
Original file line number Diff line number Diff line change @@ -106,8 +106,9 @@ runs:
106106 - name : Sign Image Index Manifest
107107 shell : bash
108108 env :
109- CMD_TIMEOUT : ${{ inputs.cosign-retry-timeout }}
110- CMD_RETRIES : ${{ inputs.cosign-retries }}
109+ RETRY_TIMEOUT : ${{ inputs.cosign-retry-timeout }}
110+ RETRY_COUNT : ${{ inputs.cosign-retries }}
111+ RETRY_ARGS : --verbose
111112 IMAGE_REPOSITORY : ${{ inputs.image-repository }}
112113 REGISTRY_URI : ${{ inputs.image-registry-uri }}
113114 run : |
Original file line number Diff line number Diff line change @@ -100,8 +100,9 @@ runs:
100100 - name : Sign the container image (${{ env.IMAGE_REPO_DIGEST }})
101101 shell : bash
102102 env :
103- CMD_TIMEOUT : ${{ inputs.cosign-retry-timeout }}
104- CMD_RETRIES : ${{ inputs.cosign-retries }}
103+ RETRY_TIMEOUT : ${{ inputs.cosign-retry-timeout }}
104+ RETRY_COUNT : ${{ inputs.cosign-retries }}
105+ RETRY_ARGS : --verbose
105106 run : |
106107 set -euo pipefail
107108
@@ -113,8 +114,9 @@ runs:
113114 - name : Generate SBOM for the container image (${{ env.IMAGE_REPO_DIGEST }})
114115 shell : bash
115116 env :
116- CMD_TIMEOUT : ${{ inputs.cosign-retry-timeout }}
117- CMD_RETRIES : ${{ inputs.cosign-retries }}
117+ RETRY_TIMEOUT : ${{ inputs.cosign-retry-timeout }}
118+ RETRY_COUNT : ${{ inputs.cosign-retries }}
119+ RETRY_ARGS : --verbose
118120 IMAGE_MANIFEST_TAG : ${{ inputs.image-manifest-tag }}
119121 IMAGE_REPOSITORY : ${{ inputs.image-repository }}
120122 REGISTRY_URI : ${{ inputs.image-registry-uri }}
You can’t perform that action at this time.
0 commit comments