-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsFile-release.groovy
123 lines (113 loc) · 2.86 KB
/
JenkinsFile-release.groovy
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@Library('GlobalSharedLibrary') _
def FAILED_STAGE
def trackingKey
def GIT_COMMIT_HASH
def imageTag = "testImageTag"
DOCKER_IMAGE = 'node:18-slim'
pipeline {
agent { label 'docker-daemon' }
options {
buildDiscarder(
// Reduces the size of builds and artifacts kept on Jenkins
logRotator(
artifactDaysToKeepStr: '5',
artifactNumToKeepStr: '5',
daysToKeepStr: '10',
numToKeepStr: '25'
)
)
disableConcurrentBuilds()
timeout(time: 1200, unit: 'SECONDS')
}
environment {
GIT_COMMIT_HASH = """${sh(
returnStdout: true,
script: 'git rev-parse --short HEAD'
).trim()}"""
NPM_CONFIG_CACHE = "${WORKSPACE}/.npm"
HOME = "${WORKSPACE}"
}
stages {
stage('Lint, Build, Test, Release') {
agent {
dockerfile {
filename 'Dockerfile'
dir '.jenkins/pr-check'
label 'docker-daemon'
reuseNode true
}
}
stages {
stage('install') {
steps {
sh("yarn")
script {
FAILED_STAGE = 'install'
}
}
}
stage('typescript') {
steps {
sh("yarn tsc --noEmit")
script {
FAILED_STAGE = 'typescript'
}
}
}
stage('build') {
steps {
sh("yarn build")
script {
FAILED_STAGE = 'build'
}
}
}
stage('fetch version') {
steps {
script {
imageTag = sh(returnStdout: true, script: "npm version "+params.version).trim()
FAILED_STAGE = 'version'
}
}
}
stage('Track change start in Jira') {
steps {
script {
trackingKey = releaseTracking.deployStart(
buildUrl: env.BUILD_URL,
organization: 'Wikia',
repository: 'jwplayer-fandom',
commit: GIT_COMMIT_HASH,
imageTag: "jwplayer-$imageTag",
service: 'jwplayer',
environment: 'Development',
datacenter: ["poz-dev"],
components: ['Fandom Community Platform']
)
echo "Tracking key: ${trackingKey}"
}
}
}
stage('publish') {
steps {
script {
sh("yarn pub")
FAILED_STAGE = 'publish'
}
}
}
stage('Track change completion in Jira') {
steps {
script {
releaseTracking.deployEnd(
environment : 'Development',
trackingKey : trackingKey,
success : true
)
}
}
}
}
}
}
}