forked from alphagov/smart-answers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
81 lines (68 loc) · 2.13 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
#!/usr/bin/env groovy
REPOSITORY = 'smart-answers'
DEFAULT_SCHEMA_BRANCH = 'deployed-to-production'
node {
def govuk = load '/var/lib/jenkins/groovy_scripts/govuk_jenkinslib.groovy'
properties([
[$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
govuk.cleanupGit()
govuk.mergeMasterBranch()
govuk.contentSchemaDependency()
govuk.setEnvar("GOVUK_CONTENT_SCHEMAS_PATH", "tmp/govuk-content-schemas")
govuk.setEnvar("DISPLAY", ":99")
}
stage('Bundle') {
govuk.bundleApp()
}
stage('Linter') {
govuk.rubyLinter()
}
stage("Assets") {
govuk.precompileAssets()
}
stage('Tests') {
govuk.runTests()
}
if (env.BRANCH_NAME == 'master') {
stage('Regression tests') {
govuk.setEnvar("RUN_REGRESSION_TESTS", "true")
sh("bundle exec ruby test/regression/smart_answers_regression_test.rb")
}
stage('Push release tag') {
govuk.pushTag(REPOSITORY, BRANCH_NAME, 'release_' + BUILD_NUMBER)
}
stage('Deploy to Integration') {
// Deploy on Integration (only master)
govuk.deployIntegration('smartanswers', BRANCH_NAME, 'release', 'deploy')
}
}
} catch (e) {
currentBuild.result = 'FAILED'
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: '[email protected]',
sendToIndividuals: true])
throw e
}
}