From 995ca9b6d46577135ff2419da5614b5c202756f9 Mon Sep 17 00:00:00 2001 From: "E. Lynette Rayle" Date: Tue, 9 Jul 2024 12:48:44 -0400 Subject: [PATCH] test v1.1.1-rc2 Moved scripts used in workflows to be in the .github/workflows directory --- .github/workflows/app-build-and-deploy.yml | 8 ++++---- .github/workflows/app-build-docker-image.yml | 2 +- .github/workflows/app-deploy-to-azure.yml | 4 ++-- .../workflows/scripts}/app-workflows/confirm-dev.sh | 0 .../scripts}/app-workflows/determine-image-name.sh | 0 .../workflows/scripts}/app-workflows/get-org-id.sh | 0 .../workflows/scripts}/app-workflows/get-version.sh | 0 .github/workflows/test.yml | 2 +- .../scripts/app-workflows/fixtures/package-lock.json | 0 .../tests}/scripts/app-workflows/test-confirm-dev.bats | 6 +++--- .../app-workflows/test-determine-image-name.bats | 6 +++--- .../tests}/scripts/app-workflows/test-get-org-id.bats | 4 ++-- .../tests}/scripts/app-workflows/test-get-version.bats | 10 +++++----- .../tests}/scripts/app-workflows/test_helpers.bash | 0 14 files changed, 21 insertions(+), 21 deletions(-) rename {scripts => .github/workflows/scripts}/app-workflows/confirm-dev.sh (100%) rename {scripts => .github/workflows/scripts}/app-workflows/determine-image-name.sh (100%) rename {scripts => .github/workflows/scripts}/app-workflows/get-org-id.sh (100%) rename {scripts => .github/workflows/scripts}/app-workflows/get-version.sh (100%) rename {tests => .github/workflows/tests}/scripts/app-workflows/fixtures/package-lock.json (100%) rename {tests => .github/workflows/tests}/scripts/app-workflows/test-confirm-dev.bats (79%) rename {tests => .github/workflows/tests}/scripts/app-workflows/test-determine-image-name.bats (68%) rename {tests => .github/workflows/tests}/scripts/app-workflows/test-get-org-id.bats (69%) rename {tests => .github/workflows/tests}/scripts/app-workflows/test-get-version.bats (69%) rename {tests => .github/workflows/tests}/scripts/app-workflows/test_helpers.bash (100%) diff --git a/.github/workflows/app-build-and-deploy.yml b/.github/workflows/app-build-and-deploy.yml index 299dc82..688823b 100644 --- a/.github/workflows/app-build-and-deploy.yml +++ b/.github/workflows/app-build-and-deploy.yml @@ -1,5 +1,5 @@ # This workflow will build a docker image, push it to ghcr.io, and deploy it to an Azure WebApp. -# v1.1.1-rc1 - This tag coordinates the other reusable parts of this workflow. +# v1.1.1-rc2 - This tag coordinates the other reusable parts of this workflow. # * app-build-docker-image.yml # * app-deploy-to-azure.yml # * app-is-deployable.yml @@ -76,7 +76,7 @@ jobs: build-and-publish-image: name: Build and publish Docker image needs: get-version - uses: clearlydefined/operations/.github/workflows/app-build-docker-image.yml@v1.1.1-rc1 + uses: clearlydefined/operations/.github/workflows/app-build-docker-image.yml@v1.1.1-rc2 secrets: DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} PRODUCTION_DEPLOYERS: ${{ secrets.PRODUCTION_DEPLOYERS }} @@ -88,7 +88,7 @@ jobs: deploy-primary-app-to-azure: name: Deploy to primary Azure app needs: [get-version, build-and-publish-image] - uses: clearlydefined/operations/.github/workflows/app-deploy-to-azure.yml@v1.1.1-rc1 + uses: clearlydefined/operations/.github/workflows/app-deploy-to-azure.yml@v1.1.1-rc2 secrets: AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} @@ -104,7 +104,7 @@ jobs: name: Deploy to secondary Azure app if: ${{ inputs.secondary-azure-app-name-postfix != '' }} needs: [get-version, build-and-publish-image] - uses: clearlydefined/operations/.github/workflows/app-deploy-to-azure.yml@v1.1.1-rc1 + uses: clearlydefined/operations/.github/workflows/app-deploy-to-azure.yml@v1.1.1-rc2 secrets: AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_SECONDARY_WEBAPP_PUBLISH_PROFILE }} AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} diff --git a/.github/workflows/app-build-docker-image.yml b/.github/workflows/app-build-docker-image.yml index 944238f..fb1f84b 100644 --- a/.github/workflows/app-build-docker-image.yml +++ b/.github/workflows/app-build-docker-image.yml @@ -31,7 +31,7 @@ on: jobs: check-deployable: - uses: clearlydefined/operations/.github/workflows/app-is-deployable.yml@v1.1.1-rc1 + uses: clearlydefined/operations/.github/workflows/app-is-deployable.yml@v1.1.1-rc2 with: deploy-env: ${{ inputs.deploy-env }} secrets: diff --git a/.github/workflows/app-deploy-to-azure.yml b/.github/workflows/app-deploy-to-azure.yml index ab7f5ce..cf86d5d 100644 --- a/.github/workflows/app-deploy-to-azure.yml +++ b/.github/workflows/app-deploy-to-azure.yml @@ -37,7 +37,7 @@ on: jobs: check-deployable: - uses: clearlydefined/operations/.github/workflows/app-is-deployable.yml@v1.1.1-rc1 + uses: clearlydefined/operations/.github/workflows/app-is-deployable.yml@v1.1.1-rc2 with: deploy-env: ${{ inputs.deploy-env }} secrets: @@ -55,7 +55,7 @@ jobs: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Set DOCKER configs in Azure web app - uses: azure/appservice-settings@v1.1.1-rc1 + uses: azure/appservice-settings@v1.1.1-rc2 with: app-name: ${{ inputs.azure-webapp-name }} app-settings-json: | diff --git a/scripts/app-workflows/confirm-dev.sh b/.github/workflows/scripts/app-workflows/confirm-dev.sh similarity index 100% rename from scripts/app-workflows/confirm-dev.sh rename to .github/workflows/scripts/app-workflows/confirm-dev.sh diff --git a/scripts/app-workflows/determine-image-name.sh b/.github/workflows/scripts/app-workflows/determine-image-name.sh similarity index 100% rename from scripts/app-workflows/determine-image-name.sh rename to .github/workflows/scripts/app-workflows/determine-image-name.sh diff --git a/scripts/app-workflows/get-org-id.sh b/.github/workflows/scripts/app-workflows/get-org-id.sh similarity index 100% rename from scripts/app-workflows/get-org-id.sh rename to .github/workflows/scripts/app-workflows/get-org-id.sh diff --git a/scripts/app-workflows/get-version.sh b/.github/workflows/scripts/app-workflows/get-version.sh similarity index 100% rename from scripts/app-workflows/get-version.sh rename to .github/workflows/scripts/app-workflows/get-version.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e64aa6e..deb9534 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,4 +23,4 @@ jobs: sudo ./install.sh /usr/local - name: Run Bats tests - run: bats tests/scripts/app-workflows/*.bats + run: bats .github/workflows/tests/scripts/app-workflows/*.bats diff --git a/tests/scripts/app-workflows/fixtures/package-lock.json b/.github/workflows/tests/scripts/app-workflows/fixtures/package-lock.json similarity index 100% rename from tests/scripts/app-workflows/fixtures/package-lock.json rename to .github/workflows/tests/scripts/app-workflows/fixtures/package-lock.json diff --git a/tests/scripts/app-workflows/test-confirm-dev.bats b/.github/workflows/tests/scripts/app-workflows/test-confirm-dev.bats similarity index 79% rename from tests/scripts/app-workflows/test-confirm-dev.bats rename to .github/workflows/tests/scripts/app-workflows/test-confirm-dev.bats index fa0b743..ccdcc01 100644 --- a/tests/scripts/app-workflows/test-confirm-dev.bats +++ b/.github/workflows/tests/scripts/app-workflows/test-confirm-dev.bats @@ -3,7 +3,7 @@ load 'test_helpers' @test "deploy to dev environment" { - run ./scripts/app-workflows/confirm-dev.sh dev + run ./.github/workflows/scripts/app-workflows/confirm-dev.sh dev test_value 0 "$status" test_value "Deploying to dev environment" "${lines[0]}" test_value "confirm-dev -> outputs -> is_dev: true" "${lines[1]}" @@ -11,7 +11,7 @@ load 'test_helpers' } @test "deploy to prod environment" { - run ./scripts/app-workflows/confirm-dev.sh prod + run ./.github/workflows/scripts/app-workflows/confirm-dev.sh prod test_value 0 "$status" test_value "Deploying to prod or UNKNOWN environment" "${lines[0]}" test_value "confirm-dev -> outputs -> is_dev: false" "${lines[1]}" @@ -19,7 +19,7 @@ load 'test_helpers' } @test "deploy to anything else defaults to prod environment for tighter restrictions" { - run ./scripts/app-workflows/confirm-dev.sh UNKNOWN_ENV + run ./.github/workflows/scripts/app-workflows/confirm-dev.sh UNKNOWN_ENV test_value 0 "$status" test_value "Deploying to prod or UNKNOWN environment" "${lines[0]}" test_value "confirm-dev -> outputs -> is_dev: false" "${lines[1]}" diff --git a/tests/scripts/app-workflows/test-determine-image-name.bats b/.github/workflows/tests/scripts/app-workflows/test-determine-image-name.bats similarity index 68% rename from tests/scripts/app-workflows/test-determine-image-name.bats rename to .github/workflows/tests/scripts/app-workflows/test-determine-image-name.bats index 95a522f..0b4f40a 100644 --- a/tests/scripts/app-workflows/test-determine-image-name.bats +++ b/.github/workflows/tests/scripts/app-workflows/test-determine-image-name.bats @@ -3,21 +3,21 @@ load 'test_helpers' @test "deploy to dev environment" { - run ./scripts/app-workflows/determine-image-name.sh test-org/test-repo dev test-tag + run ./.github/workflows/scripts/app-workflows/determine-image-name.sh test-org/test-repo dev test-tag test_value 0 "$status" test_value "determine_image_name -> outputs -> image_name_with_tag: ghcr.io/test-org/test-repo-dev:test-tag" "${lines[0]}" test_value ghcr.io/test-org/test-repo-dev:test-tag "${lines[1]}" } @test "deploy to prod environment" { - run ./scripts/app-workflows/determine-image-name.sh test-org/test-repo prod test-tag + run ./.github/workflows/scripts/app-workflows/determine-image-name.sh test-org/test-repo prod test-tag test_value 0 "$status" test_value "determine_image_name -> outputs -> image_name_with_tag: ghcr.io/test-org/test-repo:test-tag" "${lines[0]}" test_value ghcr.io/test-org/test-repo:test-tag "${lines[1]}" } @test "invalid deploy environment" { - run ./scripts/app-workflows/determine-image-name.sh test-org/test-repo BAD_ENV test-tag + run ./.github/workflows/scripts/app-workflows/determine-image-name.sh test-org/test-repo BAD_ENV test-tag test_value 1 "$status" test_value "Invalid deploy environment: BAD_ENV. Must be 'dev' or 'prod'" "${lines[0]}" } diff --git a/tests/scripts/app-workflows/test-get-org-id.bats b/.github/workflows/tests/scripts/app-workflows/test-get-org-id.bats similarity index 69% rename from tests/scripts/app-workflows/test-get-org-id.bats rename to .github/workflows/tests/scripts/app-workflows/test-get-org-id.bats index b8534a2..60f9fba 100644 --- a/tests/scripts/app-workflows/test-get-org-id.bats +++ b/.github/workflows/tests/scripts/app-workflows/test-get-org-id.bats @@ -3,14 +3,14 @@ load 'test_helpers' @test "get github org id" { - run ./scripts/app-workflows/get-org-id.sh "github" + run ./.github/workflows/scripts/app-workflows/get-org-id.sh "github" test_value 0 "$status" test_value "get-org-id -> outputs -> org_id: 9919" "${lines[0]}" test_value "9919" "${lines[1]}" } @test "missing org name" { - run ./scripts/app-workflows/get-org-id.sh "" + run ./.github/workflows/scripts/app-workflows/get-org-id.sh "" test_value 1 "$status" test_value "Organization not found: " "${lines[0]}" } diff --git a/tests/scripts/app-workflows/test-get-version.bats b/.github/workflows/tests/scripts/app-workflows/test-get-version.bats similarity index 69% rename from tests/scripts/app-workflows/test-get-version.bats rename to .github/workflows/tests/scripts/app-workflows/test-get-version.bats index 3edda48..3d4b764 100644 --- a/tests/scripts/app-workflows/test-get-version.bats +++ b/.github/workflows/tests/scripts/app-workflows/test-get-version.bats @@ -5,7 +5,7 @@ load 'test_helpers' package_lock_file="$(dirname "$BATS_TEST_DIRNAME")/app-workflows/fixtures/package-lock.json" @test "deploy to dev environment" { - run ./scripts/app-workflows/get-version.sh dev false "" 1234567890ABCDEF "$package_lock_file" + run ./.github/workflows/scripts/app-workflows/get-version.sh dev false "" 1234567890ABCDEF "$package_lock_file" test_value 0 "$status" test_value "get-version.sh -> outputs -> version: v10.0.1-dev-1234567890" "${lines[0]}" test_value "v10.0.1-dev-1234567890" "${lines[1]}" @@ -13,7 +13,7 @@ package_lock_file="$(dirname "$BATS_TEST_DIRNAME")/app-workflows/fixtures/packag @test "deploy to prod environment triggered by release and version matches" { # only use version from package-lock.json if it matches the release tag - run ./scripts/app-workflows/get-version.sh prod true v10.0.1 1234567890ABCDEF "$package_lock_file" + run ./.github/workflows/scripts/app-workflows/get-version.sh prod true v10.0.1 1234567890ABCDEF "$package_lock_file" test_value 0 "$status" test_value "get-version.sh -> outputs -> version: v10.0.1" "${lines[0]}" test_value "v10.0.1" "${lines[1]}" @@ -21,21 +21,21 @@ package_lock_file="$(dirname "$BATS_TEST_DIRNAME")/app-workflows/fixtures/packag @test "deploy to prod environment triggered by release and version doesn't matches" { # fail because version in package-lock.json doesn't match the release tag - run ./scripts/app-workflows/get-version.sh prod true v9.2.0 1234567890ABCDEF "$package_lock_file" + run ./.github/workflows/scripts/app-workflows/get-version.sh prod true v9.2.0 1234567890ABCDEF "$package_lock_file" test_value 1 "$status" test_value "Version in package-lock.json (v10.0.1) does not match the release tag (v9.2.0)" "${lines[0]}" } @test "deploy to prod environment triggered by dispatch" { # always uses version from package-lock.json when triggered by a dispatch - run ./scripts/app-workflows/get-version.sh prod false v9.2.0 1234567890ABCDEF "$package_lock_file" + run ./.github/workflows/scripts/app-workflows/get-version.sh prod false v9.2.0 1234567890ABCDEF "$package_lock_file" test_value 0 "$status" test_value "get-version.sh -> outputs -> version: v10.0.1" "${lines[0]}" test_value "v10.0.1" "${lines[1]}" } @test "invalid deploy environment" { - run ./scripts/app-workflows/get-version.sh BAD_ENV false v9.2.0 1234567890ABCDEF "$package_lock_file" + run ./.github/workflows/scripts/app-workflows/get-version.sh BAD_ENV false v9.2.0 1234567890ABCDEF "$package_lock_file" test_value 1 "$status" test_value "Invalid deploy environment: BAD_ENV. Must be 'dev' or 'prod'" "${lines[0]}" } diff --git a/tests/scripts/app-workflows/test_helpers.bash b/.github/workflows/tests/scripts/app-workflows/test_helpers.bash similarity index 100% rename from tests/scripts/app-workflows/test_helpers.bash rename to .github/workflows/tests/scripts/app-workflows/test_helpers.bash