From 04e7f93d9ee5fbeaa4a855b4f4015f84594d2140 Mon Sep 17 00:00:00 2001 From: John Stainsby Date: Thu, 29 Feb 2024 09:06:40 +0000 Subject: [PATCH] Add check for version files existing --- .../templates/pipelines/environments/buildspec.yml | 10 +++++++++- .../pipeline/pipelines/environments/buildspec.yml | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dbt_copilot_helper/templates/pipelines/environments/buildspec.yml b/dbt_copilot_helper/templates/pipelines/environments/buildspec.yml index bccc82e78..567fa9164 100644 --- a/dbt_copilot_helper/templates/pipelines/environments/buildspec.yml +++ b/dbt_copilot_helper/templates/pipelines/environments/buildspec.yml @@ -8,7 +8,16 @@ phases: install: commands: - cd $CODEBUILD_SRC_DIR + - if [ ! -f .copilot-version ]; then + echo "Cannot find .copilot-version file" + exit 1 + fi + - if [ ! -f .copilot-helper-version ]; then + echo "Cannot find .copilot-helper-version file" + exit 1 + fi - COPILOT_VERSION=`cat .copilot-version` + - COPILOT_HELPER_VERSION=`cat .copilot-helper-version` - mkdir ./build-tools - cd ./build-tools # Install copilot @@ -16,7 +25,6 @@ phases: - mv "./copilot-linux-v${COPILOT_VERSION}" ./copilot - chmod +x ./copilot # Install pyyaml and dbt-copilot-tools - - COPILOT_HELPER_VERSION=`cat .copilot-helper-version` - pip install PyYAML dbt-copilot-tools==$COPILOT_HELPER_VERSION # Install dyff - yaml differ - wget -q "https://github.com/homeport/dyff/releases/download/v${DYFF_VERSION}/dyff_${DYFF_VERSION}_linux_amd64.tar.gz" diff --git a/tests/copilot_helper/expected_files/pipeline/pipelines/environments/buildspec.yml b/tests/copilot_helper/expected_files/pipeline/pipelines/environments/buildspec.yml index 821738ce4..6b6b7f406 100644 --- a/tests/copilot_helper/expected_files/pipeline/pipelines/environments/buildspec.yml +++ b/tests/copilot_helper/expected_files/pipeline/pipelines/environments/buildspec.yml @@ -8,7 +8,16 @@ phases: install: commands: - cd $CODEBUILD_SRC_DIR + - if [ ! -f .copilot-version ]; then + echo "Cannot find .copilot-version file" + exit 1 + fi + - if [ ! -f .copilot-helper-version ]; then + echo "Cannot find .copilot-helper-version file" + exit 1 + fi - COPILOT_VERSION=`cat .copilot-version` + - COPILOT_HELPER_VERSION=`cat .copilot-helper-version` - mkdir ./build-tools - cd ./build-tools # Install copilot @@ -16,7 +25,6 @@ phases: - mv "./copilot-linux-v${COPILOT_VERSION}" ./copilot - chmod +x ./copilot # Install pyyaml and dbt-copilot-tools - - COPILOT_HELPER_VERSION=`cat .copilot-helper-version` - pip install PyYAML dbt-copilot-tools==$COPILOT_HELPER_VERSION # Install dyff - yaml differ - wget -q "https://github.com/homeport/dyff/releases/download/v${DYFF_VERSION}/dyff_${DYFF_VERSION}_linux_amd64.tar.gz"