Skip to content
This repository was archived by the owner on Jul 10, 2021. It is now read-only.
Open
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
58 changes: 28 additions & 30 deletions guides/user/pipeline/triggers-with-artifactsrewrite/gcs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ sidebar:

This guide explains how to configure Spinnaker to trigger pipelines based on
changes in a [Google Cloud Storage](https://cloud.google.com/storage/) (GCS)
bucket, and inject changed GCS objects as [artifacts](/reference/artifacts)
bucket and inject changed GCS objects as [artifacts](/reference/artifacts)
into a pipeline.

This functionality uses Google's
[Pub/Sub](https://cloud.google.com/pubsub/docs/overview) system for delivering
messages to Spinnaker, and must be configured to send messages to
messages to Spinnaker and must be configured to send messages to
Spinnaker's event bus as shown below.

# Prerequisite configuration/setup
Expand All @@ -35,22 +35,21 @@ You need the following:
auth login` if you have installed `gcloud` for the first time.

* [A running Spinnaker instance](/setup/install/). This guide shows you how
to configure an existing one to accept GCS messages, and download the files
to configure an existing one to accept GCS messages and download the files
referenced by the messages in your pipelines.

* Artifact support [enabled](/reference/artifacts-with-artifactsrewrite//#enabling-artifact-support).

At this point, we will configure Pub/Sub, and a GCS artifact account. The
At this point, you'll configure Pub/Sub and a GCS artifact account. The
Pub/Sub messages will be received by Spinnaker whenever a file is uploaded or
changed, and the artifact account will allow you to download these where
changed. The artifact account will allow you to download these where
necessary.

## 1. Configure Google Pub/Sub for GCS

Follow the [Pub/Sub configuration](/setup/triggers/google/), in particular, pay
attention to the [GCS
section](/setup/triggers/google/#receiving-messages-from-google-cloud-storage-gcs)
since this is where we'll be publishing our files to.
Follow the [Pub/Sub configuration](/setup/triggers/google/).
> __Note:__ Pay attention to the [GCS section](/setup/triggers/google/#receiving-messages-from-google-cloud-storage-gcs).
This is where we'll be publishing our files to.

## 2. Configure a GCS artifact account

Expand All @@ -68,7 +67,7 @@ to apply them in Spinnaker.

# Using GCS artifacts in pipelines

We will need either an existing or a new pipeline that we want to be triggered
You'll need either an existing or a new pipeline that you want to be triggered
on changes to GCS artifacts. If you do not have a pipeline, create one as shown
below.

Expand All @@ -82,24 +81,22 @@ below.

## Configure the GCS trigger

Let's add a Pub/Sub trigger to run our pipeline.
Let's add a Pub/Sub trigger to run the pipeline.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Let's add a Pub/Sub trigger to run the pipeline.
1. Add a Pub/Sub trigger to run the pipeline.


{%
include
figure
image_path="./add-trigger.png"
%}

Next, we must configure the trigger:
Next, you must configure the trigger:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Next, you must configure the trigger:
1. Configure the trigger:


* __Type__ is "Pub/Sub".
* __Pub/Sub System Type__ is "Google".
* __Subscription Name__ depends on what you've configured in your Pub/Sub
configuration using Halyard.
* __Attribute Constraints__ must be configured to include the pair `eventType`:
`OBJECT_FINALIZE` (see the
[docs](https://cloud.google.com/storage/docs/pubsub-notifications#events) for
an explanation).
| Field | Value |
|-------|-------|
| __Type__ | Pub/Sub |
| __Pub/Sub System Type__ | Google |
| __Subscription Name__ | Depends on what you've configured in your Pub/Sub configuration using Halyard |
| __Attribute Constraints__ | Must be configured to include the pair `eventType`:`OBJECT_FINALIZE` (see the [docs](https://cloud.google.com/storage/docs/pubsub-notifications#events) for an explanation) |

{%
include
Expand All @@ -110,14 +107,14 @@ Next, we must configure the trigger:

## Configure the GCS artifact

Now we need to declare that the Pub/Sub trigger expects that a specific artifact
Now you'll need to declare that the Pub/Sub trigger expects a specific artifact
matching some criteria is available before the pipeline starts executing. In
doing so, you guarantee that an artifact matching your description is present in
the pipeline's execution context; if no artifact for this description is present,
doing so, you'll guarantee that an artifact matching your description is present in
the pipeline's execution context. If no artifact for this description is present,
the pipeline won't start.

To configure the artifact, go to the __Artifact Constraints__ dropdown for the
Pub/Sub trigger configuration, and select __"Define a new artifact..."__ to bring
Pub/Sub trigger configuration, and select __"Define a new artifact"__ to bring
up the __Expected Artifact__ form.

{%
Expand All @@ -126,18 +123,19 @@ up the __Expected Artifact__ form.
image_path="./expected-artifact.png"
%}

Enter a __Display Name__, or leave the autogenerated default. In the __Account__
Enter a __Display Name__ or leave the autogenerated default. In the __Account__
dropdown, select your GCS account. Enter the fully qualified GCS path in the
__Object path__ field. Note: this path can be a regular expression. You can, for
example, set
the object path to be `gs://${BUCKET}/folder/.*` to trigger on any change to an
object inside `folder` in your `${BUCKET}`.
__Object path__ field.

> __Note:__ This path can be a regular expression. You can, for
> example, set the object path to be `gs://${BUCKET}/folder/.*` to trigger on any change to an
> object inside `folder` in your `${BUCKET}`.

{%
include
figure
image_path="./expected-artifact.png"
caption="`${BUCKET}` is a placeholder for the GCS bucket name that you have
caption="`${BUCKET}` is a placeholder for the GCS bucket name that you
configured to receive Pub/Sub messages from above."
%}

Expand Down