This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
63 lines (61 loc) · 2.27 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
@Library(value='iow-ecs-pipeline@2.2.0', changelog=false) _
pipeline {
agent {
node {
label 'team:iow'
}
}
environment {
npm_config_cache = 'npm-cache'
HOME = '.'
}
stages {
stage('Set Build Description') {
steps {
script {
currentBuild.description = "Deploy to ${env.DEPLOY_STAGE}"
}
}
}
stage('get and install the zip file for lambda consumption') {
agent {
dockerfile {
label 'team:iow'
}
}
steps {
script {
if ("${params.DEPLOY_STAGE}" == 'DEV') {
def secretsString = sh(script: '/usr/local/bin/aws ssm get-parameter --name "/aws/reference/secretsmanager/IOW_AWS" --query "Parameter.Value" --with-decryption --output text --region "us-west-2"', returnStdout: true).trim()
def secretsJson = readJSON text: secretsString
def iowDevAccountNumber = secretsJson.accountNumber
def devAccountRoleName = secretsJson.roleName
def assumeRoleName = "arn:aws:iam::$iowDevAccountNumber:role/$devAccountRoleName"
def assumeRoleResp = sh(script: "/usr/local/bin/aws sts assume-role --role-arn $assumeRoleName --role-session-name expt-session --duration-seconds 3600", returnStdout: true).trim()
def roleJson = readJSON text: assumeRoleResp
env.AWS_ACCESS_KEY_ID = roleJson.Credentials.AccessKeyId
env.AWS_SECRET_ACCESS_KEY = roleJson.Credentials.SecretAccessKey
env.AWS_SESSION_TOKEN = roleJson.Credentials.SessionToken
env.BUCKET = 'iow-cloud-applications-dev'
} else {
env.BUCKET = 'iow-cloud-applications'
}
}
sh '''
curl ${SHADED_JAR_ARTIFACT_URL} -Lo aqts-capture-ts-field-visit-aws.jar
ls -al
npm install
ls -al
./node_modules/serverless/bin/serverless.js deploy --stage ${DEPLOY_STAGE} --bucket ${BUCKET} --taggingVersion ${SHADED_JAR_VERSION}
'''
}
}
}
post {
always {
script {
pipelineUtils.cleanWorkspace()
}
}
}
}