This repository has been archived by the owner on Feb 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
99 lines (82 loc) · 2.54 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env groovy
REPOSITORY = 'specialist-frontend'
DEFAULT_SCHEMA_BRANCH = 'deployed-to-production'
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: 'specialist-frontend',
throttleEnabled: true,
throttleOption: 'category'],
[$class: 'ParametersDefinitionProperty',
parameterDefinitions: [
[$class: 'BooleanParameterDefinition',
name: 'IS_SCHEMA_TEST',
defaultValue: false,
description: 'Identifies whether this build is being triggered to test a change to the content schemas'],
[$class: 'StringParameterDefinition',
name: 'SCHEMA_BRANCH',
defaultValue: DEFAULT_SCHEMA_BRANCH,
description: 'The branch of govuk-content-schemas to test against']]
],
])
try {
govuk.initializeParameters([
'IS_SCHEMA_TEST': 'false',
'SCHEMA_BRANCH': DEFAULT_SCHEMA_BRANCH,
])
if (!govuk.isAllowedBranchBuild(env.BRANCH_NAME)) {
return
}
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(env.SCHEMA_BRANCH)
govuk.setEnvar("GOVUK_CONTENT_SCHEMAS_PATH", "tmp/govuk-content-schemas")
}
stage("bundle install") {
govuk.bundleApp()
}
stage("rubylinter") {
govuk.rubyLinter("app test lib")
}
stage("Precompile assets") {
govuk.precompileAssets()
}
stage("Run tests") {
govuk.runRakeTask("ci:setup:rspec default")
}
stage("Push release tag") {
govuk.pushTag(REPOSITORY, env.BRANCH_NAME, "release_${env.BUILD_NUMBER}")
}
stage("Deploy to integration") {
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
}
}