forked from AppPress/node-connect-datadog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
57 lines (47 loc) · 1.65 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
library 'jenkins-shared-library'
pipeline {
options{
ansiColor('xterm')
disableConcurrentBuilds()
}
agent {
node {
label "swarm2"
}
}
environment {
GITHUB_TOKEN = credentials("github-credentials-token")
GITHUB_CREDS = credentials("github-credentials")
GIT_USERNAME = "${env.GITHUB_CREDS_USR}"
GIT_PASSWORD = "${env.GITHUB_CREDS_PSW}"
}
parameters {
choice(name: 'NEW_VERSION', choices: ['patch', 'minor', 'major'], description: 'The new version to be published')
}
stages {
stage ("Publish") {
steps {
writeNpmConfig()
sh "docker build . -t connect-datadog-publish && docker run -e GITHUB_TOKEN -e GIT_USERNAME -e GIT_PASSWORD -e NEW_VERSION=${params.NEW_VERSION} connect-datadog-publish"
}
}
}
post {
fixed {
script {
shared.notifyTeams('SUCCESS', 'https://outlook.office.com/webhook/5e7df867-fb74-47ec-ad49-0f69e9067f72@94d278d4-98ce-45e5-98f5-8a7297697dc1/JenkinsCI/f47e4d5b144f42688223d459750b8084/ad74ba70-f060-4706-97c3-22f342f4f121')
}
}
failure {
script {
shared.notifyTeams('FAILED', 'https://outlook.office.com/webhook/5e7df867-fb74-47ec-ad49-0f69e9067f72@94d278d4-98ce-45e5-98f5-8a7297697dc1/JenkinsCI/f47e4d5b144f42688223d459750b8084/ad74ba70-f060-4706-97c3-22f342f4f121')
}
}
}
}
def writeNpmConfig() {
sh """
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" > .npmrc
echo "@mergermarket:registry=https://npm.pkg.github.com" >> .npmrc
"""
}