-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: dual-write chartcuterie image to artifact registry
gcr is deprecated, OPS-3966
- Loading branch information
1 parent
46d2e74
commit 25c376a
Showing
3 changed files
with
36 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,7 @@ | |
* | ||
|
||
!/package.json | ||
!/webpack.config.ts | ||
!/tsconfig.json | ||
!/yarn.lock | ||
!/lib | ||
!/src | ||
!/fonts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,35 @@ | ||
steps: | ||
# Build the app | ||
- name: 'node:20' | ||
args: ['bash', '-c', 'yarn && yarn build'] | ||
# Build and push runtime image | ||
- name: 'gcr.io/kaniko-project/executor:v1.19.2' | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: | ||
[ | ||
'--cache=true', | ||
'--use-new-run', | ||
'build', | ||
'-t', | ||
'us.gcr.io/$PROJECT_ID/chartcuterie:latest', | ||
'-t', | ||
'us.gcr.io/$PROJECT_ID/chartcuterie:$COMMIT_SHA', | ||
'-t', | ||
'us-central1-docker.pkg.dev/$PROJECT_ID/getsentry/chartcuterie/image:latest', | ||
'-t', | ||
'us-central1-docker.pkg.dev/$PROJECT_ID/getsentry/chartcuterie/image:$COMMIT_SHA', | ||
'--build-arg', | ||
'SOURCE_COMMIT=$COMMIT_SHA', | ||
'--destination=us.gcr.io/$PROJECT_ID/chartcuterie:$COMMIT_SHA', | ||
'BUILDKIT_INLINE_CACHE=1', | ||
'--cache-from', | ||
'us-central1-docker.pkg.dev/$PROJECT_ID/getsentry/chartcuterie/image:latest', | ||
'.', | ||
] | ||
timeout: 900s | ||
|
||
# Smoke test | ||
- name: 'us.gcr.io/$PROJECT_ID/chartcuterie:$COMMIT_SHA' | ||
args: | ||
- node | ||
- '/usr/src/app/lib/index.js' | ||
- '--help' | ||
timeout: 60s | ||
env: [DOCKER_BUILDKIT=1] | ||
|
||
- name: 'gcr.io/cloud-builders/docker' | ||
secretEnv: ['DOCKER_PASSWORD'] | ||
entrypoint: 'bash' | ||
args: | ||
- '-e' | ||
- '-c' | ||
- | | ||
# Only push to Docker Hub from master | ||
[ "$BRANCH_NAME" != "master" ] && exit 0 | ||
docker tag us.gcr.io/$PROJECT_ID/chartcuterie:$COMMIT_SHA us.gcr.io/$PROJECT_ID/chartcuterie:latest | ||
docker push us.gcr.io/$PROJECT_ID/chartcuterie:latest | ||
echo "$$DOCKER_PASSWORD" | docker login --username=sentrybuilder --password-stdin | ||
docker tag us.gcr.io/$PROJECT_ID/chartcuterie:$COMMIT_SHA getsentry/chartcuterie:$SHORT_SHA | ||
docker push getsentry/chartcuterie:$SHORT_SHA | ||
docker tag us.gcr.io/$PROJECT_ID/chartcuterie:$COMMIT_SHA getsentry/chartcuterie:$COMMIT_SHA | ||
docker push getsentry/chartcuterie:$COMMIT_SHA | ||
docker tag us.gcr.io/$PROJECT_ID/chartcuterie:$COMMIT_SHA getsentry/chartcuterie:latest | ||
docker push getsentry/chartcuterie:latest | ||
- '-c' | ||
- | | ||
# Only push "latest" tag when building on "master" | ||
[ "$BRANCH_NAME" != "master" ] && exit 0 | ||
docker push us.gcr.io/$PROJECT_ID/chartcuterie:latest | ||
docker push us-central1-docker.pkg.dev/$PROJECT_ID/getsentry/chartcuterie/image:latest | ||
images: [ | ||
'us.gcr.io/$PROJECT_ID/chartcuterie:$COMMIT_SHA', | ||
'us-central1-docker.pkg.dev/$PROJECT_ID/getsentry/chartcuterie/image:$COMMIT_SHA', | ||
] | ||
|
||
secrets: | ||
- kmsKeyName: projects/sentryio/locations/global/keyRings/service-credentials/cryptoKeys/cloudbuild | ||
secretEnv: | ||
# This is a personal access token for the sentrybuilder account, encrypted using the | ||
# short guide at http://bit.ly/2Pg6uw9 | ||
DOCKER_PASSWORD: | | ||
CiQAE8gN7y3OMxn+a1kofmK4Bi8jQZtdRFj2lYYwaZHVeIIBUzMSTQA9tvn8XCv2vqj6u8CHoeSP | ||
TVW9pLvSCorKoeNtOp0eb+6V1yNJW/+JC07DNO1KLbTbodbuza6jKJHU5xeAJ4kGQI78UY5Vu1Gp | ||
QcMK |