This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile.prod.groovy
64 lines (60 loc) · 1.98 KB
/
Jenkinsfile.prod.groovy
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
// Load Common Variables and utils
common = ""
node{
common = load "../workspace@script/Jenkinsfile.common.groovy"
}
PROD_NAMESPACE="apndkr-prod"
API_DEPLOYMENT="api"
FRONTEND_DEPLOYMENT="frontend"
stage("Approval"){
// timeout(time:3, unit: 'DAYS'){ input id:'ApprovalProd', message:"Deploy to ${environment}?", submitter: 'ronald-garcia-admin', submitterParameter: 'approvingSubmitter'}
timeout(time:7, unit: 'DAYS'){ input "Deploy tagged API and Frontend to ${common.environments.prod.name}?"}
}
// Tag for Prod
stage("Deploy API") {
def environment = common.environments.prod.tag
node{
openshift.withProject('apndkr-prod'){
try{
// Deploy API First
openshiftDeploy(deploymentConfig:API_DEPLOYMENT,waitTime: '900000',namespace:PROD_NAMESPACE)
openshiftVerifyDeployment(deploymentConfig:API_DEPLOYMENT,waitTime: '900000',namespace:PROD_NAMESPACE)
}catch(error){
common.notifyError(
"Couldn't deploy API to ${common.environments.prod.name} 🤕",
"Error: '${error.message}'"
)
throw error
}
}
}
}
stage("Deploy Frontend") {
def environment = common.environments.prod.tag
node{
openshift.withProject(){
try{
// Deploy Frontend
openshiftDeploy(deploymentConfig:FRONTEND_DEPLOYMENT,waitTime: '900000',namespace:PROD_NAMESPACE)
openshiftVerifyDeployment(deploymentConfig:FRONTEND_DEPLOYMENT,waitTime: '900000',namespace:PROD_NAMESPACE)
common.notifyGood(
"${common.APP_NAME} has been deployed to ${common.environments.prod.name} 🚀",
"🎉",
[
[
type: "button",
text: "View New Version",
url: "${common.environments.prod.url}"
],
]
)
}catch(error){
common.notifyError(
"Couldn't deploy Frontend to ${common.environments.prod.name} 🤕",
"Error: '${error.message}'"
)
throw error
}
}
}
}