Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Only use semver version tags. Don't specify distro!
FROM node:16.2.0-stretch

RUN curl --silent -o /usr/local/bin/node-prune https://s3.amazonaws.com/ssi-us-east-1-pkg/node-prune/node-prune-0.1 && \
chmod +x /usr/local/bin/node-prune && \
rm -rf /tmp/* && \
groupadd ssi -r && \
useradd -r -g ssi ssi

CMD ["echo", "Hello World from node"]
15 changes: 15 additions & 0 deletions buildkite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
steps:
- commands:
- "echo 'Hello World'"
- "docker build . -t test-image"
- "docker run test-image"
plugins:
- docker#v3.8.0:
image: "676020893150.dkr.ecr.us-east-1.amazonaws.com/docker"
always-pull: true
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
label: "test"
- wait
- command: ./generate-pipelines.sh

15 changes: 15 additions & 0 deletions generate-pipelines.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail

envs_file='envs.yml'
workspaces_file='workspaces.json'

rm -rf "$envs_file"
jsonnet pipelines.jsonnet | yq eval -P - > "$envs_file"

envs=$(jq -r '.workspaces[]' "$workspaces_file")

for e in ${envs[@]}; do
yq eval ".$e" "$envs_file" | buildkite-agent pipeline upload
done

32 changes: 32 additions & 0 deletions pipelines.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
local workspaces = (import 'workspaces.json').workspaces;

local plan_job(script, ws) = {
command: script + ws,
key: 'plan-' + ws,
label: 'plan-' + ws,
};

local apply_job(script, ws) = {
command: [script + ws],
depends_on: ['plan-' + ws],
};

local pipeline(ws) = {
[ws]: {
steps: [
plan_job('echo terraform plan-', ws),
// { block: 'apply-' + ws },
apply_job('echo terraform apply-', ws),
],
},
};

local generate_pipelines(pipelines) =
local append(arr, i, res) =
if i >= std.length(arr) then
res
else
append(arr, i + 1, res + arr[i]) tailstrict;
append(pipelines, 0, {});

{} + generate_pipelines([pipeline(ws) for ws in workspaces])
3 changes: 3 additions & 0 deletions workspaces.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"workspaces": ["prod", "dev", "stg"]
}