Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#10 from GoogleCloudPlatform/ni…
Browse files Browse the repository at this point in the history
…tyaravi-go-comments-patch

Update cloudbuild.yaml
  • Loading branch information
dinagraves authored May 12, 2021
2 parents 093cc6b + aaad776 commit 8a1c178
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions golang-sample/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# [START cloudbuild_go_yaml]
# [START cloudbuild_go_test_yaml]
steps:
# Run tests and save to file
- name: golang
Expand All @@ -22,29 +23,38 @@ steps:
go get -u github.com/jstemmer/go-junit-report
2>&1 go test -timeout 1m -v ./... | tee sponge.log
/go/bin/go-junit-report -set-exit-code < sponge.log > ${SHORT_SHA}_test_log.xml
# [END cloudbuild_go_test_yaml]

# [START cloudbuild_go_image_yaml]
# Docker Build
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t',
'us-central1-docker.pkg.dev/$PROJECT_ID/$_REPO_NAME/myimage:$SHORT_SHA', '.']

# [END cloudbuild_go_image_yaml]

# [START cloudbuild_go_push_yaml]
# Docker push to Google Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'us-central1-docker.pkg.dev/$PROJECT_ID/$_REPO_NAME/myimage:$SHORT_SHA']

# [END cloudbuild_go_push_yaml]

# [START cloudbuild_go_deploy_yaml]
# Deploy to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args: ['run', 'deploy', 'helloworld',
'--image=us-central1-docker.pkg.dev/$PROJECT_ID/$_REPO_NAME/myimage:$SHORT_SHA',
'--region', 'us-central1', '--platform', 'managed']
# [END cloudbuild_go_deploy_yaml]

# [START cloudbuild_go_logs_yaml]
# Save test logs to Google Cloud Storage
artifacts:
objects:
location: gs://$_BUCKET_NAME/
paths:
- ${SHORT_SHA}_test_log.xml

# [END cloudbuild_go_logs_yaml]
# Store images in Google Artifact Registry
images:
- us-central1-docker.pkg.dev/$PROJECT_ID/$_REPO_NAME/myimage:$SHORT_SHA
# [END cloudbuild_go_yaml]

0 comments on commit 8a1c178

Please sign in to comment.