From e1c1f8fc36baee859c8015baaf3ef50d83c1f0f6 Mon Sep 17 00:00:00 2001 From: Greg Barnes Date: Wed, 18 Sep 2024 17:02:57 +0100 Subject: [PATCH] Adds phases folder and build commands required for latest version of platform helper --- .copilot/config.yml | 7 +++++-- .copilot/image_build_run.sh | 0 .copilot/phases/build.sh | 6 ++++++ .copilot/phases/install.sh | 6 ++++++ .copilot/phases/post_build.sh | 6 ++++++ .copilot/phases/pre_build.sh | 23 +++++++++++++++++++++++ .gitignore | 3 +++ 7 files changed, 49 insertions(+), 2 deletions(-) mode change 100644 => 100755 .copilot/image_build_run.sh create mode 100644 .copilot/phases/build.sh create mode 100644 .copilot/phases/install.sh create mode 100644 .copilot/phases/post_build.sh create mode 100644 .copilot/phases/pre_build.sh diff --git a/.copilot/config.yml b/.copilot/config.yml index 4c76adc..ca5cd63 100644 --- a/.copilot/config.yml +++ b/.copilot/config.yml @@ -1,4 +1,7 @@ repository: orp builder: - name: paketobuildpacks/builder-jammy-full - version: 0.3.339 + name: paketobuildpacks/builder-jammy-base + version: 0.4.240 +packages: + - libpq-dev + - libsqlite3-dev diff --git a/.copilot/image_build_run.sh b/.copilot/image_build_run.sh old mode 100644 new mode 100755 diff --git a/.copilot/phases/build.sh b/.copilot/phases/build.sh new file mode 100644 index 0000000..c1a73f2 --- /dev/null +++ b/.copilot/phases/build.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Exit early if something goes wrong +set -e + +# Add commands below to run as part of the build phase diff --git a/.copilot/phases/install.sh b/.copilot/phases/install.sh new file mode 100644 index 0000000..17794e8 --- /dev/null +++ b/.copilot/phases/install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Exit early if something goes wrong +set -e + +# Add commands below to run as part of the install phase diff --git a/.copilot/phases/post_build.sh b/.copilot/phases/post_build.sh new file mode 100644 index 0000000..1676bb5 --- /dev/null +++ b/.copilot/phases/post_build.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Exit early if something goes wrong +set -e + +# Add commands below to run as part of the post_build phase diff --git a/.copilot/phases/pre_build.sh b/.copilot/phases/pre_build.sh new file mode 100644 index 0000000..18b1939 --- /dev/null +++ b/.copilot/phases/pre_build.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Exit early if something goes wrong +set -e + +if [ -f "./.gitmodules" ]; then + echo ".gitmodules file exists. Modifying URLs..." + account_id=$(echo $CODESTAR_CONNECTION_ARN | cut -d':' -f5) + connection_id=$(echo $CODESTAR_CONNECTION_ARN | cut -d'/' -f2) + git_clone_base_url="https://codestar-connections.eu-west-2.amazonaws.com/git-http/$account_id/eu-west-2/$connection_id/uktrade" + + git config --global credential.helper '!aws codecommit credential-helper $@' + git config --global credential.UseHttpPath true + + sed -i "s|url = git@github.com:uktrade/\(.*\).git|url = $git_clone_base_url/\1.git|g" ./.gitmodules + + git submodule update --init --remote --recursive + +else + echo ".gitmodules file does not exist. No URLs to update." +fi + +# Add commands below to run as part of the pre_build phase diff --git a/.gitignore b/.gitignore index 8ced0e2..5f35fd5 100644 --- a/.gitignore +++ b/.gitignore @@ -78,6 +78,9 @@ ENV/ env.bak/ venv.bak/ +# direnv +.envrc + # mkdocs documentation /site