You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/2-attack-of-the-pipelines/3a-jenkins.md
+14-4
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
### Jenkins Pipeline
2
2
3
-
> Jenkins is a tool that's been around for sometime but it's stuck with a lot of customers. It's a build server that's pretty dumb by nature but can be enhanced with lots of plugins and agents which is why it's such a powerful tool.
3
+
> Jenkins is a tool that's been around for sometime but it's stuck with a lot of customers. It's a build server that's pretty dumb by nature but can be enhanced with lots of plugins and agents which is why it's such a powerful tool.
4
4
5
5
<!---
6
6
#### Jenkins access to GitLab
@@ -50,7 +50,7 @@ git push
50
50
echo "https://$(oc get route jenkins --template='{{ .spec.host }}' -n ${TEAM_NAME}-ci-cd)/multibranch-webhook-trigger/invoke?token=pet-battle"
51
51
```
52
52
53
-
Once you have the URL, over on GitLab go to `pet-battle > Settings > Integrations` to add the webhook
53
+
Once you have the URL, over on GitLab go to `pet-battle > Settings > Integrations` to add the webhook
6. Now that we've gone through what this stuff does, let's try fix the failing build. If you look at the output of the Jenkins job, you'll see it's not able to find anything in Nexus to put in a container. To fix this, update the `Jenkinsfile` by adding a new `stage` which will run app compilation, producing the artifact in Nexus for us. Add the following below to the `// 💥🔨 PIPELINE EXERCISE GOES HERE ` comment:
143
143
144
144
```groovy
145
-
// 💥🔨 PIPELINE EXERCISE GOES HERE
145
+
// 💥🔨 PIPELINE EXERCISE GOES HERE
146
146
stage("🧰 Build (Compile App)") {
147
147
agent { label "jenkins-agent-npm" }
148
+
options {
149
+
skipDefaultCheckout(true)
150
+
}
148
151
steps {
152
+
sh '''
153
+
git clone ${GIT_URL} pet-battle && cd pet-battle
154
+
git checkout ${BRANCH_NAME}
155
+
'''
156
+
dir('pet-battle'){
157
+
149
158
script {
150
159
env.VERSION = sh(returnStdout: true, script: "npm run version --silent").trim()
0 commit comments