Skip to content

Commit

Permalink
Pull released images through pull through cache (#2262)
Browse files Browse the repository at this point in the history
* Pull from private repo to populate for pull through cache
  • Loading branch information
spring1843 authored Aug 8, 2022
1 parent 0bb1612 commit b9306e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions hack/add-snapshot-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ tagRelease() {

authenticate
tagAllRepositories
pullPrivateReplica $RELEASE_TYPE $NEW_TAG
notifyRelease $RELEASE_TYPE $NEW_TAG
14 changes: 14 additions & 0 deletions hack/release_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -euo pipefail

CURRENT_MAJOR_VERSION="0"
PRIVATE_PULL_THROUGH_HOST="071440425669.dkr.ecr.us-east-1.amazonaws.com"
HELM_CHART_VERSION="v${CURRENT_MAJOR_VERSION}-${SNAPSHOT_TAG}"
RELEASE_VERSION=${RELEASE_VERSION:-"${SNAPSHOT_TAG}"}
RELEASE_PLATFORM="--platform=linux/amd64,linux/arm64"
Expand All @@ -27,6 +28,10 @@ authenticate() {
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${RELEASE_REPO}
}

authenticatePrivateRepo() {
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${PRIVATE_PULL_THROUGH_HOST}
}

buildImages() {
HELM_CHART_VERSION=$1
CONTROLLER_DIGEST=$(GOFLAGS=${GOFLAGS} KO_DOCKER_REPO=${RELEASE_REPO} ko publish -B -t ${RELEASE_VERSION} ${RELEASE_PLATFORM} ./cmd/controller)
Expand All @@ -51,3 +56,12 @@ notifyRelease(){
--message ${MESSAGE} \
--no-cli-pager
}

pullPrivateReplica(){
authenticatePrivateRepo
RELEASE_TYPE=$1
RELEASE_IDENTIFIER=$2
PULL_THROUGH_CACHE_PATH="${PRIVATE_PULL_THROUGH_HOST}/ecr-public/karpenter/"
docker pull "${PULL_THROUGH_CACHE_PATH}controller:${RELEASE_IDENTIFIER}"
docker pull "${PULL_THROUGH_CACHE_PATH}webhook:${RELEASE_IDENTIFIER}"
}
3 changes: 2 additions & 1 deletion hack/snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ authenticate
buildImages $HELM_CHART_VERSION
cosignImages
publishHelmChart
notifyRelease "snapshot" $HELM_CHART_VERSION
notifyIfStableRelease
pullPrivateReplica "snapshot" $SNAPSHOT_TAG
notifyRelease "snapshot" $HELM_CHART_VERSION

0 comments on commit b9306e7

Please sign in to comment.