From c149b2d1d502dd9db37fe896dee516b059c07c9e Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Wed, 6 Mar 2024 12:46:16 -0500 Subject: [PATCH 01/13] Update CLI to use ginkgo v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add user agent info for plugin api calls - Newer lager was needed with newer diego-ssh * Replace depracted ginkgo calls with non deprecated calls * Remove ACK_GINKGO_RC * Desperate attempt at resolving output issue by using serial decorator and using non deprecated pty * Turn off Gingkno v2 parallel mode * Adjust integration tests to use ginkgo v2 * Add Byte to lograte, disk and memory regexes used by int tests --------- Co-authored-by: M. Oleske Co-authored-by: Al Berez Co-authored-by: Cristhian Peña Co-authored-by: Marc Paquette --- .github/workflows/tests-integration-reusable.yml | 4 ++-- integration/v7/isolated/buildpacks_command_test.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 856e88ee585..ba7758ebacc 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -32,7 +32,7 @@ jobs: runs-on: ${{ inputs.os }} steps: - - uses: LouisBrunner/checks-action@v2.0.0 + - uses: LouisBrunner/checks-action@v1.6.2 if: always() id: check with: @@ -301,7 +301,7 @@ jobs: grep -q -E "HTTP/[[:digit:]\.]{1,3} 404" headers.txt && echo $(echo "$output" | jq '.messages | join(", ")') && exit 2 grep -q -E "HTTP/[[:digit:]\.]{1,3} 202" headers.txt && break done - - uses: LouisBrunner/checks-action@v2.0.0 + - uses: LouisBrunner/checks-action@v1.6.2 if: always() with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/integration/v7/isolated/buildpacks_command_test.go b/integration/v7/isolated/buildpacks_command_test.go index 9ddcd47bd9e..e7ced44ca87 100644 --- a/integration/v7/isolated/buildpacks_command_test.go +++ b/integration/v7/isolated/buildpacks_command_test.go @@ -59,6 +59,7 @@ var _ = Describe("buildpacks command", func() { enabledRegex := `true` lockedRegex := `false` stackRegex := `(cflinuxfs[234]|windows.+)` + stateRegex := `READY` staticfileNameRegex := `staticfile_buildpack` // staticfileFileRegex := `staticfile[-_]buildpack-\S+` From fed55284f2884ee2393a7feca819829cd270d7c2 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Wed, 6 Mar 2024 12:56:39 -0500 Subject: [PATCH 02/13] Workflow run changes --- .../workflows/tests-integration-reusable.yml | 38 +++++++++---------- .github/workflows/tests-integration.yml | 21 +++++----- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index ba7758ebacc..7e195ca399f 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -32,16 +32,16 @@ jobs: runs-on: ${{ inputs.os }} steps: - - uses: LouisBrunner/checks-action@v1.6.2 - if: always() - id: check - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: "${{ inputs.name }}" - status: in_progress - sha: ${{github.event.workflow_run.head_sha}} - output: | - {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + # - uses: LouisBrunner/checks-action@v1.6.2 + # if: always() + # id: check + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # name: "${{ inputs.name }}" + # status: in_progress + # sha: ${{github.event.workflow_run.head_sha}} + # output: | + # {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} - name: Checkout cli uses: actions/checkout@v4 with: @@ -301,12 +301,12 @@ jobs: grep -q -E "HTTP/[[:digit:]\.]{1,3} 404" headers.txt && echo $(echo "$output" | jq '.messages | join(", ")') && exit 2 grep -q -E "HTTP/[[:digit:]\.]{1,3} 202" headers.txt && break done - - uses: LouisBrunner/checks-action@v1.6.2 - if: always() - with: - token: ${{ secrets.GITHUB_TOKEN }} - check_id: ${{ steps.check.outputs.check_id }} - conclusion: ${{ job.status }} - sha: ${{github.event.workflow_run.head_sha}} - output: | - {"title": "${{ inputs.name }}", "summary":"finished ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + # - uses: LouisBrunner/checks-action@v1.6.2 + # if: always() + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # check_id: ${{ steps.check.outputs.check_id }} + # conclusion: ${{ job.status }} + # sha: ${{github.event.workflow_run.head_sha}} + # output: | + # {"title": "${{ inputs.name }}", "summary":"finished ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 270e87cd38a..06def32edc8 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -1,19 +1,22 @@ name: "Tests: Integration" -run-name: "Integration [${{ github.event.workflow_run.head_branch }}]: ${{ github.event.workflow_run.head_commit.message }}" +# run-name: "Integration [${{ github.event.workflow_run.head_branch }}]: ${{ github.event.workflow_run.head_commit.message }}" on: workflow_dispatch: - workflow_run: - workflows: - - "Tests" - types: - - completed + push: + branches: + - v7 + # workflow_run: + # workflows: + # - "Tests" + # types: + # - completed jobs: run-integration-tests-cf-env: name: Integration tests - if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge @@ -24,7 +27,7 @@ jobs: run-integration-tests-cf-env-with-client-creds: name: client creds - if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge @@ -35,7 +38,7 @@ jobs: run-integration-tests-cf-env-with-min-capi: name: MIN CAPI - if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: min From 8411691763035ae7148b571e232ca079d230449e Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Wed, 6 Mar 2024 13:39:26 -0500 Subject: [PATCH 03/13] Fix tests --- integration/v7/isolated/buildpacks_command_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/integration/v7/isolated/buildpacks_command_test.go b/integration/v7/isolated/buildpacks_command_test.go index e7ced44ca87..9ddcd47bd9e 100644 --- a/integration/v7/isolated/buildpacks_command_test.go +++ b/integration/v7/isolated/buildpacks_command_test.go @@ -59,7 +59,6 @@ var _ = Describe("buildpacks command", func() { enabledRegex := `true` lockedRegex := `false` stackRegex := `(cflinuxfs[234]|windows.+)` - stateRegex := `READY` staticfileNameRegex := `staticfile_buildpack` // staticfileFileRegex := `staticfile[-_]buildpack-\S+` From 70522b783150f28145d3274a0ddb52cbc6b2fc23 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Wed, 6 Mar 2024 15:42:38 -0500 Subject: [PATCH 04/13] Undo workflow changes --- .../workflows/tests-integration-reusable.yml | 38 +++++++++---------- .github/workflows/tests-integration.yml | 19 ++++------ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 7e195ca399f..ba7758ebacc 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -32,16 +32,16 @@ jobs: runs-on: ${{ inputs.os }} steps: - # - uses: LouisBrunner/checks-action@v1.6.2 - # if: always() - # id: check - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # name: "${{ inputs.name }}" - # status: in_progress - # sha: ${{github.event.workflow_run.head_sha}} - # output: | - # {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + - uses: LouisBrunner/checks-action@v1.6.2 + if: always() + id: check + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: "${{ inputs.name }}" + status: in_progress + sha: ${{github.event.workflow_run.head_sha}} + output: | + {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} - name: Checkout cli uses: actions/checkout@v4 with: @@ -301,12 +301,12 @@ jobs: grep -q -E "HTTP/[[:digit:]\.]{1,3} 404" headers.txt && echo $(echo "$output" | jq '.messages | join(", ")') && exit 2 grep -q -E "HTTP/[[:digit:]\.]{1,3} 202" headers.txt && break done - # - uses: LouisBrunner/checks-action@v1.6.2 - # if: always() - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # check_id: ${{ steps.check.outputs.check_id }} - # conclusion: ${{ job.status }} - # sha: ${{github.event.workflow_run.head_sha}} - # output: | - # {"title": "${{ inputs.name }}", "summary":"finished ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + - uses: LouisBrunner/checks-action@v1.6.2 + if: always() + with: + token: ${{ secrets.GITHUB_TOKEN }} + check_id: ${{ steps.check.outputs.check_id }} + conclusion: ${{ job.status }} + sha: ${{github.event.workflow_run.head_sha}} + output: | + {"title": "${{ inputs.name }}", "summary":"finished ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 06def32edc8..b36018a6501 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -4,19 +4,16 @@ name: "Tests: Integration" on: workflow_dispatch: - push: - branches: - - v7 - # workflow_run: - # workflows: - # - "Tests" - # types: - # - completed + workflow_run: + workflows: + - "Tests" + types: + - completed jobs: run-integration-tests-cf-env: name: Integration tests - # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge @@ -27,7 +24,7 @@ jobs: run-integration-tests-cf-env-with-client-creds: name: client creds - # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge @@ -38,7 +35,7 @@ jobs: run-integration-tests-cf-env-with-min-capi: name: MIN CAPI - # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: min From f5530608a2ec9362dca2566f32da5ac0f3fd75cc Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Tue, 12 Mar 2024 10:59:42 -0400 Subject: [PATCH 05/13] Update checks-action version --- .github/workflows/tests-integration-reusable.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index ba7758ebacc..856e88ee585 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -32,7 +32,7 @@ jobs: runs-on: ${{ inputs.os }} steps: - - uses: LouisBrunner/checks-action@v1.6.2 + - uses: LouisBrunner/checks-action@v2.0.0 if: always() id: check with: @@ -301,7 +301,7 @@ jobs: grep -q -E "HTTP/[[:digit:]\.]{1,3} 404" headers.txt && echo $(echo "$output" | jq '.messages | join(", ")') && exit 2 grep -q -E "HTTP/[[:digit:]\.]{1,3} 202" headers.txt && break done - - uses: LouisBrunner/checks-action@v1.6.2 + - uses: LouisBrunner/checks-action@v2.0.0 if: always() with: token: ${{ secrets.GITHUB_TOKEN }} From f390fa9a3162b2cf044fd751bb0e4e5e323814df Mon Sep 17 00:00:00 2001 From: Al Berez Date: Fri, 22 Mar 2024 18:33:11 -0700 Subject: [PATCH 06/13] Reverted change with run-name --- .github/workflows/tests-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index b36018a6501..270e87cd38a 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -1,6 +1,6 @@ name: "Tests: Integration" -# run-name: "Integration [${{ github.event.workflow_run.head_branch }}]: ${{ github.event.workflow_run.head_commit.message }}" +run-name: "Integration [${{ github.event.workflow_run.head_branch }}]: ${{ github.event.workflow_run.head_commit.message }}" on: workflow_dispatch: From f4ae513ab1341400f82bb9c67337dff8fc74f07e Mon Sep 17 00:00:00 2001 From: Al Berez Date: Fri, 22 Mar 2024 18:41:32 -0700 Subject: [PATCH 07/13] Go mod tidy --- .github/workflows/release-build-sign-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-build-sign-upload.yml b/.github/workflows/release-build-sign-upload.yml index 65fac808e59..ed5704d6ee5 100644 --- a/.github/workflows/release-build-sign-upload.yml +++ b/.github/workflows/release-build-sign-upload.yml @@ -78,7 +78,7 @@ jobs: setup: name: Setup - # needs: test + if: github.triggering_actor.role == 'Write' runs-on: ubuntu-latest outputs: From 06b06d2925679010274993be7ba8f6c72aacba8d Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Fri, 26 Apr 2024 13:57:05 -0400 Subject: [PATCH 08/13] Shepherd migration (#13) Use shepherd environments instead of toolsmiths to run integration tests. As part of this change, min capi job is disabled since we are still figuring out our versioning policy of how long CLI should support an old version of CAPI. --- .../workflows/tests-integration-reusable.yml | 99 +++++++++---------- .github/workflows/tests-integration.yml | 20 ++-- 2 files changed, 58 insertions(+), 61 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 856e88ee585..67aa8e95c86 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -2,9 +2,8 @@ # secrets.CLIENT_SECRET # secrets.GITHUB_TOKEN -# secrets.TOOLSMITHS_API_TOKEN -# vars.TOOLSMITHS_HOSTNAME -# vars.TOOLSMITHS_POOL_NAME +# secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN +# vars.SHEPHERD_POOL_NAME name: "pvt: run integration tests" @@ -30,7 +29,7 @@ jobs: run: shell: bash runs-on: ${{ inputs.os }} - + container: us-west2-docker.pkg.dev/shepherd-268822/shepherd2/concourse-resource:latest steps: - uses: LouisBrunner/checks-action@v2.0.0 if: always() @@ -42,6 +41,7 @@ jobs: sha: ${{github.event.workflow_run.head_sha}} output: | {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + - name: Checkout cli uses: actions/checkout@v4 with: @@ -56,6 +56,8 @@ jobs: - id: read-min-capi name: Read MIN CAPI run: | + wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\ + chmod +x /usr/bin/yq version=$(yq '.capi-version-min' build_data.yml) echo "version=$version" >> $GITHUB_OUTPUT @@ -80,38 +82,36 @@ jobs: repository: cloudfoundry/cf-deployment-concourse-tasks path: cf-deployment-concourse-tasks - - id: claim-toolsmiths-env - name: Claim Toolsmiths Environment + - id: claim-env + name: Claim Environment env: - api_token: ${{ secrets.TOOLSMITHS_API_TOKEN }} - hostname: ${{ vars.TOOLSMITHS_HOSTNAME }} - notes: "GHA CF CLI Integration Tests ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - pool_name: ${{ vars.TOOLSMITHS_POOL_NAME }} + account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} + pool_name: ${{ vars.SHEPHERD_POOL_NAME }} run: | - while true; do - curl -s --show-error -D headers.txt -H 'Accept: application/json' \ - -X POST "https://${hostname}/pooled_gcp_engineering_environments/claim" \ - --data-urlencode "api_token=${api_token}" \ - --data-urlencode "pool_name=${pool_name}" \ - --data-urlencode "notes=${notes}" > metadata.json \ - || echo "Unable to reach server, trying again in 30 seconds..." - - cat headers.txt - - ERR_500="Sorry, the Toolsmiths Environments app is currently encountering issues. Trying again in 30 seconds..." - ERR_429="Sorry, Toolsmiths are out of environments in your requested pool. New environments are on their way but you can stop by the Toolsmiths slack channel for more help." - ERR_409="Sorry, was not able to claim an environment. Trying again in 30 seconds..." - - grep -q -E "HTTP/[[:digit:]\.]{1,3} 401" headers.txt && exit 1 - grep -q -E "HTTP/[[:digit:]\.]{1,3} 404" headers.txt && exit 2 - grep -q -E "HTTP/[[:digit:]\.]{1,3} 500" headers.txt && echo "$ERR_500" - grep -q -E "HTTP/[[:digit:]\.]{1,3} 200" headers.txt && break - grep -q -E "HTTP/[[:digit:]\.]{1,3} 429" && echo "$ERR_429" - grep -q -E "HTTP/[[:digit:]\.]{1,3} 409" && echo "$ERR_409" + shepherd login service-account ${account_token} + lease_id=$(shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace official --namespace tas-devex --json | jq -r .id) + # Give somtime for the lease to complete. Shepherd may take upto an 3 hours to create an env + # if the pool is empty. + count=0 + while [ $count -lt 360 ] ; do sleep 30 + status=$(shepherd get lease ${lease_id} --namespace tas-devex --json | jq -r .status) + if [ $status == "LEASED" ] ; then + shepherd get lease ${lease_id} --namespace tas-devex --json | jq .output > metadata.json + break + elif [ $status == "FAILED" -o $status == "EXPIRED" ] ; then + echo "There was an error obtaining the lease. Lease status is ${status}." + exit 1 + else + echo "Waiting for environment to be ready. Lease status is ${status}." + fi + count=$(($count+1)) done + + env_name=$(jq -r .name metadata.json) cat metadata.json | jq -r '.name' + echo "lease-id=$lease_id" >> "${GITHUB_OUTPUT}" - name: Install Tools run: | @@ -141,11 +141,16 @@ jobs: chmod +x $install_location/credhub credhub --version + apt-get update + apt-get install -y build-essential + - name: Deploy Isolation Segment and OIDC Provider if: ${{ inputs.capi-version == 'edge' }} env: CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} run: | + env_name=$(jq -r .name metadata.json) + jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv eval "$(bbl print-env --metadata-file metadata.json)" # deploy @@ -182,6 +187,8 @@ jobs: cp cli-ci/ci/infrastructure/operations/use-latest-ruby-buildpack.yml ops-files/ # Deletes CF-D + env_name=$(jq -r .name metadata.json) + jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv eval "$(bbl print-env --metadata-file metadata.json)" bosh -d cf delete-deployment -n @@ -225,11 +232,13 @@ jobs: if: ${{ !inputs.run-with-client-creds }} run: | ENV=$(cat metadata.json | jq -r '.name') + jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${ENV}.priv eval "$(bbl print-env --metadata-file ./metadata.json)" export CF_INT_PASSWORD="$(credhub get -n /bosh-$ENV/cf/cf_admin_password | bosh interpolate --path /value -)" export CF_INT_OIDC_USERNAME="admin-oidc" export CF_INT_OIDC_PASSWORD=$(credhub get -n /bosh-$ENV/cf/uaa_oidc_admin_password | bosh interpolate --path /value -) - export CF_INT_API="https://api.${ENV}.cf-app.com" + API_URL="$(jq -r .cf.api_url metadata.json)" + export CF_INT_API="https://$API_URL" export CF_DIAL_TIMEOUT=15 export CF_USERNAME=admin export FLAKE_ATTEMPTS=2 @@ -255,11 +264,13 @@ jobs: CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} run: | ENV=$(cat metadata.json | jq -r '.name') + jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${ENV}.priv eval "$(bbl print-env --metadata-file ./metadata.json)" export CF_INT_PASSWORD="$(credhub get -n /bosh-$ENV/cf/cf_admin_password | bosh interpolate --path /value -)" export CF_INT_OIDC_USERNAME="admin-oidc" export CF_INT_OIDC_PASSWORD=$(credhub get -n /bosh-$ENV/cf/uaa_oidc_admin_password | bosh interpolate --path /value -) - export CF_INT_API="https://api.${ENV}.cf-app.com" + API_URL="$(jq -r .cf.api_url metadata.json)" + export CF_INT_API="https://$API_URL" export CF_DIAL_TIMEOUT=15 export CF_USERNAME=admin export FLAKE_ATTEMPTS=2 @@ -278,29 +289,15 @@ jobs: make integration-tests-full-ci - - name: Unclaim environment if: always() env: - api_token: ${{ secrets.TOOLSMITHS_API_TOKEN }} - hostname: ${{ vars.TOOLSMITHS_HOSTNAME }} + account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} run: | - ENV=$(cat metadata.json | jq -r '.name') - while true; do - output=$(curl -s --show-error -D headers.txt -H 'Accept: application/json' \ - -X POST "https://${hostname}/pooled_gcp_engineering_environments/unclaim" \ - --data-urlencode "api_token=${api_token}" \ - --data-urlencode "name=${ENV}") - - cat headers.txt - - ERR_500="Sorry, the Toolsmiths Environments app is currently encountering issues. Trying again in 30 seconds..." - - grep -q -E "HTTP/[[:digit:]\.]{1,3} 500" headers.txt && echo "$ERR_500" && sleep 30 && continue - grep -q -E "HTTP/[[:digit:]\.]{1,3} 401" headers.txt && echo $(echo "$output" | jq '.messages | join(", ")') && exit 1 - grep -q -E "HTTP/[[:digit:]\.]{1,3} 404" headers.txt && echo $(echo "$output" | jq '.messages | join(", ")') && exit 2 - grep -q -E "HTTP/[[:digit:]\.]{1,3} 202" headers.txt && break - done + shepherd login service-account ${account_token} + set -x + shepherd delete lease ${{ steps.claim-env.outputs.lease-id }} --namespace tas-devex + - uses: LouisBrunner/checks-action@v2.0.0 if: always() with: diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 270e87cd38a..b49c93963c7 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -33,16 +33,16 @@ jobs: name: Integration client creds secrets: inherit - run-integration-tests-cf-env-with-min-capi: - name: MIN CAPI - if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} - uses: ./.github/workflows/tests-integration-reusable.yml - with: - capi-version: min - run-with-client-creds: false - os: ubuntu-latest - name: Integration MIN CAPI - secrets: inherit + # run-integration-tests-cf-env-with-min-capi: + # name: MIN CAPI + # # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + # uses: ./.github/workflows/tests-integration-reusable.yml + # with: + # capi-version: min + # run-with-client-creds: false + # os: ubuntu-latest + # name: Integration MIN CAPI + # secrets: inherit #run-integration-windows: # name: Windows From 7924fa2332b85431ce84993a5a57b9cc7b9cc223 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Fri, 26 Apr 2024 14:06:28 -0400 Subject: [PATCH 09/13] Update go sum --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 9b17a75b81c..8b2e6f5d85d 100644 --- a/go.sum +++ b/go.sum @@ -185,8 +185,6 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= -github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= -github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk= github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= From 0fb591c417e93a84024ee7d420e4507a3bd76532 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Fri, 26 Apr 2024 15:37:56 -0400 Subject: [PATCH 10/13] Test v7 --- .../workflows/tests-integration-reusable.yml | 38 +++++++++---------- .github/workflows/tests-integration.yml | 16 ++++---- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 67aa8e95c86..16543571f8d 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -31,16 +31,16 @@ jobs: runs-on: ${{ inputs.os }} container: us-west2-docker.pkg.dev/shepherd-268822/shepherd2/concourse-resource:latest steps: - - uses: LouisBrunner/checks-action@v2.0.0 - if: always() - id: check - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: "${{ inputs.name }}" - status: in_progress - sha: ${{github.event.workflow_run.head_sha}} - output: | - {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + # - uses: LouisBrunner/checks-action@v2.0.0 + # if: always() + # id: check + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # name: "${{ inputs.name }}" + # status: in_progress + # sha: ${{github.event.workflow_run.head_sha}} + # output: | + # {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} - name: Checkout cli uses: actions/checkout@v4 @@ -298,12 +298,12 @@ jobs: set -x shepherd delete lease ${{ steps.claim-env.outputs.lease-id }} --namespace tas-devex - - uses: LouisBrunner/checks-action@v2.0.0 - if: always() - with: - token: ${{ secrets.GITHUB_TOKEN }} - check_id: ${{ steps.check.outputs.check_id }} - conclusion: ${{ job.status }} - sha: ${{github.event.workflow_run.head_sha}} - output: | - {"title": "${{ inputs.name }}", "summary":"finished ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + # - uses: LouisBrunner/checks-action@v2.0.0 + # if: always() + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # check_id: ${{ steps.check.outputs.check_id }} + # conclusion: ${{ job.status }} + # sha: ${{github.event.workflow_run.head_sha}} + # output: | + # {"title": "${{ inputs.name }}", "summary":"finished ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index b49c93963c7..d8b94f3d319 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -1,19 +1,19 @@ name: "Tests: Integration" -run-name: "Integration [${{ github.event.workflow_run.head_branch }}]: ${{ github.event.workflow_run.head_commit.message }}" +# run-name: "Integration [${{ github.event.workflow_run.head_branch }}]: ${{ github.event.workflow_run.head_commit.message }}" on: workflow_dispatch: - workflow_run: - workflows: - - "Tests" - types: - - completed + # workflow_run: + # workflows: + # - "Tests" + # types: + # - completed jobs: run-integration-tests-cf-env: name: Integration tests - if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge @@ -24,7 +24,7 @@ jobs: run-integration-tests-cf-env-with-client-creds: name: client creds - if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge From ee9ba54cb52dabab904419375cc19283d02e4762 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Mon, 29 Apr 2024 09:49:40 -0400 Subject: [PATCH 11/13] Enable event check --- .../workflows/tests-integration-reusable.yml | 38 +++++++++---------- .github/workflows/tests-integration.yml | 16 ++++---- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 16543571f8d..67aa8e95c86 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -31,16 +31,16 @@ jobs: runs-on: ${{ inputs.os }} container: us-west2-docker.pkg.dev/shepherd-268822/shepherd2/concourse-resource:latest steps: - # - uses: LouisBrunner/checks-action@v2.0.0 - # if: always() - # id: check - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # name: "${{ inputs.name }}" - # status: in_progress - # sha: ${{github.event.workflow_run.head_sha}} - # output: | - # {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + - uses: LouisBrunner/checks-action@v2.0.0 + if: always() + id: check + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: "${{ inputs.name }}" + status: in_progress + sha: ${{github.event.workflow_run.head_sha}} + output: | + {"title": "${{ inputs.name }}", "summary":"started ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} - name: Checkout cli uses: actions/checkout@v4 @@ -298,12 +298,12 @@ jobs: set -x shepherd delete lease ${{ steps.claim-env.outputs.lease-id }} --namespace tas-devex - # - uses: LouisBrunner/checks-action@v2.0.0 - # if: always() - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # check_id: ${{ steps.check.outputs.check_id }} - # conclusion: ${{ job.status }} - # sha: ${{github.event.workflow_run.head_sha}} - # output: | - # {"title": "${{ inputs.name }}", "summary":"finished ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} + - uses: LouisBrunner/checks-action@v2.0.0 + if: always() + with: + token: ${{ secrets.GITHUB_TOKEN }} + check_id: ${{ steps.check.outputs.check_id }} + conclusion: ${{ job.status }} + sha: ${{github.event.workflow_run.head_sha}} + output: | + {"title": "${{ inputs.name }}", "summary":"finished ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index d8b94f3d319..b49c93963c7 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -1,19 +1,19 @@ name: "Tests: Integration" -# run-name: "Integration [${{ github.event.workflow_run.head_branch }}]: ${{ github.event.workflow_run.head_commit.message }}" +run-name: "Integration [${{ github.event.workflow_run.head_branch }}]: ${{ github.event.workflow_run.head_commit.message }}" on: workflow_dispatch: - # workflow_run: - # workflows: - # - "Tests" - # types: - # - completed + workflow_run: + workflows: + - "Tests" + types: + - completed jobs: run-integration-tests-cf-env: name: Integration tests - # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge @@ -24,7 +24,7 @@ jobs: run-integration-tests-cf-env-with-client-creds: name: client creds - # if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge From 601898334bda67cd080994789b09655a2b4a58c9 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Mon, 29 Apr 2024 09:51:58 -0400 Subject: [PATCH 12/13] Reset release file --- .github/workflows/release-build-sign-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-build-sign-upload.yml b/.github/workflows/release-build-sign-upload.yml index ed5704d6ee5..65fac808e59 100644 --- a/.github/workflows/release-build-sign-upload.yml +++ b/.github/workflows/release-build-sign-upload.yml @@ -78,7 +78,7 @@ jobs: setup: name: Setup - if: github.triggering_actor.role == 'Write' + # needs: test runs-on: ubuntu-latest outputs: From 50917cbccf7db03e24f23030b215033e45e9d623 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Tue, 30 Apr 2024 12:40:47 -0400 Subject: [PATCH 13/13] Remove unused import (windows) (#16) Remove unused imports --- actor/pushaction/command_line_settings_windows_test.go | 1 - .../merge_and_validate_settings_and_manifest_windows_test.go | 1 - 2 files changed, 2 deletions(-) diff --git a/actor/pushaction/command_line_settings_windows_test.go b/actor/pushaction/command_line_settings_windows_test.go index 9057d6a7407..3def2082921 100644 --- a/actor/pushaction/command_line_settings_windows_test.go +++ b/actor/pushaction/command_line_settings_windows_test.go @@ -8,7 +8,6 @@ import ( "code.cloudfoundry.org/cli/util/manifest" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/ginkgo/v2/extensions/table" . "github.com/onsi/gomega" ) diff --git a/actor/pushaction/merge_and_validate_settings_and_manifest_windows_test.go b/actor/pushaction/merge_and_validate_settings_and_manifest_windows_test.go index 6163faf71a3..94f753d0290 100644 --- a/actor/pushaction/merge_and_validate_settings_and_manifest_windows_test.go +++ b/actor/pushaction/merge_and_validate_settings_and_manifest_windows_test.go @@ -11,7 +11,6 @@ import ( "code.cloudfoundry.org/cli/util/manifest" . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/ginkgo/v2/extensions/table" . "github.com/onsi/gomega" )