mirror of
https://github.com/google/nomulus.git
synced 2025-06-11 15:04:46 +02:00
Sign an attestation for the proxy build
This signs an attestation that the proxy image was built by cloud build, allowing the image to be used on a bin-auth restricted kubernetes cluster. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=242917524
This commit is contained in:
parent
565c4bcf50
commit
b95987230e
1 changed files with 20 additions and 3 deletions
|
@ -6,7 +6,6 @@
|
|||
# cloud-build-local --config=cloudbuild-proxy.yaml --dryrun=false --substitutions TAG_NAME=[TAG] .
|
||||
# This will create a docker image named gcr.io/[PROJECT_ID]/proxy:[TAG] locally.
|
||||
# The PROJECT_ID is the current project name that gcloud uses.
|
||||
# You can add "--push true" to have the image pushed to GCR.
|
||||
#
|
||||
# To manually trigger a build on GCB, run:
|
||||
# gcloud builds submit --config cloudbuild-proxy.yaml --substitutions TAG_NAME=[TAG] .
|
||||
|
@ -53,8 +52,26 @@ steps:
|
|||
# Replace project name.
|
||||
- name: 'alpine'
|
||||
args: ['sh', '-c', 'sed -i s/GCP_PROJECT/${PROJECT_ID}/ proxy-*.yaml']
|
||||
# Images to upload to GCR.
|
||||
images: ['gcr.io/${PROJECT_ID}/proxy:${TAG_NAME}']
|
||||
# Push the image. We can't let Cloud Build's default processing do that for us
|
||||
# because we need to push the image before we can sign it in the following
|
||||
# step.
|
||||
- name: 'gcr.io/cloud-builders/docker'
|
||||
args: ['push', 'gcr.io/${PROJECT_ID}/proxy:${TAG_NAME}']
|
||||
# Get the image hash and sign it.
|
||||
- name: 'gcr.io/domain-registry-dev/builder'
|
||||
entrypoint: /bin/bash
|
||||
args:
|
||||
- -c
|
||||
- >
|
||||
hash=$(gcloud container images list-tags \
|
||||
gcr.io/${PROJECT_ID}/proxy \
|
||||
--format="get(digest)" --filter="tags = ${TAG_NAME}") && \
|
||||
gcloud --project=${PROJECT_ID} alpha container binauthz attestations \
|
||||
sign-and-create --artifact-url=gcr.io/${PROJECT_ID}/proxy@$hash \
|
||||
--attestor=build-attestor --attestor-project=${PROJECT_ID} \
|
||||
--keyversion-project=${PROJECT_ID} --keyversion-location=global \
|
||||
--keyversion-keyring=attestor-keys --keyversion-key=signing \
|
||||
--keyversion=1
|
||||
# Config files to upload to GCS.
|
||||
artifacts:
|
||||
objects:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue