Trigger Spinnaker pipelines from GitHub Actions

Trigger Spinnaker pipelines via GitHub Actions

With the growing populatity of GitHub Actions, most of the enterprises especially the ones whose git repositories are already hosted on GitHub, are moving away from conventional CI tools such as Jenkins, TeamCity or Travis to GitHub Actions.

GitHub Actions help us create advanced pipelines without losing the focus on simplicity.

Spinnaker although can trigger a pipeline based on a webhook, visualizing a Spinnaker pipeline as part of the GitHub pipeline is essential at times. In this blog, let’s have a look at how we can use GitHub action and trigger the Spinnaker pipeline.

Limitation: It works with Spinnaker that has basic authentication set up such as LDAP. It doesn’t work when OAuth2 or SAML or any other authentication is enabled in Spinnaker.

Spinnaker Configuration:

Create a webhook type trigger under Spinnaker configuration as shown in the below image.

<spinnaker_gate_url>/webhooks/webhook/action is the url that should be used to invoke the webhook. This is the url that will be used later in the github action via secrets.

GitHub Action:

In your github repository create a file under specified path(.github/workflows/spinnaker.yaml) and copy the below content.

# This action is meant for triggering Spinnaker pipeline from github
name: Trigger Spinnaker Pipeline
# Controls when the action will run. Workflow runs when manually triggered using the UI or API.
# Trigger the workflow on push,
# but only for the master branch
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
- name: Trigger Spinnaker Pipeline
uses: distributhor/workflow-webhook@v2
webhook_url: ${{ secrets.SPIN_GATE_URL }}/webhooks/webhook/action
webhook_secret: ${{ secrets.WEBHOOK_SECRET }}
data: '{ "repository": "${{github.event.repository.full_name}}", "commit_url": "${{github.event.repository.commits_url}}" }'

Above action requires a few inputs that need to be passed via secrets in that particular repository.

  1. SPIN_GATE_URL — — -> URL of Spinnaker gate
  2. WEBHOOK_SECRET — — -> The secret with which to generate the signature hash. Required argument for workflow-webhook@v2 action. Have got no significance at Spinnaker end.

Process to create secrets that can be used in a github repository:

  1. Navigate to settings column under the specific repository

2. Click on Secrets section

3. Click on New repository secret to create secrets that can be used across actions using {{ secrets.<SECRET> }}




DevOps Engineer |

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Task - AWS Infrastructure automation with Terraform

Software Architecture and the Art of Separation of Concerns

Understanding Containerized Blockchain behaviour on AWS Fargate

Little Gems of Knowledge: Part I

Lazy guys guide to web services: part 1 — Implement a web server on Amazon Elastic Beanstalk and…

Lessons learnt : #1 Spark Native functions and pushdown optimizations

Squirrel Weekly (29/12) 🐿️

Hidden Feature of Python Data Structure Part 1 !!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhinay Byrisetty

Abhinay Byrisetty

DevOps Engineer |

More from Medium

OAuth2.0 and OpenID

What does Cloud Native mean? Let’s discuss Containers, Orchestration, and Microservices

Automated Outage Alert Monitoring and Remediation

Executive Summary — OAuth 2.1