-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
82 lines (80 loc) · 2.46 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Uses Declarative syntax to run commands inside a container.
pipeline {
agent {
kubernetes {
// Rather than inline YAML, in a multibranch Pipeline you could use: yamlFile 'jenkins-pod.yaml'
// Or, to avoid YAML:
// containerTemplate {
// name 'shell'
// image 'ubuntu'
// command 'sleep'
// args 'infinity'
// }
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: shell
image: taylorsilva/carvel-apps
env:
- name: KBLD_REGISTRY_HOSTNAME_0
value: "harbor.tools.azure.nvcodes.net"
- name: KBLD_REGISTRY_USERNAME_0
valueFrom:
secretKeyRef:
name: bookinfo-secrets
key: registry-user
- name: KBLD_REGISTRY_PASSWORD_0
valueFrom:
secretKeyRef:
name: bookinfo-secrets
key: registry-password
command:
- sleep
args:
- infinity
'''
// Can also wrap individual steps:
// container('shell') {
// sh 'hostname'
// }
defaultContainer 'shell'
}
}
stages {
//stage('checkout'){
// environment {
// GIT_AUTH = credentials('f09786ed-8c24-4d1a-a768-f0b5266383be')
//}
//steps{
// container('jnlp'){
// sh('''
// git config --global credential.helper "!f() { echo username=\\$GIT_AUTH_USR; echo password=\\$GIT_AUTH_PSW; }; f"
// git config --global user.email "[email protected]"
// git config --global user.name "nitashav-vmw"
//''')
//}
//}
//}
stage('generate-image-reference') {
steps {
sh('''
ls -a
mkdir .imgpkg
kbld -f . --imgpkg-lock-output ./.imgpkg/images.yml
ls .
cat ./.imgpkg/images.yml
''')
}
}
stage('bundle-create-push'){
steps{
sh ('''
echo build number: ${BUILD_NUMBER}
imgpkg push -b harbor.tools.azure.nvcodes.net/isv-release/bookinfo:v${BUILD_NUMBER} -f . --registry-username "${KBLD_REGISTRY_USERNAME_0}" --registry-password "${KBLD_REGISTRY_PASSWORD_0}"
''')
}
}
}
}