This functionality uses GitHub Webhooks for delivering messages to Spinnaker, and must be configured to send messages to Spinnaker’s event bus as shown below.
If you (or your Spinnaker admin) have already configured Spinnaker to listen to a GitHub webhooks from the repository you plan to publish commits to, you can skip this section.
You need the following:
A GitHub repository either under your user, or in an organization or user’s account that you have permission to publish commits to.
This will be referred to as
$ORGANIZATION/$REPOSITORYfrom now on (e.g.
A running Spinnaker instance. This guide shows you how to update it to accept messages from GitHub.
At this point, we will configure GitHub webhooks, and a GitHub artifact account. The intent is that the webhook will be received by Spinnaker whenever a commit is made, and the artifact account will allow you to download any pertinent files.
1. Configure GitHub Webhooks
Follow the GitHub webhook configuration.
2. Configure a GitHub Artifact Account
Follow the GitHub artifact configuration.
3. Apply Your Configuration Changes
Once the artifact changes have been made using Halyard, run
hal deploy apply
to apply them in Spinnaker.
Using GitHub Artifacts in Pipelines
We will need either an existing or a new pipeline that we want to be triggered on changes to GCS artifacts. If you do not have a pipeline, create one as shown below.
Configure the GitHub artifact
Once you have your pipeline ready, we need to declare that this pipeline expects to have a specific artifact matching some criteria 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, the pipeline won’t start.
Now to configure the artifact, change the “Custom” dropdown to “GitHub”, and
enter the File path field. Note: this path can be a regex. You can, for
example, set the object path to be
folder/.*\.yml to trigger on any change to
a YAML file inside
folder in your repository.
Configure the GitHub Trigger
Now that the expected artifact has been added, let’s add a Git trigger to run our pipeline. To configure the trigger:
|Organization or User||
|Branch||(optional) Can be used (via regex) to describe which branches to listen to changes one|
|Secret||(optional) Strongly encouraged It must match the secret provided to the webhook configuration|
|Expected Artifacts||Must reference the artifact defined previously|
Test the pipeline
If you add or modify a file matching your expected artifact to the configured repository, it should execute. If it doesn’t, you can start by checking the logs of the Echo service.