Skip to content

Cleaner separate build steps #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
28 changes: 13 additions & 15 deletions qa/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# _CLOUDSDK_COMPUTE_ZONE
# _CLOUDSDK_CONTAINER_CLUSTER
# _GITHUB_USERNAME
# _KMS_KEY
# _KMS_KEY
# _KMS_KEYRING
#

Expand All @@ -16,20 +16,18 @@ steps:
- 'gcr.io/${PROJECT_ID}/pipeline:${TAG_NAME}'
- '.'

# Retrieve and decrypt the GitHub Hub configuration.
# Retrieve and decrypt the GitHub Hub configuration.
- name: 'gcr.io/cloud-builders/gcloud'
args: ['cp', 'gs://${PROJECT_ID}-pipeline-configs/hub.enc', 'hub.enc']
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'sh'
args:
- '-c'
- |
gsutil cp gs://${PROJECT_ID}-pipeline-configs/hub.enc hub.enc

gcloud kms decrypt \
--ciphertext-file=hub.enc \
--plaintext-file=/config/hub \
--location=global \
--keyring=${_KMS_KEYRING} \
--key=${_KMS_KEY}
- kms
- decrypt
- --ciphertext-file=hub.enc
- --plaintext-file=/config/hub
- --location=global
- --keyring=${_KMS_KEYRING}
- --key=${_KMS_KEY}
volumes:
- name: 'config'
path: /config
Expand All @@ -47,7 +45,7 @@ steps:
CLUSTER=$$(gcloud config get-value container/cluster)
PROJECT=$$(gcloud config get-value core/project)
ZONE=$$(gcloud config get-value compute/zone)

gcloud container clusters get-credentials "$${CLUSTER}" \
--project "$${PROJECT}" \
--zone "$${ZONE}"
Expand Down Expand Up @@ -93,7 +91,7 @@ steps:
mv pipeline.yaml kubernetes/deployments/pipeline.yaml

hub add kubernetes/deployments/pipeline.yaml

hub commit -F- <<EOF
Update the pipeline-application

Expand Down
30 changes: 14 additions & 16 deletions staging/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# _CLOUDSDK_COMPUTE_ZONE
# _CLOUDSDK_CONTAINER_CLUSTER
# _GITHUB_USERNAME
# _KMS_KEY
# _KMS_KEY
# _KMS_KEYRING
#

Expand All @@ -16,20 +16,18 @@ steps:
- 'gcr.io/${PROJECT_ID}/pipeline:${COMMIT_SHA}'
- '.'

# Retrieve and decrypt the GitHub Hub configuration.
# Retrieve and decrypt the GitHub Hub configuration.
- name: 'gcr.io/cloud-builders/gcloud'
args: ['cp', 'gs://${PROJECT_ID}-pipeline-configs/hub.enc', 'hub.enc']
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'sh'
args:
- '-c'
- |
gsutil cp gs://${PROJECT_ID}-pipeline-configs/hub.enc hub.enc

gcloud kms decrypt \
--ciphertext-file hub.enc \
--plaintext-file /config/hub \
--location global \
--keyring ${_KMS_KEYRING} \
--key ${_KMS_KEY}
- kms
- decrypt
- --ciphertext-file=hub.enc
- --plaintext-file=/config/hub
- --location=global
- --keyring=${_KMS_KEYRING}
- --key=${_KMS_KEY}
volumes:
- name: 'config'
path: /config
Expand All @@ -47,7 +45,7 @@ steps:
CLUSTER=$$(gcloud config get-value container/cluster)
PROJECT=$$(gcloud config get-value core/project)
ZONE=$$(gcloud config get-value compute/zone)

gcloud container clusters get-credentials "$${CLUSTER}" \
--project "$${PROJECT}" \
--zone "$${ZONE}"
Expand All @@ -66,7 +64,7 @@ steps:
- |
ACTIVE_ACCOUNT=$(gcloud auth list --filter=status:ACTIVE --format="value(account)")

hub config --global credential.https://github.com.helper /usr/local/bin/hub-credential-helper
hub config --global credential.https://github.com.helper /usr/local/bin/hub-credential-helper
hub config --global hub.protocol https
hub config --global user.email "$${ACTIVE_ACCOUNT}"
hub config --global user.name "Google Container Builder"
Expand All @@ -92,7 +90,7 @@ steps:
mv pipeline.yaml kubernetes/deployments/pipeline.yaml

hub add kubernetes/deployments/pipeline.yaml

hub commit -F- <<EOF
Update the pipeline-application

Expand Down