From c198fff51167a63b0a637e0eb752e43f87cdc7d9 Mon Sep 17 00:00:00 2001 From: Viacheslav Bocharov Date: Wed, 19 Jun 2024 17:28:48 +0300 Subject: [PATCH] JH: Fix builder.sh --- builder.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/builder.sh b/builder.sh index f4f268a..a5768a5 100755 --- a/builder.sh +++ b/builder.sh @@ -22,7 +22,7 @@ CUSTOM_CACHE_TAG= COSIGN=false RELEASE_TAG=false GIT_REPOSITORY= -GIT_BRANCH="master" +GIT_BRANCH="master-jethub" TARGET= VERSION= VERSION_BASE= @@ -35,6 +35,11 @@ BUILD_TYPE="addon" BUILD_TASKS=() BUILD_ERROR=() declare -A BUILD_MACHINE=( + [jethub-d1]="aarch64" \ + [jethub-d1p]="aarch64" \ + [jethub-d2]="aarch64" \ + [jethub-h1]="aarch64" \ + [jethub-h2]="aarch64" \ [generic-x86-64]="amd64" \ [intel-nuc]="amd64" \ [khadas-vim3]="aarch64" \ @@ -64,7 +69,7 @@ declare -A BUILD_MACHINE=( function print_help() { cat << EOF Hass.io build-env for ecosystem: -docker run --rm homeassistant/{arch}-builder:latest [options] +docker run --rm jethubjhaos/{arch}-builder:latest [options] Options: -h, --help @@ -526,7 +531,7 @@ function build_addon() { # Set defaults build things if [ -z "$build_from" ]; then bashio::log.info "No build information or from not provided. Using default base image." - build_from="homeassistant/${build_arch}-base:latest" + build_from="jethubjhaos/${build_arch}-base:latest" fi # Additional build args @@ -801,6 +806,8 @@ function cosign_verify() { fi # validate image + echo cosign verify --certificate-oidc-issuer-regexp "${issuer}" --certificate-identity-regexp "${identity}" "${image}" + echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ for j in {1..6}; do if cosign verify --certificate-oidc-issuer-regexp "${issuer}" --certificate-identity-regexp "${identity}" "${image}"; then success=true @@ -811,10 +818,15 @@ function cosign_verify() { if bashio::var.false "${success}"; then bashio::log.warning "Validation of ${image} fails with cosign!" - if bashio::var.true "${pull}"; then + cosign_sign "${image}" + if bashio::var.false "${success}"; then + bashio::log.info "Failed to sign the image (cosign)" + if bashio::var.true "${pull}"; then docker rmi "${image}" > /dev/null 2>&1 || true + fi + return 1 fi - return 1 + bashio::log.info "Signed ${image} with cosign" fi bashio::log.info "Image ${image} is trusted by cosign" }