Skip to content

Instantly share code, notes, and snippets.

@burdzwastaken
Created January 30, 2018 19:55
Show Gist options
  • Save burdzwastaken/a202b12e334b892aa9d41c88746a7fac to your computer and use it in GitHub Desktop.
Save burdzwastaken/a202b12e334b892aa9d41c88746a7fac to your computer and use it in GitHub Desktop.
bakeAndTag.yaml
---
schema: "1"
pipeline:
application: samplespinnakerpipeline
name: Bake samplespinnakerpipeline
template:
source: spinnaker://bakeAndTagRoot
variables:
jenkinsJob: "DevOps/job/mulesoft-ops/job/sample-spinnaker-app/job/master"
extendedAttributes:
- key: salt_role
value: sample-spinnaker-app
stages: []
---
---
schema: "1"
id: bakeAndTagRoot
metadata:
name: Bake And Tag Pipeline
description: |-
Defines a pipeline that bakes and tags an AMI. This template cannot be used directly.
owner: devops@mulesoft.com
scopes: [global]
protect: false
configuration:
concurrentExecutions:
parallel: true
limitConcurrent: true
triggers:
- enabled: true
job: "{{ jenkinsJob }}"
master: jenkins
name: jenkins
runAsUser: "{{ runAsUser }}"
propertyFile: "{{ propertyFile }}"
type: jenkins
parameters: []
notifications: []
variables:
- name: propertyFile
description: property file to use from jenkins
defaultValue: {}
- name: package
description: package to install
defaultValue: ${trigger['buildInfo']['artifacts'][0]['displayPath'].replace('.x86_64.rpm','')}
- name: amiName
description: the name given to the AMI
defaultValue: "{{ application }}"
- name: artifact
description: artifact tag for the AMI
defaultValue: ${trigger['buildInfo']['artifacts'][0]['displayPath']}
- name: jenkinsJob
description: The jenkins job to trigger the bake
- name: regions
description: A list of AWS regions to deploy into.
type: list
defaultValue:
- us-east-1
- name: templateFileName
description: The packer template to use
defaultValue: aws-ebs-buildpack.json
- name: extendedAttributes
description: extendedAttributes to apply to the bake
- name: runAsUser
description: which service account to run runAsUser
defaultValue: spinnaker-dev
stages:
- id: bake
type: bake
dependsOn: []
name: Bake Image
config:
amiName: "{{ amiName }}"
baseLabel: release
baseOs: amazon-linux
cloudProviderType: aws
extendedAttributes: |
{% for attribute in extendedAttributes %}
{{ attribute.key }}: {{ attribute.value }}
{% endfor %}
{% endif %}
package: "{{ package }}"
rebake: false
regions: |
{% for region in regions %}
- {{ region }}
{% endfor %}
storeType: ebs
templateFileName: "{{ templateFileName }}"
varFileName: mesh-${region}.json
vmType: hvm
- id: tagImages
type: upsertImageTags
dependsOn:
- bake
name: Tag Image
config:
cloudProvider: aws
cloudProviderType: aws
tags:
name: "{{ application }}"
artifact: "{{ artifact }}"
---
[master] burdz@~/work/code/repos/spinnaker-templates: SPINNAKER_API=https://spinnaker ./roer --certPath ./server.pem --keyPath ./key.pem pipeline-template publish rootTemplates/bakeAndTagTemplate.yaml
INFO[0000] Publishing template
INFO[0001] Waiting for task to complete... refURL="/tasks/338209a3-ddca-49d7-865f-8f20448373dc"
INFO[0003] Task completed status=SUCCEEDED
[master] burdz@~/work/code/repos/spinnaker-templates: SPINNAKER_API=https://spinnaker ./roer --certPath ./server.pem --keyPath ./key.pem pipeline-template plan examples/bakeAndTagExample.yaml
{
"application": "samplespinnakerpipeline",
"id": "unknown",
"keepWaitingPipelines": false,
"limitConcurrent": true,
"name": "Bake samplespinnakerpipeline",
"notifications": [],
"parameterConfig": [],
"stages": [
{
"amiName": "samplespinnakerpipeline",
"baseLabel": "release",
"baseOs": "amazon-linux",
"cloudProviderType": "aws",
"extendedAttributes": {
"salt_role": "sample-spinnaker-app"
},
"id": "61154450-8b44-4b34-9f3d-f0f96354a24a",
"name": "Bake Image",
"package": "${trigger['buildInfo']['artifacts'][0]['displayPath'].replace('.x86_64.rpm','')}",
"rebake": false,
"refId": "bake",
"regions": [
"us-east-1"
],
"requisiteStageRefIds": [],
"storeType": "ebs",
"templateFileName": "aws-ebs-buildpack.json",
"type": "bake",
"varFileName": "mesh-${region}.json",
"vmType": "hvm"
},
{
"cloudProvider": "aws",
"cloudProviderType": "aws",
"id": "518ccd18-351a-42a9-9e90-1deda44ee1c8",
"name": "Tag Image",
"refId": "tagImages",
"requisiteStageRefIds": [
"bake"
],
"tags": {
"artifact": "${trigger['buildInfo']['artifacts'][0]['displayPath']}",
"name": "samplespinnakerpipeline"
},
"type": "upsertImageTags"
}
],
"trigger": {
"parameters": {},
"type": "manual",
"user": "spinnaker-api"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment