Last active
March 1, 2019 19:58
-
-
Save iocanel/500b5dfc4ab2b65306f52f765fff74d3 to your computer and use it in GitHub Desktop.
Simple pipeline
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
#!/usr/bin/groovy | |
@Library('github.com/fabric8io/fabric8-pipeline-library@master') | |
def buildLabel = "mylabel.${env.JOB_NAME}.${env.BUILD_NUMBER}".replace('-', '_').replace('/', '_') | |
podTemplate(label: buildLabel, | |
containers: [containerTemplate(image: 'maven', name: 'maven', command: 'cat', ttyEnabled: true, | |
envVars: [containerEnvVar(key: 'DOCKER_CONFIG', value: '/home/jenkins/.docker/')], | |
workingDir: '/home/jenkins/') | |
], | |
volumes: [ | |
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock'), | |
secretVolume(mountPath: '/root/.m2', secretName: 'jenkins-maven-settings'), | |
secretVolume(mountPath: '/home/jenkins/.docker', secretName: 'jenkins-docker-cfg') | |
], | |
serviceAccount: 'jenkins') { | |
node(buildLabel) { | |
container(name: 'maven') { | |
sh 'pwd' | |
sh 'whoami' | |
sh 'echo hello world' | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment