Skip to content

Commit

Permalink
Merge pull request #50 from google/feature/ssm
Browse files Browse the repository at this point in the history
secure source manager cloud build added
  • Loading branch information
byronwhitlock-google authored Feb 23, 2024
2 parents 715824b + af40aad commit b74a279
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/guardrails/cloudbuild/secure-source-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Build Repository from Secure Source Manager

Secure Source Manager is code repository
This file has all the information to pull a repo from secure source manager from cloud build.

## Prerequisites

* Enable the Cloud Build and secret manager API
* Give the cloud build service account the following roles:
a. roles/secretmanager.secretAccessor
b. roles/securesourcemanager.instanceAccessor
c. roles/securesourcemanager.repoAdmin

* If you have to create a new repo:
https://cloud.google.com/secure-source-manager/docs/create-repository

* If the repo is already created, the add an IAM role binding:
`gcloud alpha source-manager instances add-iam-policy-binding <ssm_instance_name> --region='<ssm_instance_region>' --project='cloud-professional-services' --member='<cloudbuild serviceaccount>' --role='roles/securesourcemanager.instanceAccessor'`


## Update variable substitutions in webhook trigger

Following substitutions variables needs to be configured in cloud build trigger settings to complete cloud build trigger setup.

variables:
```
_REPO_URL: This variable provides information about secure source manager instance url.
_REPO_NAME : This variable provides information about secure source manager repo name.
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
steps:
- name: gcr.io/cloud-builders/git
env:
- _INSTANCE_URL=$_INSTANCE_URL
- _REPO_NAME=$_REPO_NAME
script: >
#!/bin/sh
git config --global credential.'https://*.*.sourcemanager.dev'.helper
gcloud.sh
git config --global credential.'$_INSTANCE_URL'.helper gcloud.sh
git clone $_INSTANCE_URL/cloud-professional-services/$_REPO_NAME.git
/workspace/
cd /workspace
ls -ltrh

0 comments on commit b74a279

Please sign in to comment.