-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsFile
93 lines (87 loc) · 1.84 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
def FAILED_STAGE
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, Deploy') {
agent {
dockerfile {
filename 'Dockerfile'
dir '.jenkins/pr-check'
label 'docker-daemon'
reuseNode true
}
}
stages {
stage('Add .env file') {
steps {
script {
FAILED_STAGE = 'env file'
}
}
}
stage('install') {
steps {
sh("yarn")
script {
FAILED_STAGE = 'install'
}
}
}
stage('typescript') {
steps {
sh("yarn tsc --noEmit")
script {
FAILED_STAGE = 'typescript'
}
}
}
stage('lint') {
steps {
sh("yarn lint")
script {
FAILED_STAGE = 'lint'
}
}
}
stage('test') {
steps {
sh("yarn test")
script {
FAILED_STAGE = 'test'
}
}
}
stage('build') {
steps {
sh("yarn build")
script {
FAILED_STAGE = 'build'
}
}
}
}
}
}
}