Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spinnaker Pipeline as code

I really like the idea what armory has done for pipeline as code for spinnaker. I want to implement something of similar sort. Can someone explain how they might be doing this ?

https://docs.armory.io/user-guides/dinghy/

{
  "application": "yourspinnakerapplicationname",
  "pipelines": [
    {
      "application": "yourspinnakerapplicationname",
      "keepWaitingPipelines": false,
      "limitConcurrent": true,
      "name": "Made By Armory Pipeline Templates",
      "stages": [
        {{ module "wait.stage.module" }} // Module created in dinghy-templates repo
      ],
      "triggers": []
    }
  ]
}

Have they created custom jinja extensions for module ? If someone could breakdown on how they are able to achieve this as a starting point for me, that would be really helpful

like image 427
madcolonel10 Avatar asked Aug 09 '18 14:08

madcolonel10


People also ask

What is a spinnaker pipeline?

A pipeline is a sequence of stages provided by Spinnaker, ranging from functions that manipulate infrastructure (deploy, resize, disable) as well as utility scaffolding functions (manual judgment, wait, run Jenkins job) that together precisely define your runbook for managing your deployments.

How does a spinnaker pipeline work?

By pushing a Git tag that starts with “v”, we trigger Container Builder to build a new Docker image and push it to Container Registry. Spinnaker detects that the new image tag begins with “v” and triggers a pipeline to deploy the image to canaries, run tests, and roll out the same image to all pods in the deployment.


1 Answers

We were previously using MPT (Managed Pipeline Templates) with the official Spinnaker tool roer. We had multi level partial inheritance and breaking a single template would irreversibly break all templates.

There is a new approach using JSONNET called sponnet available here. This has the advantages that come with jsonnet. The JSON pipelines it creates can be loaded via UI, roer or via the new official Spinnaker tool spin.

There is currently a design document under way for V2 of managed pipeline templates.

It's early days for spin and the Spinnaker jsonnet library but we can use something like below to define our Spinnaker pipeline within an app.jsonnet file.

local deployment = import 'deployment.json';
local kubeutils = import 'kubeutils.libsonnet';
local sponnet = import 'pipeline.libsonnet';

local canaryDeployment = kubeutils.canary(deployment);
local account = 'staging-demo';
local app = 'myapp';

<snip>

local wait = sponnet.stages
             .wait('Wait')
             .withSkipWaitText('Custom wait message')
             .withWaitTime(30);

<snip>

sponnet.pipeline()
.withApplication(app)
.withExpectedArtifacts([expectedDocker, expectedManifest])
.withName('Demo pipeline')
.withNotifications(slack)
.withTriggers([dockerTrigger, gitTrigger])
.withStages([wait, deployManifestTextBaseline, deployManifestTextCanary, 
deployManifestArtifact, findArtifactsFromResource, jenkinsJob])
like image 136
Karl Avatar answered Sep 21 '22 13:09

Karl