Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions pushall
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@ if [ -n "${DOCKER_PASSWORD:-}" ]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
fi

ENABLE_DOCKER_CONTENT_TRUST=0
if [ -n "${DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE:-}" ] && [ -n "${DOCKER_CONTENT_TRUST_REPOSITORY_KEY:-}" ]; then
tmpdir=$(mktemp -d)
(cd "${tmpdir}" && bash -c 'echo -n "${DOCKER_CONTENT_TRUST_REPOSITORY_KEY}" | base64 -d > key')
chmod 400 "${tmpdir}/key"
docker trust key load "${tmpdir}/key"
rm -rf "${tmpdir}"
export ENABLE_DOCKER_CONTENT_TRUST=1
fi

push() {
local dist="$1"
DOCKER_CONTENT_TRUST=${ENABLE_DOCKER_CONTENT_TRUST} docker push "${BASENAME}:${dist}"
local image="${BASENAME}:${dist}"
docker push "${image}"

if [ -n "${COSIGN_PRIVATE_KEY:-}" ] && [ -n "${COSIGN_PASSWORD:-}" ]; then
cosign sign --yes --key env://COSIGN_PRIVATE_KEY "${image}"
fi
}

for DIST in $DISTS; do
Expand Down
8 changes: 8 additions & 0 deletions pushmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ push_manifest() {
done
run_docker manifest create "$image" "${arch_images[@]}"
run_docker manifest push "$image"

if [ -n "${COSIGN_PRIVATE_KEY:-}" ] && [ -n "${COSIGN_PASSWORD:-}" ]; then
if [[ -n "${DRY_RUN:-}" ]]; then
echo "DRY RUN cosign sign --yes --key env://COSIGN_PRIVATE_KEY ${image}"
else
cosign sign --yes --key env://COSIGN_PRIVATE_KEY "${image}"
fi
fi
}

tags=()
Expand Down
19 changes: 7 additions & 12 deletions pushone
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,15 @@ if [ -n "${DOCKER_PASSWORD:-}" ]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin "${DOCKER_REGISTRY}"
fi

ENABLE_DOCKER_CONTENT_TRUST=0
if [ -n "${DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE:-}" ] && [ -n "${DOCKER_CONTENT_TRUST_REPOSITORY_KEY:-}" ]; then
tmpdir=$(mktemp -d)
(cd "${tmpdir}" && bash -c 'echo -n "${DOCKER_CONTENT_TRUST_REPOSITORY_KEY}" | base64 -d > key')
chmod 400 "${tmpdir}/key"
docker trust key load "${tmpdir}/key"
rm -rf "${tmpdir}"
export ENABLE_DOCKER_CONTENT_TRUST=1
fi

push() {
local dist="$1"
docker tag "${BASENAME}:${dist}" "${DOCKER_REGISTRY}/${BASENAME}:${dist}"
DOCKER_CONTENT_TRUST=${ENABLE_DOCKER_CONTENT_TRUST} docker push "${DOCKER_REGISTRY}/${BASENAME}:${dist}"
local image="${DOCKER_REGISTRY}/${BASENAME}:${dist}"
docker tag "${BASENAME}:${dist}" "${image}"
docker push "${image}"

if [ -n "${COSIGN_PRIVATE_KEY:-}" ] && [ -n "${COSIGN_PASSWORD:-}" ]; then
cosign sign --yes --key env://COSIGN_PRIVATE_KEY "${image}"
fi
}

push "$DIST-${PLATFORM}"
Loading