-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
119 lines (109 loc) · 2.26 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
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
library 'magic-butler-catalogue'
def DEFAULT_BRANCH = 'main'
def CURRENT_BRANCH = currentBranch()
def WORKSPACE_PATH = "/tmp/workspace/${env.BUILD_TAG.replace('%2F', '/')}"
def CREDS = [
string(
credentialsId: 'github-api-token',
variable: 'GITHUB_TOKEN'
),
]
def NPMRC = [
configFile(fileId: 'npmrc', variable: 'NPM_CONFIG_USERCONFIG')
]
pipeline {
agent {
node {
label 'rust-x86_64'
customWorkspace(WORKSPACE_PATH)
}
}
options {
timeout time: 1, unit: 'HOURS'
timestamps()
ansiColor 'xterm'
withCredentials(CREDS)
}
environment {
NPM_CONFIG_CACHE = '.npm'
SPAWN_WRAP_SHIM_ROOT = '.npm'
RUSTUP_HOME = '/opt/rust/rustup'
CARGO_HOME = '/opt/rust/cargo'
PATH = """${sh(
returnStdout: true,
script: 'echo /opt/rust/cargo/bin:\$PATH'
)}
// """
}
post {
always {
jiraSendBuildInfo()
}
}
stages {
stage('Validate PR Source') {
when {
expression { env.CHANGE_FORK }
not {
triggeredBy 'issueCommentCause'
}
}
steps {
error("A maintainer needs to approve this PR for CI by commenting")
}
}
stage('Commitlint and dry release'){
when {
not {
branch DEFAULT_BRANCH
}
}
tools {
nodejs 'NodeJS 20'
}
environment {
GIT_BRANCH = "${CURRENT_BRANCH}"
// This is not populated on PR builds and is needed for the release dry runs
BRANCH_NAME = "${CURRENT_BRANCH}"
CHANGE_ID = ""
}
steps {
script {
configFileProvider(NPMRC) {
sh 'npm install --ignore-scripts'
sh 'npm run commitlint'
sh 'npm run release:dry'
}
}
}
}
stage('Clippy') {
steps {
sh 'cargo install cargo-audit'
sh 'make lint'
}
}
stage('Unit Tests') {
steps {
sh 'make clean'
sh 'make test'
}
}
stage('Release') {
when {
branch DEFAULT_BRANCH
}
tools {
nodejs 'NodeJS 20'
}
steps {
script {
configFileProvider(NPMRC) {
sh 'npm install'
sh 'npm run release'
}
}
}
}
}
}