90DaysOfDevOps/Days/CICD/Jenkins/Pipeline/Jenkinsfile

53 lines
1.1 KiB
Plaintext
Raw Normal View History

2022-03-16 05:41:33 +07:00
podTemplate(yaml: '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: maven
image: maven:3.8.1-jdk-8
command:
- sleep
args:
- 99d
- name: kaniko
image: gcr.io/kaniko-project/executor:debug
command:
- sleep
args:
- 9999999
volumeMounts:
- name: kaniko-secret
mountPath: /kaniko/.docker
restartPolicy: Never
volumes:
- name: kaniko-secret
secret:
secretName: dockercred
items:
- key: .dockerconfigjson
path: config.json
''') {
node(POD_LABEL) {
stage('Clone Repository') {
git url: 'https://github.com/MichaelCade/Jenkins-HelloWorld.git', branch: 'main'
container('maven') {
stage('Build Image') {
sh '''
echo "Tests passed"
'''
}
}
}
stage('Test Image') {
container('kaniko') {
stage('Build Hello World App') {
sh '''
/kaniko/executor --context `pwd` --destination michaelcade1/helloworld:1.0
'''
}
}
}
}
}