Created
August 12, 2019 13:30
-
-
Save ethanfrogers/09a0eb82d7c1efd345e45dbb6c811b0f to your computer and use it in GitHub Desktop.
Run Job with script from source control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"isNew": true, | |
"keepWaitingPipelines": false, | |
"lastModifiedBy": "anonymous", | |
"limitConcurrent": true, | |
"stages": [ | |
{ | |
"comments": "Replace <ORG>, <REPO>, and <PATH TO FILE> with relevant parameters.", | |
"isNew": true, | |
"method": "PUT", | |
"name": "Fetch Script", | |
"payload": { | |
"artifactAccount": "github", | |
"reference": "https://api.github.com/repos/<ORG>/<REPO>/contents/<PATH TO FILE>", | |
"type": "github/file", | |
"version": "master" | |
}, | |
"refId": "1", | |
"requisiteStageRefIds": [], | |
"statusUrlResolution": "getMethod", | |
"type": "webhook", | |
"url": "http://spin-clouddriver:7002/artifacts/fetch" | |
}, | |
{ | |
"account": "kubernetes", | |
"cloudProvider": "kubernetes", | |
"isNew": true, | |
"manifests": [ | |
{ | |
"apiVersion": "v1", | |
"data": { | |
"script.sh": "${stage(\"Fetch Script\")[\"context\"][\"webhook\"][\"body\"]" | |
}, | |
"kind": "ConfigMap", | |
"metadata": { | |
"name": "script-from-github" | |
} | |
} | |
], | |
"moniker": { | |
"app": "k8s2" | |
}, | |
"name": "Deploy Script with ConfigMap", | |
"refId": "2", | |
"requisiteStageRefIds": [ | |
"1" | |
], | |
"skipExpressionEvaluation": false, | |
"source": "text", | |
"trafficManagement": { | |
"enabled": false, | |
"options": { | |
"enableTraffic": false, | |
"namespace": null, | |
"services": [], | |
"strategy": null | |
} | |
}, | |
"type": "deployManifest" | |
}, | |
{ | |
"account": "kubernetes", | |
"alias": "runJob", | |
"application": "k8s2", | |
"cloudProvider": "kubernetes", | |
"credentails": "kubernetes", | |
"isNew": true, | |
"manifest": { | |
"apiVersion": "batch/v1", | |
"kind": "Job", | |
"metadata": { | |
"name": "script-runner" | |
}, | |
"spec": { | |
"backoffLimit": 0, | |
"template": { | |
"spec": { | |
"containers": [ | |
{ | |
"command": [ | |
"sh", | |
"/opt/scripts/script.sh" | |
], | |
"image": "alpine:latest", | |
"name": "runner", | |
"volumeMounts": [ | |
{ | |
"mountPath": "/opt/scripts", | |
"name": "script-from-github" | |
} | |
] | |
} | |
], | |
"volumes": [ | |
{ | |
"configMap": { | |
"name": "script-from-github" | |
}, | |
"name": "script-from-configmap" | |
} | |
] | |
} | |
} | |
} | |
}, | |
"name": "Run Script", | |
"refId": "3", | |
"requisiteStageRefIds": [ | |
"2" | |
], | |
"source": "text", | |
"type": "runJobManifest" | |
} | |
], | |
"triggers": [], | |
"updateTs": "1565616199000" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment