-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
83 lines (80 loc) · 2.99 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
pipeline {
agent none
options{
disableConcurrentBuilds()
checkoutToSubdirectory('web-console')
skipDefaultCheckout()
ansiColor('xterm')
}
triggers{
pollSCM('* * * * *')
cron(BRANCH_NAME ==~ /master|iso[0-9]+/ ? "H H(2-5) * * *" : "")
}
environment {
GITLAB_TOKEN = credentials('jenkins_on_gitlab')
CLOUDSMITH_TOKEN = credentials('cloudsmith-token')
}
stages {
stage('Determine whether job should run') {
agent any
when {
beforeAgent true
anyOf {
triggeredBy 'UserIdCause'
// skip builds for next and stable branches unless triggered manually
not {
branch pattern: 'iso\\d+-(next|stable)', comparator: 'REGEXP'
}
}
}
stages {
stage('Build & Unit Test') {
steps {
deleteDir()
dir('web-console'){
checkout scm
sh '''
yarn install --immutable;
yarn lint;
yarn format:check;
yarn tsc;
yarn check-circular-deps;
yarn build;
yarn test:ci'''
}
}
}
stage('Testing with cypress') {
steps {
timeout(time: 20, unit: 'MINUTES') {
dir('web-console') {
sh '''yarn run build;
sudo systemctl restart docker && sudo docker network prune -f;
yarn run install:orchestrator:ci;
yarn run cypress-test:iso;'''
}
}
}
post {
always {
dir('web-console') {
sh'yarn run kill-server'
}
}
}
}
}
post {
always {
dir('web-console') {
sh '''npx junit-merge -d cypress/reports/junit -o cypress/reports/cypress-report.xml'''
}
junit 'web-console/junit.xml'
cobertura coberturaReportFile: 'web-console/coverage/cobertura-coverage.xml', failNoReports: false, failUnhealthy: false
archiveArtifacts artifacts: 'web-console/cypress/reports/cypress-report.xml, web-console/cypress/screenshots/**, web-console/cypress/videos/**', allowEmptyArchive: true, onlyIfSuccessful: false
deleteDir()
}
}
}
}
}