-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Jenkinsfile_previews
79 lines (73 loc) · 1.98 KB
/
Jenkinsfile_previews
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
pipeline {
options {
timeout(time: 60, unit: 'MINUTES')
ansiColor('xterm')
disableConcurrentBuilds(abortPrevious: true)
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '5', numToKeepStr: '5')
}
agent {
label 'linux-arm64-docker || arm64linux'
}
environment {
INFRASTATISTICS_LOCATION = 'src/data/infra-statistics'
}
stages {
stage('Install dependencies') {
when {
allOf{
changeRequest target: 'main'
// Only deploy from infra.ci.jenkins.io
expression { infra.isInfra() }
}
}
steps {
sh '''
asdf install
npm install
'''
}
}
stage('Retrieve data from infra-statistics') {
steps {
sh './retrieve-infra-statistics-data.sh'
}
}
stage('Build') {
when {
allOf{
changeRequest target: 'main'
// Only deploy from infra.ci.jenkins.io
expression { infra.isInfra() }
}
}
steps {
sh '''
npm run build
'''
}
}
stage('Deploy PR to preview site') {
when {
allOf{
changeRequest target: 'main'
// Only deploy from infra.ci.jenkins.io
expression { infra.isInfra() }
}
}
environment {
NETLIFY_AUTH_TOKEN = credentials('netlify-auth-token')
}
steps {
sh 'netlify-deploy --draft=true --siteName "stats-jenkins-io" --title "Preview deploy for ${CHANGE_ID}" --alias "deploy-preview-${CHANGE_ID}" -d ./dist'
}
post {
success {
recordDeployment('jenkins-infra', 'stats.jenkins.io', pullRequest.head, 'success', "https://deploy-preview-${CHANGE_ID}--stats-jenkins-io.netlify.app")
}
failure {
recordDeployment('jenkins-infra', 'stats.jenkins.io', pullRequest.head, 'failure', "https://deploy-preview-${CHANGE_ID}--stats-jenkins-io.netlify.app")
}
}
}
}
}