Skip to content

Commit

Permalink
Add ability to store bbl-state in S3/GCS as a tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
davewalter committed May 20, 2019
1 parent 774e58f commit 12d9866
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion bbl-destroy/task
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ function main() {
popd
}

trap "commit_bbl_state_dir ${PWD} 'Remove bbl state dir'" EXIT
if [[ "${STORE_BBL_STATE_AS_TARBALL}" == "true" ]]; then
trap "rm -f ${PWD}/bbl-state/bbl-state.tgz ${PWD}/bbl-state/bbl-state.tgz.uncompressed; tar czf '${PWD}/updated-bbl-state/bbl-state.tgz' -C '${PWD}/bbl-state' ." EXIT
else
trap "commit_bbl_state_dir ${PWD} 'Remove bbl state dir'" EXIT
fi

main ${PWD}
8 changes: 7 additions & 1 deletion bbl-destroy/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ params:
BBL_AZURE_CLIENT_SECRET:
BBL_AZURE_TENANT_ID:
BBL_AZURE_SUBSCRIPTION_ID:

# GCP Configuration Params
# - Required for GCP
BBL_GCP_SERVICE_ACCOUNT_KEY:
# - Key content or path to the file containing credentials downloaded from GCP
# - Path is relative to the `bbl-state` input

STORE_BBL_STATE_AS_TARBALL: false
# - Optional
# - Creates a tarball of the bbl-state directory, instead of treating it
# - as a git repo and committing.
# - This is useful if you want to store your state file in S3 or GCS.
6 changes: 5 additions & 1 deletion bbl-up/task
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ function main() {
popd
}

trap "commit_bbl_state_dir ${PWD} '${GIT_COMMIT_MESSAGE}'" EXIT
if [[ "${STORE_BBL_STATE_AS_TARBALL}" == "true" ]]; then
trap "rm -f ${PWD}/bbl-state/bbl-state.tgz ${PWD}/bbl-state/bbl-state.tgz.uncompressed; tar czf '${PWD}/updated-bbl-state/bbl-state.tgz' -C '${PWD}/bbl-state' ." EXIT
else
trap "commit_bbl_state_dir ${PWD} 'Remove bbl state dir'" EXIT
fi

main ${PWD}
6 changes: 6 additions & 0 deletions bbl-up/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,9 @@ params:
# - BE CAREFUL! For public pipelines it can cause credentials disclosure.
# - With `false` all output from BBL calls will be saved in log files inside concourse job only.
# - Set this to `true` to see all output straight in the pipeline.

STORE_BBL_STATE_AS_TARBALL: false
# - Optional
# - Creates a tarball of the bbl-state directory, instead of treating it
# - as a git repo and committing.
# - This is useful if you want to store your state file in S3 or GCS.

0 comments on commit 12d9866

Please sign in to comment.