Skip to content

Commit 6792942

Browse files
authored
Fix new version (#100)
* New VCN change return value on error * Fix handling * fix command
1 parent 3653166 commit 6792942

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

action.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ runs:
2222

2323
- shell: bash
2424
run: |
25-
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
26-
sudo chmod a+x /usr/local/bin/vcn
25+
mkdir -p "${{ github.action_path }}/bin"
26+
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
27+
chmod a+x "${{ github.action_path }}/bin/vcn"
28+
echo "${{ github.action_path }}/bin" >> $GITHUB_PATH
2729
28-
state="$(vcn authenticate --org home-assistant.io --output json docker://ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }} | jq '.verification.status // 2')"
29-
if [[ "${state}" != "0" ]]; then
30+
if ! "${{ github.action_path }}/bin/vcn" authenticate --org home-assistant.io --silent docker://ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }}; then
3031
echo "Invalid signature!"
3132
exit 1
3233
fi

builder.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,6 @@ function codenotary_setup() {
693693
function codenotary_sign() {
694694
local trust=$1
695695
local image=$2
696-
local state=
697696
local vcn_cli=()
698697

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

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

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

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

0 commit comments

Comments
 (0)