forked from jenkins-infra/jenkins.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile_k8s
67 lines (59 loc) · 1.62 KB
/
Jenkinsfile_k8s
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
pipeline {
agent {
label 'linux-arm64-docker'
}
environment {
TZ = "UTC"
USE_LOCAL_NODE = "true"
USE_LOCAL_RUBY = "true"
}
triggers {
cron("${env.BRANCH_NAME == 'master' ? 'H/30 * * * *' : ''}")
}
options {
timeout(time: 60, unit: 'MINUTES')
ansiColor('xterm')
disableConcurrentBuilds(abortPrevious: true)
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '5', numToKeepStr: '5')
}
stages {
stage('NPM Install') {
steps {
sh 'npm install'
}
}
stage('Bundle Install') {
steps {
// throw errors if Gemfile has been modified since Gemfile.lock
sh '''
bundle config --global frozen 1
bundle install
'''
}
}
stage('Build') {
steps {
sh 'make'
}
}
stage('Deploy to preview site') {
when {
changeRequest target: 'master'
}
environment {
NETLIFY_AUTH_TOKEN = credentials('netlify-auth-token')
}
post {
success {
recordDeployment('jenkins-infra', 'jenkins.io', pullRequest.head, 'success', "https://deploy-preview-${CHANGE_ID}--jenkins-io-site-pr.netlify.app")
}
failure {
recordDeployment('jenkins-infra', 'jenkins.io', pullRequest.head, 'failure', "https://deploy-preview-${CHANGE_ID}--jenkins-io-site-pr.netlify.app")
}
}
steps {
sh('/usr/local/bin/netlify-deploy --siteName "jenkins-io-site-pr" --title "Preview deploy for ${CHANGE_ID}" --alias "deploy-preview-${CHANGE_ID}" -d ./build/_site')
}
}
}
}