Skip to content

Commit

Permalink
Small bugfixes for deployment/release workflow (#91)
Browse files Browse the repository at this point in the history
* Ensure the environment variable DRY_RUN does not conflict with the operations of deploy.sh

* Add ability to push the dependency image so that it actually does save us some build time...

* Add a production logging block; currently configured the same as dev and eval; can be overridden or tweaked as needed.

* Ensure install-build-scripts has shebang.

* [Bot] Update version to 1.2.2

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Thomas Thorogood and github-actions[bot] authored Aug 27, 2021
1 parent 8f63f92 commit 000ff29
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/steps/create-release/push-release-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ docker tag $pr_image $release_image
if [[ "${GITHUB_REF}" == 'refs/heads/main' ]]
then
docker push $release_image
./scripts/update-dependency-image.sh --push
else
echo "Not pushing $release_image in dry-run mode."
fi
2 changes: 2 additions & 0 deletions husky_directory/settings/logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ base: &base
development: *base

test: *base

production: *base
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "uw-husky-directory"
version = "1.2.1"
version = "1.2.2"
description = "An updated version of the UW Directory"
authors = ["Thomas Thorogood <[email protected]>"]
license = "MIT"
Expand Down
5 changes: 5 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ REPO_API_URL=https://api.github.com/repos/uwit-iam/uw-husky-directory

REPO_TAGS_URL="${REPO_API_URL}/tags"
REPO_RELEASE_URL="${REPO_API_URL}/release/latest"
# Explicitly clear the local DRY_RUN variable if it is set by the environment
# So that we don't have to try and guess what the environment is doing with it.
# For the purposes of this script, dry run can be set by using `-x` or` --dry-run`,
# and then within this script only tested for value presence.
DRY_RUN=

function print_help {
cat <<EOF
Expand Down
2 changes: 2 additions & 0 deletions scripts/install-build-scripts.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash

export BUILD_SCRIPTS_DIR="./.build-scripts"
bash <(curl -Lsk https://uwiam.page.link/install-build-scripts)
41 changes: 41 additions & 0 deletions scripts/update-dependency-image.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,49 @@
#!/usr/bin/env bash


function print_help {
cat <<EOF
Use: update-dependency-image.sh [--debug --help]
Options:
-p, --push Push the fingerprint after building, this is risk-free
and saves a lot of time in the future!
-h, --help Show this message and exit
-g, --debug Show commands as they are executing
EOF
}

PUSH=

while (( $# ))
do
case $1 in
--help|-h)
print_help
exit 0
;;
--debug|-g)
set -x
;;
--push|-p)
PUSH=1
;;
*)
echo "Invalid Option: $1"
print_help
exit 1
;;
esac
shift
done

test -z "${DEBUG}" || set -x
image_repo=gcr.io/uwit-mci-iam/husky-directory-base
fingerprint=$(./scripts/get-snapshot-fingerprint.sh)
./.build-scripts/scripts/pull-or-build-image.sh \
-i $image_repo:$fingerprint \
-d docker/husky-directory-base.dockerfile

if [[ -n "$PUSH" ]]
then
docker push $image_repo:$fingerprint
fi

0 comments on commit 000ff29

Please sign in to comment.