diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cd75e55..aaf1d2c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,5 +60,3 @@ jobs: --${{ matrix.architecture }} \ --target /data \ --generic $GIT_TAG_NAME - env: - CAS_API_KEY: ${{ secrets.CAS_TOKEN }} diff --git a/action.yml b/action.yml index c6a7948..fc65fb6 100644 --- a/action.yml +++ b/action.yml @@ -16,7 +16,7 @@ runs: input="latest" fi echo "::set-output name=version::${input}" - + - uses: home-assistant/actions/helpers/cas@master - shell: bash @@ -25,10 +25,15 @@ runs: - shell: bash run: | - if ! CAS_API_KEY= cas authenticate --silent --signerID notary@home-assistant.io docker://ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }}; then - echo "Invalid signature!" - exit 1 - fi + for j in {1..3}; do + if CAS_API_KEY= cas authenticate --silent --signerID notary@home-assistant.io docker://ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }}; then + exit 0 + fi + sleep 5 + done + + echo "Invalid signature!" + exit 1 - shell: bash id: builder diff --git a/builder.sh b/builder.sh index 2834443..ae0c90a 100755 --- a/builder.sh +++ b/builder.sh @@ -726,7 +726,7 @@ function codenotary_setup() { return 0 fi - cas login /dev/null 2>&1 || bashio::exit.nok "Login to Codenotary fails!" + cas login > /dev/null 2>&1 || bashio::exit.nok "Login to Codenotary fails!" } function codenotary_sign() { @@ -759,6 +759,7 @@ function codenotary_validate() { local trust=$1 local image=$2 local pull=$3 + local success=false if ! bashio::var.has_value "${trust}"; then return 0 @@ -769,11 +770,18 @@ function codenotary_validate() { docker pull "${image}" > /dev/null 2>&1 || bashio::exit.nok "Can't pull image ${image}" fi - if ! cas authenticate --signerID "${trust}" --silent "docker://${image}" ; then + for j in {1..10}; do + if cas authenticate --signerID "${trust}" --silent "docker://${image}" ; then + success=true + break + fi + sleep 5 + done + + if bashio::var.false "${success}"; then bashio::log.warning "Validation of ${image} fails!" return 1 fi - bashio::log.info "Image ${image} is trusted" }