Last active
April 4, 2021 04:55
-
-
Save omegaes/e4f7fdfe081051f831cd57e29962c76a to your computer and use it in GitHub Desktop.
Create cloud build triggers and secrets
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
#!/bin/bash | |
# optain personal access token from Github to use for https clone | |
#https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token | |
printf "https://GIT_USERNAME:GITHUB_PERSONAL_TOKEN@github.com/GIT_ORGANAIZATION/ENVIRONMENT_REPO_NAME.git" | gcloud secrets create ENV_REPO_AUTH_URL --data-file=- | |
# For more details about cloud build and it's configration, | |
# please refer to https://cloud.google.com/build/docs/concepts | |
# if you use Github or BitBucket, you need to connect GCP project with your account | |
gcloud beta builds triggers create github \ | |
--name="Demo-App-CI-CD-Master" \ | |
--repo-name=GKE-Demo-App \ | |
--repo-owner=XXXXX \ | |
--branch-pattern=master \ | |
--build-config=cloudbuild.yaml \ | |
--substitutions _ENV_REPO_FILES="production/kustomization.yml",_ENV_REPO_MERGE_BRANCH="production/demo-app",_ENV_REPO_TARGET_BRANCH="master" | |
gcloud beta builds triggers create github \ | |
--name="Demo-Env-CI-CD-Master" \ | |
--repo-name=GKE-Demo-Environment \ | |
--repo-owner=XXXXX \ | |
--branch-pattern=master \ | |
--build-config=cloudbuild.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment