This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Jenkinsfile
69 lines (55 loc) · 1.59 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
#!/usr/bin/env groovy
REPOSITORY = 'govuk-puppet'
library("govuk")
node {
properties([
buildDiscarder(logRotator(numToKeepStr: '50')),
])
try {
stage("Checkout") {
govuk.checkoutFromGitHubWithSSH(REPOSITORY, [shallow: true])
}
stage("Merge main") {
// this will only succeed on a merge if the PR is less than 50 commits
// ahead of main.
govuk.mergeIntoBranch("main", [fetchBranch: true, mergeDepth: 50])
}
stage("Bundle install") {
govuk.bundleApp()
}
if (env.BRANCH_NAME != "main") {
govuk.runRakeTask('shell:shellcheck[origin/main,HEAD]')
}
stage("puppet-librarian install") {
govuk.runRakeTask('librarian:install')
}
stage("Spec tests") {
lock("govuk-puppet-$NODE_NAME-test") {
govuk.runRakeTask('all_but_lint')
}
}
stage("Lint check") {
govuk.runRakeTask('lint')
}
// Deploy on Integration (only main)
if (env.BRANCH_NAME == "main") {
stage("Push release tag") {
echo 'Pushing tag'
govuk.pushTag(REPOSITORY, env.BRANCH_NAME, 'release_' + env.BUILD_NUMBER, 'main')
}
stage("Deploy on Integration") {
build job: 'Deploy_Puppet_Downstream',
parameters: [string(name: 'TAG', value: 'release_' + env.BUILD_NUMBER)]
}
}
} catch (e) {
currentBuild.result = "FAILED"
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: '[email protected]',
sendToIndividuals: true])
throw e
}
// Wipe the workspace
deleteDir()
}