forked from SmartThingsCommunity/SmartThingsEdgeDrivers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
31 lines (29 loc) · 966 Bytes
/
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
def getEnvName(branch) {
print(branch)
if (branch == "origin/main") {return "BETA"}
}
pipeline {
agent {
docker {
image 'smartthings-registry.jfrog.io/iot/edge/edblua-formatter:latest'
label 'production'
args '--entrypoint='
}
}
stages {
stage('update') {
steps {
script {
// ugly hacks to get branch name and correct env variables for that branch
branchName = sh(returnStdout: true, script: 'echo $GIT_BRANCH').trim()
env_name = getEnvName(branchName)
env.ENVIRONMENT_URL = sh(returnStdout: true, script: "echo \$${env_name+'_ENVIRONMENT_URL'}").trim()
env.CHANNEL_ID = sh(returnStdout: true, script: "echo \$${env_name+'_CHANNEL_ID'}").trim()
env.TOKEN = sh(returnStdout: true, script: "echo \$${env_name+'_TOKEN'}").trim()
}
sh 'pip3 install -r ./tools/requirements.txt'
sh 'python3 ./tools/deploy.py'
}
}
}
}