Skip to content

Commit

Permalink
Merge release branch into master branch [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Nubisproject (Mozilla) committed Jul 11, 2018
2 parents b588941 + de8e7fe commit 5648e9c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 11 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
# Change Log

## [v0.16.0](https://github.com/nubisproject/nubis-docker-deploy/tree/v0.16.0) (2018-07-11)
[Full Changelog](https://github.com/nubisproject/nubis-docker-deploy/compare/v0.15.0...v0.16.0)

**Closed issues:**

- Add debugging output for terraform [\#83](https://github.com/nubisproject/nubis-docker-deploy/issues/83)
- Expose $rv to caller [\#82](https://github.com/nubisproject/nubis-docker-deploy/issues/82)

**Merged pull requests:**

- Carry $rv through and add Terraform debug support [\#84](https://github.com/nubisproject/nubis-docker-deploy/pull/84) ([tinnightcap](https://github.com/tinnightcap))

## [v0.15.0](https://github.com/nubisproject/nubis-docker-deploy/tree/v0.15.0) (2018-07-03)
[Full Changelog](https://github.com/nubisproject/nubis-docker-deploy/compare/v0.14.0...v0.15.0)

**Closed issues:**

- Tag v0.15.0 release [\#79](https://github.com/nubisproject/nubis-docker-deploy/issues/79)

**Merged pull requests:**

- Update CHANGELOG for v0.15.0 release \[skip ci\] [\#81](https://github.com/nubisproject/nubis-docker-deploy/pull/81) ([nubis-automation](https://github.com/nubis-automation))
- Update CHANGELOG for v0.15.0 release \[skip ci\] [\#80](https://github.com/nubisproject/nubis-docker-deploy/pull/80) ([nubis-automation](https://github.com/nubis-automation))
- Enable tty autodetection [\#78](https://github.com/nubisproject/nubis-docker-deploy/pull/78) ([tinnightcap](https://github.com/tinnightcap))

## [v0.14.0](https://github.com/nubisproject/nubis-docker-deploy/tree/v0.14.0) (2018-06-07)
Expand Down
53 changes: 42 additions & 11 deletions nubis-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ setup-terraform () {
export TERRAFORM_PATH="${WORKING_PATH}/${SERVICE_NAME}/nubis/terraform"
if [ ! -d "${WORKING_PATH}/${SERVICE_NAME}" ]; then
echo "Creating directory ${WORKING_PATH}/${SERVICE_NAME}"
mkdir "${WORKING_PATH}/${SERVICE_NAME}"
if ! mkdir "${WORKING_PATH}/${SERVICE_NAME}" ; then
echo -e "\033[1;31mERROR: Failed running 'mkdir ${WORKING_PATH}/${SERVICE_NAME}'\033[0m"
exit 1
fi

fi

# Determine if we have a tty and set input accordingly
Expand Down Expand Up @@ -178,11 +182,24 @@ terraform-apply () {
exit 1
fi

terraform apply -input="${TTY_INPUT}" ".terraform/terraform.plan"
if [ "${#@}" != 0 ]; then
if ! terraform apply -input="${TTY_INPUT}" "${@}" ".terraform/terraform.plan" ; then
echo -e "\033[1;31mERROR: Failed running 'terraform apply -input=${TTY_INPUT} ${*} .terraform/terraform.plan'\033[0m"
exit 1
fi
else
if ! terraform apply -input="${TTY_INPUT}" ".terraform/terraform.plan" ; then
echo -e "\033[1;31mERROR: Failed running 'terraform apply -input=${TTY_INPUT} .terraform/terraform.plan'\033[0m"
exit 1
fi
fi

# Copy Terraform files to the S3 bucket
echo -e "\nUploading Terraform assets to s3"
aws s3 sync --delete --region "${BUCKET_REGION}" --exclude ".terraform*" "${TERRAFORM_PATH}/" "s3://${STATE_BUCKET}/terraform/${SERVICE_NAME}-terraform/"
if ! aws s3 sync --delete --region "${BUCKET_REGION}" --exclude ".terraform*" "${TERRAFORM_PATH}/" "s3://${STATE_BUCKET}/terraform/${SERVICE_NAME}-terraform/" ; then
echo -e "\033[1;31mERROR: Failed uploading assets to S3\033[0m"
exit 1
fi

# Clean up temporary file if we created one
if [ -f "${TF_CONSUL_WORKAROUND}" ];then
Expand All @@ -192,7 +209,16 @@ terraform-apply () {

terraform-do () {
declare -a _ACTION; _ACTION=( "${@}" )
cd "${TERRAFORM_PATH}" && terraform "${_ACTION[@]}"

if ! cd "${TERRAFORM_PATH}" ; then
echo -e "\033[1;31mERROR: Could not cd into '${TERRAFORM_PATH}'\033[0m"
exit 1
fi

if ! terraform "${_ACTION[@]}" ; then
echo -e "\033[1;31mERROR: Failed running 'terraform ${_ACTION[*]}'\033[0m"
exit 1
fi

# Clean up temporary file if we created one
if [ -f "${TF_CONSUL_WORKAROUND}" ];then
Expand All @@ -205,6 +231,7 @@ while [ "$1" != "" ]; do
case $1 in
-x | --debug )
set -x
export TF_LOG='DEBUG'
;;
-h | --help | help )
show_help
Expand All @@ -228,47 +255,51 @@ while [ "$1" != "" ]; do
GOT_COMMAND=1
;;
plan )
shift
setup-terraform
setup-deploy-dir
[[ ${SKIP_INIT:-0} == 0 ]] && terraform-init || echo "Skipping terraform-init"
terraform-do plan -input="${TTY_INPUT}"
terraform-do plan -input="${TTY_INPUT}" "${@}"
GOT_COMMAND=1
;;
apply )
shift
setup-terraform
setup-deploy-dir
[[ ${SKIP_INIT:-0} == 0 ]] && terraform-init || echo "Skipping terraform-init"
terraform-apply
terraform-apply "${@}"
GOT_COMMAND=1
;;
destroy )
shift
setup-terraform
setup-deploy-dir
[[ ${SKIP_INIT:-0} == 0 ]] && terraform-init || echo "Skipping terraform-init"
terraform-do destroy -input="${TTY_INPUT}"
terraform-do destroy -input="${TTY_INPUT}" "${@}"
GOT_COMMAND=1
;;
show )
shift
setup-terraform
setup-deploy-dir
[[ ${SKIP_INIT:-0} == 0 ]] && terraform-init || echo "Skipping terraform-init"
terraform-do show -input="${TTY_INPUT}"
terraform-do show "${@}"
GOT_COMMAND=1
;;
output )
output | outputs )
shift
setup-terraform
setup-deploy-dir
[[ ${SKIP_INIT:-0} == 0 ]] && terraform-init || echo "Skipping terraform-init"
terraform-do output -input="${TTY_INPUT}" "${@}"
terraform-do output "${@}"
GOT_COMMAND=1
;;
state )
shift
setup-terraform
setup-deploy-dir
[[ ${SKIP_INIT:-0} == 0 ]] && terraform-init || echo "Skipping terraform-init"
terraform-do state -input="${TTY_INPUT}" "${@}"
terraform-do state "${@}"
GOT_COMMAND=1
;;
* )
Expand Down

0 comments on commit 5648e9c

Please sign in to comment.