mirror of
https://github.com/MichaelCade/90DaysOfDevOps.git
synced 2025-01-31 01:45:03 +07:00
53 lines
1.1 KiB
Plaintext
53 lines
1.1 KiB
Plaintext
|
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
|
||
|
'''
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|