logging-sample

command module
v0.0.0-...-3d405b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

Cloud Build Notifier Sample

This sample shows how to create a simple Cloud Build notifier.

Use it with the Creating your own notifer tutorial.

Upload the config to a Google Cloud Storage bucket

First create a bucket.

export BUCKET_NAME=your_bucket_name
gsutil mb gs://${BUCKET_NAME}/

Then upload the provided notifier config to the bucket.

export CONFIG_FILE_NAME=notifier_config.yaml
gsutil cp ${CONFIG_FILE_NAME} gs://${BUCKET_NAME}/${CONFIG_FILE_NAME}

Build and Deploy

Commands should be run from this directory: samples/logging-sample.

gcloud builds submit .  --substitutions=_CONFIG_PATH=gs://${BUCKET_NAME}/${CONFIG_FILE_NAME}

Running this cloudbuild.yaml will create a Cloud Run service. You can see it in the console here.

Set up permissions

Follow the create your own notifer tutorial to set up the permissions. Specifically, PubSub must be able to create tokens and invoke the Cloud Run service.

Try it out!

Test the output by running the success.yaml and failure.yaml. The failure and success should trigger the Cloud Run service and be reflected in the Cloud Run logs. The success.yaml and failure.yaml files are available in the directory one level up from this one.

gcloud builds submit --config ../success.yaml --no-source
gcloud builds submit --config ../failure.yaml --no-source

Documentation

Overview

[START cloudbuild_logging_sample_main] [START cloudbuild_logging_sample_imports]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL