Skip to content

Commit

Permalink
JH: Fix builder.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
adeepn committed Aug 13, 2024
1 parent 3254bdb commit 427636a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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" \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
}
Expand Down

0 comments on commit 427636a

Please sign in to comment.