Skip to content

Instantly share code, notes, and snippets.

View Anthonyhawkins's full-sized avatar

Anthony Hawkins Anthonyhawkins

View GitHub Profile
#
# Blog as a Service Pipeline
# - Author: Anthony Hawkins
# - Purpose: Automate the testing and deployment of my personal blog
#
#
# Name of the pipeline used to lookup pipeline configuration in pillar
#
{% set pipeline_name = pillar['pipeline_name'] %}
@Anthonyhawkins
Anthonyhawkins / gist:8aac75e1d01268e6ff35664275ff7694
Created November 29, 2016 01:09
cd-with-salt-sample-pillar
pipelines:
blog:
#
# Where the Image will be built and tested
#
build_env:
minion: "build-box.c.slashfeed-145600.internal"
build_dir: "/tmp/build_space"
#
# Git Provider and Repo name - this is cloned
#@ if data.values.environment in ['site-a', 'site-b', 'site-c']:
enable_x: true
#@ end
{% if environment in ['site-a', 'site-b', 'site-c'] %}
enable_x: true
{%- endif %}
#@ load("@ytt:struct", "struct")
#@ tiles = struct.decode(data.values.tiles)
#@ for tile in tiles:
- name: #@ "product-" + tile
type: pivnet
source:
api_token: pivnet_token
product_slug: image-slug
product_version: #@ tiles[tile]['ver']
#@ end
{% for tile, config in tiles.items() %}
- name: {{ "product-" + tile }}
type: pivnet
source:
api_token: pivnet_token
product_slug: image-slug
product_version: {{ config['ver'] }}
{% endfor %}
{% macro do_bar() -%}
foo: bar
{% if environment == "site-a"%}
enable_x: true
{%- endif %}
{%- endmacro %}
...
- task: do_foo
config:
{{ do_foo() | indent(6)}}
import json
import _jsonnet
jsonnet_str = '''
{
person1: {
name: "Alice",
welcome: "Hello " + self.name + "!",
},
person2: self.person1 {
resources:
- name: config-repo
type: git
source:
uri: ((git_repo_uri))
branch: ((git_repo_branch))
# only watch for changes in config directory
paths: ["ci", "((config_dir))"]
- name: cf-mgmt
- name: update-org-users # Unique per job
plan:
- get: config-repo
passed: [create-orgs] # Different per each job
trigger: true
- get: cf-mgmt
- get: time-trigger # used for a few jobs, but not every job.
trigger: true
- task: update-org-users # unique per job
config: