Skip to content

Commit

Permalink
Merge pull request #36 from brettswift/feature/deploy-tagging
Browse files Browse the repository at this point in the history
Introduce forced injection of namespace to acceptance tests
  • Loading branch information
brettswift committed Nov 7, 2018
2 parents e76b8e9 + d922169 commit 316885f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ ENV/
.mypy_cache/
.idea
.DS_Store
dump
10 changes: 7 additions & 3 deletions tests/stacker_test/conf/acceptance.env
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Used for your dev environment:
# http://stacker.readthedocs.io/en/latest/environments.html
namespace: acc
namespace: # to be passed into the CLI. You can use the same value as User below ie (whoami/$env:UserName)
env: ac
# If you want to run these tests yourself, reconfigure the below for your own account
VpcId: vpc-894b89ef
BaseDomain: playpen.dsl.aws.shaw.ca
PrivateSubnets: subnet-7b8cba32,subnet-ed041b8a
SshKeyName: stc-admin-March-2017-PLAYPEN
ALBCertName: ${ssmstore us-west-2@/simpleweb/bswift/ALBCertName}
SshKeyName: ${ssmstore us-west-2@/cumulus/acceptance/SshKeyName}
ALBCertName: ${ssmstore us-west-2@/cumulus/acceptance/ALBCertName}

# dynamic params expected to be set in the CLI. ex: -e GitDescribe=`git describe --always --dirty`
GitDescribe: notset # please set to `git describe --always --dirty`
User: notset # please set to `whoami` or `$env:UserName` (for windows)
10 changes: 0 additions & 10 deletions tests/stacker_test/conf/asgtest.env

This file was deleted.

16 changes: 9 additions & 7 deletions tests/stacker_test/run-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

#set -x
ACCOUNT_ID=`aws sts get-caller-identity | jq .Account | tr -d '"' `
NAMESPACE=acc # must match the namespace in the conf file

NAMESPACE=`whoami`
NAMESPACE_PARAM="-e namespace=${NAMESPACE}"
echo "Using account: ${ACCOUNT_ID}"

set -e #Important. Script will exit appropriately if there is an error.

stacker build conf/acceptance.env stacker.yaml --recreate-failed -t --stacks pipelinesimple
stacker build conf/acceptance.env stacker.yaml --recreate-failed -t \
--stacks pipelinesimple ${NAMESPACE_PARAM} \
-e GitDescribe=`git describe --always --dirty` -e User=`whoami`

BUCKET_NAME=$(stacker info conf/acceptance.env stacker.yaml 2>&1 | grep PipelineBucket: | cut -f 3 -d " ")
PIPELINE_NAME=$(stacker info conf/acceptance.env stacker.yaml 2>&1 | grep PipelineName | cut -f 3 -d " ")
BUCKET_NAME=$(stacker info conf/acceptance.env stacker.yaml ${NAMESPACE_PARAM} 2>&1 | grep PipelineBucket: | cut -f 3 -d " ")
PIPELINE_NAME=$(stacker info conf/acceptance.env stacker.yaml ${NAMESPACE_PARAM} 2>&1 | grep PipelineName | cut -f 3 -d " ")

ARTIFACT_NAME='artifact.zip'
TEMP_DIR='ac_build'
Expand Down Expand Up @@ -60,12 +62,12 @@ while [ $SECONDS -lt ${end} ]; do
done


SHOULD_DESTROY=false
SHOULD_DESTROY=true
if $SHOULD_DESTROY; then
aws s3 rm s3://${BUCKET_NAME} --recursive
python delete_bucket_versions.py ${BUCKET_NAME}

stacker destroy conf/acceptance.env stacker.yaml --force -t
stacker destroy conf/acceptance.env stacker.yaml ${NAMESPACE_PARAM} --force -t
fi

echo "Completing with exit code ${pipeline_result}"
Expand Down
5 changes: 5 additions & 0 deletions tests/stacker_test/stacker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ mappings:
amazonLinux2: ami-a9d09ed1
# ami-31394949

tags:
GitVersion: ${GitDescribe}
LastDeployedBy: ${User}


# The stacks key accepts a list of stack declarations.
# http://stacker.readthedocs.io/en/latest/config.html#stacks
stacks:
Expand Down

0 comments on commit 316885f

Please sign in to comment.