-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
50 lines (42 loc) · 1.81 KB
/
Jenkinsfile
File metadata and controls
50 lines (42 loc) · 1.81 KB
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
node {
/* Setup our environment */
withEnv(["AWS_DEFAULT_REGION=us-east-1",
"FUGUE_RBAC_DO_AS=1",
"FUGUE_LWC_OPTIONS=true"]) {
/* Checkout git repo */
checkout(scm)
/* Use Amazon ECR repo */
docker.withRegistry("https://721018433921.dkr.ecr.us-east-1.amazonaws.com/fugue/client", "ecr:us-east-1:ECS_REPO" ) {
/* Pull the fugue client docker container from ECR */
docker.image("721018433921.dkr.ecr.us-east-1.amazonaws.com/fugue/client").inside {
/* Set our Fugue credentials */
withCredentials([string(credentialsId: "FUGUE_USER_NAME", variable: "FUGUE_USER_NAME"),
string(credentialsId: "FUGUE_USER_SECRET", variable: "FUGUE_USER_SECRET")]) {
/* Zip the lambda function */
stage("Build Serverless App") {
sh(script: "zip -r lambda_function.zip lambda_function.py")
}
/* Test the lambda function */
stage("Testing Serverless App") {
sh(script: "lwc LambdaFunction.lw")
def cmdStatusCode = sh(script: "fugue status HelloWorldLambda", returnStatus: true)
if(cmdStatusCode == 0) {
sh(script: "fugue update HelloWorldLambda LambdaFunction.lw -y --dry-run")
} else {
sh(script: "fugue run LambdaFunction.lw -a HelloWorldLambda --dry-run")
}
}
/* Deploy the lambda function */
stage("Deploy Serverless App") {
def cmdStatusCode = sh(script: "fugue status HelloWorldLambda", returnStatus: true)
if(cmdStatusCode == 0) {
sh(script: "fugue update HelloWorldLambda LambdaFunction.lw -y")
} else {
sh(script: "fugue run LambdaFunction.lw -a HelloWorldLambda")
}
}
}
}
}
}
}