Skip to content

Commit

Permalink
Clean up and fix image push to use separate shell processes too
Browse files Browse the repository at this point in the history
  • Loading branch information
hsalokor committed Dec 12, 2024
1 parent c6a0796 commit ecb1a2c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 27 deletions.
32 changes: 6 additions & 26 deletions aoe-web-frontend/deploy-scripts/02-push-image.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail

# shellcheck source=../scripts/common-functions.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../../scripts/common-functions.sh"
push_command="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/scripts/push-configuration.sh"

# shellcheck source=./deploy-functions.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../../deploy-scripts/deploy-functions.sh"

function main() {
setup

local aoe_service_name="aoe-web-frontend"
local github_image_tag_dev="$github_registry${aoe_service_name}-dev:${IMAGE_TAG}"
local github_image_tag_qa="$github_registry${aoe_service_name}-qa:${IMAGE_TAG}"
local github_image_tag_prod="$github_registry${aoe_service_name}-prod:${IMAGE_TAG}"

local ecr_registry="${REGISTRY}/$aoe_service_name"
local ecr_image_tag="${ecr_registry}:${IMAGE_TAG}"
upload_image_to_ecr "$github_image_tag_dev" "$ecr_image_tag-dev"
upload_image_to_ecr "$github_image_tag_qa" "$ecr_image_tag-qa"
upload_image_to_ecr "$github_image_tag_prod" "$ecr_image_tag-prod"
function main {
${push_command} dev
${push_command} qa
${push_command} prod
}

function setup() {
cd "${repo}"
require_command docker
require_docker_compose
configure_aws_credentials
get_ecr_login_credentials
}
main


main "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function main {
echo "Building for configuration ${configuration}"
;;
*)
echo "FRONTEND_CONFIGURATION not set to correct value (got $configuration)"
echo "Configuration parameter is not correct (got configuration=$configuration)"
exit 1
;;
esac
Expand Down
40 changes: 40 additions & 0 deletions aoe-web-frontend/deploy-scripts/scripts/push-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail

# shellcheck source=../scripts/common-functions.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../../scripts/common-functions.sh"

# shellcheck source=./deploy-functions.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../../../deploy-scripts/deploy-functions.sh"

function main() {
setup

configuration=${1:-none}
case $configuration in
"dev"|"qa"|"prod")
echo "Building for configuration ${configuration}"
;;
*)
echo "Configuration parameter is not correct (got configuration=$configuration)"
exit 1
;;
esac

local aoe_service_name="aoe-web-frontend"
local github_image_tag="$github_registry${aoe_service_name}-${configuration}:${IMAGE_TAG}"

local ecr_registry="${REGISTRY}/$aoe_service_name"
local ecr_image_tag="${ecr_registry}:${IMAGE_TAG}"
upload_image_to_ecr "$github_image_tag" "$ecr_image_tag-${configuration}"
}

function setup() {
cd "${repo}"
require_command docker
require_docker_compose
configure_aws_credentials
get_ecr_login_credentials
}

main "$@"

0 comments on commit ecb1a2c

Please sign in to comment.