Last active
March 21, 2019 17:22
-
-
Save InfoSec812/bd15f57792109c62bcebe3a724a4f322 to your computer and use it in GitHub Desktop.
Scaffolding A podTemplate For Jenkins
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
| pipeline { | |
| options { | |
| buildDiscarder(logRotator(numToKeepStr: '50')) | |
| timeout(time: 20, unit: 'MINUTES') // If the build takes longer than 20 minutes, fail automatically | |
| } | |
| agent { | |
| kubernetes { | |
| label "zaproxy-maven-sidecars-${env.BUILD_ID}" | |
| defaultContainer 'jenkins-slave-mvn' | |
| yaml """ | |
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| labels: | |
| pod-template: jenkins-slave-sidecars | |
| spec: | |
| """ | |
| } | |
| } | |
| } |
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
| pipeline { | |
| options { | |
| buildDiscarder(logRotator(numToKeepStr: '50')) | |
| timeout(time: 20, unit: 'MINUTES') // If the build takes longer than 20 minutes, fail automatically | |
| } | |
| agent { | |
| kubernetes { | |
| label "zaproxy-maven-sidecars-${env.BUILD_ID}" | |
| defaultContainer 'jenkins-slave-mvn' | |
| yaml """ ## Kubernetest/OpenShift YAML to define the Pod | |
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| labels: | |
| pod-template: jenkins-slave-sidecars | |
| spec: | |
| containers: | |
| - name: jenkins-slave-mvn | |
| tty: true | |
| command: | |
| - cat | |
| - name: jenkins-slave-zap | |
| tty: true | |
| command: | |
| - cat | |
| """ | |
| } | |
| } | |
| } |
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
| pipeline { | |
| options { | |
| buildDiscarder(logRotator(numToKeepStr: '50')) | |
| timeout(time: 20, unit: 'MINUTES') // If the build takes longer than 20 minutes, fail automatically | |
| } | |
| agent { | |
| kubernetes { | |
| label "zaproxy-maven-sidecars-${env.BUILD_ID}" | |
| defaultContainer 'jenkins-slave-mvn' | |
| yaml """ ## Kubernetest/OpenShift YAML to define the Pod | |
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| labels: | |
| pod-template: jenkins-slave-sidecars | |
| spec: | |
| containers: | |
| - name: jenkins-slave-mvn | |
| tty: true | |
| command: | |
| - cat | |
| env: | |
| - name: SOME_ENV_VAR | |
| value: 'SomeValue' | |
| - name: jenkins-slave-zap | |
| tty: true | |
| command: | |
| - cat | |
| env: | |
| - name: SOME_ENV_VAR | |
| value: 'SomeValue' | |
| """ | |
| } | |
| } | |
| } |
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
| pipeline { | |
| options { | |
| buildDiscarder(logRotator(numToKeepStr: '50')) | |
| timeout(time: 20, unit: 'MINUTES') // If the build takes longer than 20 minutes, fail automatically | |
| } | |
| agent { | |
| kubernetes { | |
| label "zaproxy-maven-sidecars-${env.BUILD_ID}" | |
| defaultContainer 'jenkins-slave-mvn' | |
| yaml """ ## Kubernetest/OpenShift YAML to define the Pod | |
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| labels: | |
| pod-template: jenkins-slave-sidecars | |
| spec: | |
| volumes: ## Expose some volumes to be used in the containers | |
| - name: reports-storage | |
| emptyDir: {} | |
| - name: git-repo | |
| emptyDir: {} | |
| containers: | |
| - name: jenkins-slave-mvn | |
| tty: true | |
| command: | |
| - cat | |
| env: | |
| - name: SOME_ENV_VAR | |
| value: 'SomeValue' | |
| volumeMounts: | |
| - name: reports-storage | |
| mountPath: /tmp/reports | |
| - name: git-repo | |
| mountPath: /project/myproject | |
| - name: jenkins-slave-zap | |
| tty: true | |
| command: | |
| - cat | |
| env: | |
| - name: SOME_ENV_VAR | |
| value: 'SomeValue' | |
| volumeMounts: | |
| - name: reports-storage | |
| mountPath: /tmp/reports | |
| - name: git-repo | |
| mountPath: /project/myproject | |
| """ | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment