-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
109 lines (108 loc) · 4.22 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
pipeline {
agent any
stages {
stage("Serverless") {
stages {
stage("Build") {
steps {
echo "Building..."
dir("one-click-deploy-fns") {
echo pwd()
nodejs("Node-14.20.1") {
sh "twilio plugins:install @twilio-labs/plugin-serverless"
// sh "npm install"
}
}
}
}
stage("Test") {
steps {
echo "Testing..."
dir("one-click-deploy-fns") {
echo pwd()
}
}
}
stage("Deploy") {
steps {
echo "Deploying..."
dir("one-click-deploy-fns") {
echo pwd()
nodejs("Node-14.20.1") {
sh "twilio serverless:deploy --username=${TWILIO_ACCOUNT_SID} --password=${TWILIO_AUTH_TOKEN} --override-existing-project --production"
// sh "npm run deploy"
}
}
}
}
}
}
stage("Setup") {
steps {
echo "Configuring Envronment Post Serverless Deployment"
script {
def matcher = manager.getLogMatcher(".*domain.*")
def domain
if(matcher.matches()) {
env.ONE_CLICK_DEPLOY_BASE_URL = matcher.group(0).replaceAll("\\s+", " ").split(" ")[1]
}
}
dir("one-click-deploy-fns") {
script {
if(fileExists(".twiliodeployinfo")) {
def twilioDeployInfo = readJSON(file:".twiliodeployinfo");
env.ONE_CLICK_DEPLOY_FNS_SERVICE_SID = twilioDeployInfo[TWILIO_ACCOUNT_SID].serviceSid
}
}
}
}
}
stage("Flex") {
stages {
stage("Build") {
steps {
echo "Building..."
dir("plugin-oneclickdeploy") {
echo pwd()
nodejs("Node-14.20.1") {
sh "twilio plugins:install @twilio-labs/plugin-flex"
sh "npm install"
sh "twilio flex:plugins:build"
}
}
}
}
stage("Test") {
steps {
echo "Testing..."
dir("plugin-oneclickdeploy") {
echo pwd()
}
}
}
stage("Deploy") {
steps {
echo "Deploying..."
dir("plugin-oneclickdeploy") {
echo pwd()
nodejs("Node-14.20.1") {
sh "twilio flex:plugins:deploy --major --changelog 'One-Click-Deploy' --description 'Sample OOTB Twilio Flex Plugin'"
script {
if(fileExists("package.json")) {
packageJSON = readJSON(file:"package.json");
}
}
sh "twilio flex:plugins:release --plugin ${packageJSON.name}@${packageJSON.version} --name 'plugin-oneclickdeploy' --description 'Demonstrating use of Jenkins one-click-deploy'"
}
}
}
}
stage("Post Deploy") {
steps {
echo "Post Deployment"
}
}
}
}
}
}