-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
56 lines (42 loc) · 1.53 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
#!groovy
@Library('jenkins-pipeline-shared@master') _
def slack_channel = 'pruthvi-test'
def BUILD_NUMBER
def COMMIT
pipeline {
agent { label 'nightvision-deploy' }
options {
buildDiscarder(logRotator(numToKeepStr: '25'))
timestamps()
}
stages {
stage ('Checkout') {
steps {
script {
def repo = checkout([$class: 'GitSCM',
branches: [[ name: 'main' ]],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: scm.userRemoteConfigs
])
commit = repo.GIT_COMMIT.take(7)
branch = repo.GIT_BRANCH.split('/')[1]
sendNotifications 'STARTED', "Job: '${env.JOB_NAME}', Branch-Commit: '${branch}-${commit}', BuildNumber: '${env.BUILD_NUMBER}'", slack_channel
}
}
}
}
post {
success {
script {
sshagent(['DIGITAL_GH']) {
sh("git config user.name 'NightvisionJenkins'")
sh("git config user.email 'digital_release@mysunpower.com'")
sh("git tag deploy-to-qa ${GIT_COMMIT} ")
sh("git push origin deploy-to-qa")
}
}
}
}
}