forked from alphagov/government-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
82 lines (66 loc) · 1.82 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
#!/usr/bin/env groovy
REPOSITORY = 'government-frontend'
node {
def govuk = load '/var/lib/jenkins/groovy_scripts/govuk_jenkinslib.groovy'
properties([
buildDiscarder(
logRotator(
numToKeepStr: '50')
),
[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false],
[$class: 'ThrottleJobProperty',
categories: [],
limitOneJobWithMatchingParams: true,
maxConcurrentPerNode: 1,
maxConcurrentTotal: 0,
paramsToUseForLimit: 'government-frontend',
throttleEnabled: true,
throttleOption: 'category'],
])
try {
stage("Checkout") {
checkout scm
}
stage("Clean up workspace") {
govuk.cleanupGit()
}
stage("git merge") {
govuk.mergeMasterBranch()
}
stage("Configure Rails environment") {
govuk.setEnvar("RAILS_ENV", "test")
}
stage("Set up content schema dependency") {
govuk.contentSchemaDependency()
govuk.setEnvar("GOVUK_CONTENT_SCHEMAS_PATH", "tmp/govuk-content-schemas")
}
stage("bundle install") {
govuk.bundleApp()
}
stage("rubylinter") {
govuk.rubyLinter()
}
stage("sasslinter") {
govuk.sassLinter()
}
stage("Precompile assets") {
govuk.precompileAssets()
}
stage("Run tests") {
govuk.runRakeTask("default")
}
if (env.BRANCH_NAME == 'master') {
stage("Push release tag") {
govuk.pushTag(REPOSITORY, env.BRANCH_NAME, 'release_' + env.BUILD_NUMBER)
}
}
govuk.deployIntegration(REPOSITORY, env.BRANCH_NAME, 'release', 'deploy')
} catch (e) {
currentBuild.result = "FAILED"
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: '[email protected]',
sendToIndividuals: true])
throw e
}
}