forked from trailheadapps/lwc-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile-v02
158 lines (131 loc) · 5.31 KB
/
Jenkinsfile-v02
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
pipeline {
// Pipeline is designed to easily use Docker images as the execution environment for a single Stage or the entire Pipeline.
agent {
// ERROR when : echo "*** Starting agent"
// Must be one of [any, docker, dockerfile, kubernetes, label, none]
// https://www.jenkins.io/doc/book/pipeline/docker/
// TODO: this might not be the best path experience to always dynamicall create the BIG image for every commit !!!
// better ssh into salesforce-dx container
docker {
image 'chendamok/salesforce-dx:latest'
args '-v /mnt/v/docker-persist-datas/users/home/salesforce:/home/salesforce'
args '-v /mnt/v/data01:/data01'
args "-v /home/mokch/code/dotfiles:/workspace" // to interprt $ sign // TODO: how to use environment variable define above ?
//args '-v ../../envs:/workspace/config'
//args '-p 3000:3000 -p 5000:5000'
}
}
environment {
def workspace = '/home/mokch/code/dotfiles'
}
//agent any
// agent {
// dockerfile {
// filename "/home/code/dotfiles/dockers/salesforce/Dockerfile"
// //‘Jenkins’ doesn’t have label ‘my-internal-salesforce-dx’
// //label "my-internal-salesforce-dx"
// label "salesforce-dx"
// }
// }
stages {
// https://www.theguild.nl/jenkinsfiles-for-beginners-and-masochists/
// NOT WORKING
// stage("Demo - Calling Dockerfile") {
// agent {
// dockerfile {
// filename "/workspace/dockers/salesforce/Dockerfile"
// label "'my-agent-salesforce-dx'"
// }
// }
// steps {
// sh 'sfdx --version'
// }
// }
stage('Environment variables & sanity checks') {
steps {
// The container is not DEFINED as we need to share deamon between dind and host
script {
//Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
//docker.withServer('tcp://localhost:2375') {
// Error response from daemon: pull access denied for salesforce-dx, repository does not exist
// or may require 'docker login': denied: requested access to the resource is denied
//docker.image('salesforce-dx').inside {
// The DinD will execute theses command below
echo "Home Directory=${workspace}"
sh 'sfdx force'
sh 'sfdx --version'
input message: 'Finished using the web site? (Click "Proceed" to continue)'
//}
//}
}
}
}
stage('Build') {
steps {
//sh 'npm install'
echo "*** Build Step"
}
}
stage('Test') {
steps {
//sh './jenkins/scripts/test.sh'
echo "*** Test Step"
}
}
stage('Deploy for master') {
when {
branch 'master'
}
steps {
//sh './jenkins/scripts/deploy-for-production.sh'
echo "*** Master branch"
//input message: 'Finished using the web site? (Click "Proceed" to continue)'
//sh './jenkins/scripts/kill.sh'
}
}
stage('Deliver for development') {
when {
branch 'development'
}
steps {
//sh './jenkins/scripts/deliver-for-development.sh'
echo "*** Development branch"
//input message: 'Finished using the web site? (Click "Proceed" to continue)'
//sh './jenkins/scripts/kill.sh'
}
}
stage('Deliver for integration') {
when {
branch 'integration'
}
steps {
//sh './jenkins/scripts/deliver-for-development.sh'
echo "*** Integration branch"
//input message: 'Finished using the web site? (Click "Proceed" to continue)'
//sh './jenkins/scripts/kill.sh'
}
}
stage('Deliver for Acceptance') {
when {
branch 'acceptance'
}
steps {
//sh './jenkins/scripts/deliver-for-development.sh'
echo "*** Integration branch"
//input message: 'Finished using the web site? (Click "Proceed" to continue)'
//sh './jenkins/scripts/kill.sh'
}
}
stage('Deploy for production') {
when {
branch 'production'
}
steps {
//sh './jenkins/scripts/deploy-for-production.sh'
echo "*** Production branch"
//input message: 'Finished using the web site? (Click "Proceed" to continue)'
//sh './jenkins/scripts/kill.sh'
}
}
}
}