Skip to content

Commit

Permalink
Refactor code to make it easy to make the load balancer public later
Browse files Browse the repository at this point in the history
  • Loading branch information
rubberduck203 committed Sep 28, 2018
1 parent c46bad5 commit ab7204a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ node('infrastructure') {
image.push()
image.push('latest')
}
deployUiTo('dev')
deployUiTo(environment: 'dev')
runSmokeTestAgainst('dev')
}


doStageIfPromoted('Deploy to Staging') {
def promotionTag = scos.releaseCandidateNumber()

deployUiTo('staging')
deployUiTo(environment: 'staging')
runSmokeTestAgainst('staging')

scos.applyAndPushGitHubTag(promotionTag)
Expand All @@ -50,7 +50,8 @@ node('infrastructure') {
def releaseTag = env.BRANCH_NAME
def promotionTag = 'prod'

deployUiTo('prod')
/* change internal to false when we're ready to release */
deployUiTo(environment: 'prod', internal: true)
runSmokeTestAgainst('prod')

scos.applyAndPushGitHubTag(promotionTag)
Expand All @@ -64,20 +65,26 @@ node('infrastructure') {
}
}

def deployUiTo(environment) {
def deployUiTo(params = [:]) {
def environment = params.get('environment')
if (environment == null) throw new IllegalArgumentException("environment must be specified")

def internal = params.get('internal', true)

scos.withEksCredentials(environment) {
def terraformOutputs = scos.terraformOutput(environment)
def subnets = terraformOutputs.public_subnets.value.join(', ')
def allowInboundTrafficSG = terraformOutputs.allow_all_security_group.value
def certificateARN = terraformOutputs.tls_certificate_arn.value

def ingressScheme = internal ? 'internal' : 'internet-facing'
sh("""#!/bin/bash
set -e
export VERSION="${env.GIT_COMMIT_HASH}"
export DNS_ZONE="${environment}.internal.smartcolumbusos.com"
export SUBNETS="${subnets}"
export SECURITY_GROUPS="${allowInboundTrafficSG}"
export INGRESS_SCHEME=internal
export INGRESS_SCHEME=${ingressScheme}
export CERTIFICATE_ARN="${certificateARN}"
kubectl apply -f k8s/configs/${environment}.yaml
Expand Down

0 comments on commit ab7204a

Please sign in to comment.