Skip to content

Commit

Permalink
Fix CAS login (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli authored Nov 22, 2021
1 parent fc12759 commit 8a80d94
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,3 @@ jobs:
--${{ matrix.architecture }} \
--target /data \
--generic $GIT_TAG_NAME
env:
CAS_API_KEY: ${{ secrets.CAS_TOKEN }}
15 changes: 10 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runs:
input="latest"
fi
echo "::set-output name=version::${input}"
- uses: home-assistant/actions/helpers/cas@master

- shell: bash
Expand All @@ -25,10 +25,15 @@ runs:
- shell: bash
run: |
if ! CAS_API_KEY= cas authenticate --silent --signerID [email protected] 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 [email protected] 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
Expand Down
14 changes: 11 additions & 3 deletions builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand All @@ -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"
}

Expand Down

0 comments on commit 8a80d94

Please sign in to comment.