Skip to content

Commit

Permalink
Fix new version (#100)
Browse files Browse the repository at this point in the history
* New VCN change return value on error

* Fix handling

* fix command
  • Loading branch information
pvizeli authored Jun 7, 2021
1 parent 3653166 commit 6792942
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 5 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ runs:

- shell: bash
run: |
sudo curl -Lo /usr/local/bin/vcn https://github.com/vchain-us/vcn/releases/download/v0.9.6/vcn-v0.9.6-linux-amd64-static
sudo chmod a+x /usr/local/bin/vcn
mkdir -p "${{ github.action_path }}/bin"
curl -Lo "${{ github.action_path }}/bin/vcn" https://github.com/vchain-us/vcn/releases/download/v0.9.6/vcn-v0.9.6-linux-amd64-static
chmod a+x "${{ github.action_path }}/bin/vcn"
echo "${{ github.action_path }}/bin" >> $GITHUB_PATH
state="$(vcn authenticate --org home-assistant.io --output json docker://ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }} | jq '.verification.status // 2')"
if [[ "${state}" != "0" ]]; then
if ! "${{ github.action_path }}/bin/vcn" authenticate --org home-assistant.io --silent docker://ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }}; then
echo "Invalid signature!"
exit 1
fi
Expand Down
8 changes: 2 additions & 6 deletions builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,6 @@ function codenotary_setup() {
function codenotary_sign() {
local trust=$1
local image=$2
local state=
local vcn_cli=()

if bashio::var.false "${DOCKER_PUSH}" || bashio::var.false "${VCN_NOTARY}"; then
Expand All @@ -706,8 +705,7 @@ function codenotary_sign() {
vcn_cli+=("--org" "${trust}")
fi

state="$(vcn authenticate "${vcn_cli[@]}" --output json "docker://${image}" | jq '.verification.status // 2')"
if [[ "${state}" != "0" ]]; then
if ! vcn authenticate "${vcn_cli[@]}" --silent "docker://${image}"; then
VCN_NOTARIZATION_PASSWORD="${CODENOTARY_PASSWORD}" vcn notarize --public "docker://${image}" || bashio::exit.nok "Failed to sign the image"
fi
bashio::log.info "Signed ${image} with ${trust}"
Expand All @@ -717,7 +715,6 @@ function codenotary_validate() {
local trust=$1
local image=$2
local pull=$3
local state=
local vcn_cli=()

if ! bashio::var.has_value "${trust}"; then
Expand All @@ -735,8 +732,7 @@ function codenotary_validate() {
vcn_cli+=("--org" "${trust}")
fi

state="$(vcn authenticate "${vcn_cli[@]}" --output json "docker://${image}" | jq '.verification.status // 2')"
if [[ "${state}" != "0" ]]; then
if ! vcn authenticate "${vcn_cli[@]}" --silent "docker://${image}" ; then
bashio::log.warning "Validation of ${image} fails!"
return 1
fi
Expand Down

0 comments on commit 6792942

Please sign in to comment.