Skip to content

Commit

Permalink
Remove Codenotary CAS
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli authored Sep 23, 2023
1 parent 866aaae commit 7961707
Showing 1 changed file with 1 addition and 53 deletions.
54 changes: 1 addition & 53 deletions builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ function run_build() {
local cosign_base_issuer=
local cosign_identity=
local cosign_issuer=
local codenotary_sign=

# Overwrites
if bashio::var.has_value "${DOCKER_HUB}"; then repository="${DOCKER_HUB@L}"; fi
Expand All @@ -253,9 +252,6 @@ function run_build() {
cosign_base_issuer="$(jq --raw-output '.cosign.base_issuer // "https://token.actions.githubusercontent.com"' "/tmp/build_config/build.json")"
cosign_identity="$(jq --raw-output '.cosign.identity // empty' "/tmp/build_config/build.json")"
cosign_issuer="$(jq --raw-output '.cosign.issuer // "https://token.actions.githubusercontent.com"' "/tmp/build_config/build.json")"

# remove later
codenotary_sign="$(jq --raw-output '.codenotary.signer // empty' "/tmp/build_config/build.json")"
fi

# Adjust Qemu CPU
Expand Down Expand Up @@ -365,9 +361,6 @@ function run_build() {
push_images+=("${shadow_repository}/${image}:${version}")
fi

# Singing image (cas)
codenotary_sign "${codenotary_sign}" "${repository}/${image}:${version}"

# Push images
if bashio::var.true "${DOCKER_PUSH}"; then
for i in "${push_images[@]}"; do
Expand Down Expand Up @@ -581,7 +574,6 @@ function build_generic() {
local shadow_repository=
local raw_image=
local args=
local codenotary_sign=
local docker_cli=()
local docker_tags=()

Expand All @@ -592,7 +584,6 @@ function build_generic() {
labels="$(jq --raw-output '.labels // empty | keys[]' "/tmp/build_config/build.json")"
raw_image="$(jq --raw-output '.image // empty' "/tmp/build_config/build.json")"
shadow_repository="$(jq --raw-output '.shadow_repository // empty' "/tmp/build_config/build.json")"
codenotary_sign="$(jq --raw-output '.codenotary.signer // empty' "/tmp/build_config/build.json")"
fi

# Set defaults build things
Expand Down Expand Up @@ -730,48 +721,6 @@ function init_crosscompile() {
> /dev/null 2>&1 || bashio::log.warning "Can't enable crosscompiling feature"
}

#### Security CodeNotary ####

function codenotary_setup() {
if bashio::var.false "${DOCKER_PUSH}" || bashio::var.is_empty "${CAS_API_KEY+x}"; then
return 0
fi

for j in {1..15}; do
if cas login > /dev/null 2>&1; then
return 0
fi
sleep $((5 * j))
done

bashio::exit.nok "Login to Codenotary fails!"
}

function codenotary_sign() {
local trust=$1
local image=$2

local success=false

if bashio::var.false "${DOCKER_PUSH}" || bashio::var.is_empty "${CAS_API_KEY+x}"; then
return 0
fi

for j in {1..15}; do
if ! cas authenticate --signerID "${trust}" --silent "docker://${image}"; then
cas notarize --ci-attr "docker://${image}" || true
else
success=true
break
fi
sleep $((5 * j))
done

if bashio::var.false "${success}"; then
bashio::exit.nok "Failed to sign the image (cas)"
fi
bashio::log.info "Signed ${image} with ${trust} (cas)"
}

#### Security cosign ####

Expand Down Expand Up @@ -1002,11 +951,10 @@ convert_to_json
# Copy configuration files to tmp
copy_config_tmp

# Login into dockerhub & setup CodeNotary
# Login into dockerhub
if [ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASSWORD" ]; then
docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
fi
codenotary_setup

# Select arch build
if [ "${#BUILD_LIST[@]}" -ne 0 ]; then
Expand Down

0 comments on commit 7961707

Please sign in to comment.