Spinnaker Running a Script with Run Job (Manifest): Difference between revisions
Line 51: | Line 51: | ||
=Generating and Using Execution Results= | =Generating and Using Execution Results= | ||
Revision as of 04:55, 30 April 2022
External
- https://kb.armory.io/s/article/Run-a-Generic-Shell-Script-with-Spinnaker
- https://spinnaker.io/docs/guides/user/kubernetes-v2/run-job-manifest/
- https://blog.spinnaker.io/extending-spinnaker-with-kubernetes-and-containers-5d16ec810d81
Internal
Overview
The execution phase is implemented as a Run Job (Manifest) stage.
⚠️ Make sure you use Run Job (Manifest) and NOT Deploy (Manifest)!
Run Job (Manifest) only accepts Job manifests, so a ConfigMap to specify the script cannot be used. The functionality must be already present in the container image and can be controlled via command
and arguments. The stage will deploy the job manifest and wait until it completes, thus gating the pipeline’s continuation on the job’s success or failure. The stage may optionally collect the Job output and inject it back into the pipeline. The Job will be automatically deleted upon completion.
Run Job (Manifest) Definition
Add a "Run Job (Manifest)" stage and name it "Script Job" or similar.
The Account is the target Kubernetes cluster.
In Manifest Configuration. set Manifest Source: Text, and use the following manifest. Replace 'REPLACE-WITH-TARGET-NAMESPACE-NAME' with the target namespace for the Job.
apiVersion: batch/v1
kind: Job
metadata:
name: script-job
namespace: REPLACE-WITH-TARGET-NAMESPACE-NAME
spec:
backoffLimit: 2
template:
spec:
containers:
- command:
- python
- --version
image: 'bitnami/kubectl:1.12'
name: script
restartPolicy: Never
Viewing Execution Logs
The job execution log is captured and can be accessed in the pipeline Execution Details → Run Job Config → Logs → Console Output.
If the Spinnaker instance is configured as such, logs can be forwarded to dedicated infrastructure.
Also see: