From 97e120b9d39e27a1e77e415d65098eb016f7ace3 Mon Sep 17 00:00:00 2001 From: AL Berez Date: Mon, 7 Oct 2024 13:05:01 -0700 Subject: [PATCH 01/29] Switch environment to cfd-bosh-lite - fix output field --- .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 f88e9d9072b..25f13c39f5a 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -119,7 +119,7 @@ jobs: echo "env name is ${env_name}" echo "leaseid=${lease_id}" >> "${GITHUB_OUTPUT}" - cf_deployment_version=$(jq -r '."cf-deployment_version"' metadata.json) + cf_deployment_version=$(jq -r '."cf_deployment_version"' metadata.json) echo "cf_deployment_version is ${cf_deployment_version}" echo "cf_deployment_version=${cf_deployment_version}" >> "${GITHUB_OUTPUT}" From bdff0b2f101185671b42e851c57835771d56a226 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Wed, 9 Oct 2024 10:25:02 -0700 Subject: [PATCH 02/29] Turn off set_kernel_parameters to use cfd-bosh-lite Since on bosh-lite the jobs run within non-privileged garden containers they do not have permission to set kernel parameters on the host. --- .github/ops-files/diego-cell-instances.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/ops-files/diego-cell-instances.yml b/.github/ops-files/diego-cell-instances.yml index 19ea43d8077..6fff5cd2232 100644 --- a/.github/ops-files/diego-cell-instances.yml +++ b/.github/ops-files/diego-cell-instances.yml @@ -2,3 +2,7 @@ - type: replace path: /instance_groups/name=diego-cell/instances value: 4 + +- type: replace + path: /instance_groups/name=isolated-diego-cell/jobs/name=rep/properties?/set_kernel_parameters + value: false From a60f40119d340695a01aa9b2b639ee6bbca00319 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Wed, 9 Oct 2024 11:57:10 -0700 Subject: [PATCH 03/29] Expose shepherd configuration via repo variables - refactor --- .github/workflows/tests-integration.yml | 35 ++++++++++++++++++------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 25f13c39f5a..1c3bbd3aab5 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -88,23 +88,39 @@ jobs: - name: claim id: claim env: - account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} - pool_name: ${{ vars.SHEPHERD_POOL_NAME }} - pool_namespace: official + account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} + pool_name: ${{ vars.SHEPHERD_POOL_NAME }} + pool_duration: ${{ vars.SHEPHERD_POOL_DURATION || '8h' }} + pool_namespace: ${{ vars.SHEPHERD_POOL_NAMESPACE || 'official' }} + namespace: ${{ vars.POOL_NAMESPACE || 'tas-devex' }} run: | shepherd login service-account ${account_token} - echo "shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace ${pool_namespace} --namespace tas-devex --description 'CLI GHA'" - lease_id=$(shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace ${pool_namespace} --namespace tas-devex --json | jq -r .id) + lease_id=$( shepherd create lease \ + --duration ${pool_duration} \ + --pool ${pool_name} \ + --pool-namespace ${pool_namespace} \ + --namespace ${namespace} \ + --description "Claimed by CF CLI workflow ${{ github.workflow_run.url }}" \ + --json \ + | jq -r .id + ) # Give sometime 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) + status=$( shepherd get lease ${lease_id} \ + --namespace ${namespace} \ + --json \ + | jq -r .status + ) if [ $status == "LEASED" ] ; then - shepherd get lease ${lease_id} --namespace tas-devex --json | jq .output > metadata.json + shepherd get lease ${lease_id} \ + --namespace ${namespace} \ + --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}." @@ -250,12 +266,13 @@ jobs: needs: - claim-env - run-cats-cf-env - if: always() steps: - name: unclaim env: account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} + namespace: ${{ vars.POOL_NAMESPACE || 'tas-devex' }} run: | shepherd login service-account ${account_token} set -x - shepherd delete lease ${{ needs.claim-env.outputs.leaseid }} --namespace tas-devex + shepherd delete lease ${{ needs.claim-env.outputs.leaseid }} \ + --namespace ${namespace} From f882d5ac2b6173de632849121a265e86be4dc25b Mon Sep 17 00:00:00 2001 From: Al Berez Date: Tue, 15 Oct 2024 09:56:31 -0700 Subject: [PATCH 04/29] Update secrets path to bosh-lite --- .../workflows/tests-integration-reusable.yml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index cf91d0beadc..a768f9259fc 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -102,16 +102,16 @@ jobs: run: | set -eu - ENV=$(jq -r .name metadata.json) + env_name=$(jq -r .name metadata.json) API="$(jq -r .cf.api_url metadata.json)" DOMAIN=$(echo $API | sed "s/^api\.//") CF_INT_USERNAME="admin" - jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${ENV}.priv + jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv eval "$(bbl print-env --metadata-file ./metadata.json)" credhub login - CF_INT_PASSWORD=$(credhub get -n /bosh-$ENV/cf/cf_admin_password | bosh interpolate --path /value -) + CF_INT_PASSWORD=$(credhub get -n /bosh-lite/cf/cf_admin_password | bosh interpolate --path /value -) cat << EOF | jq -S . > cats_config.json { @@ -193,12 +193,12 @@ jobs: - name: Run Integration Tests if: ${{ !inputs.run-with-client-creds && inputs.name != 'cats' }} run: | - ENV=$(cat metadata.json | jq -r '.name') - jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${ENV}.priv + env_name=$(cat metadata.json | jq -r '.name') + jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.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_PASSWORD="$(credhub get -n /bosh-lite/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_OIDC_PASSWORD=$(credhub get -n /bosh-lite/cf/uaa_oidc_admin_password | bosh interpolate --path /value -) API_URL="$(jq -r .cf.api_url metadata.json)" export CF_INT_API="https://$API_URL" export CF_DIAL_TIMEOUT=15 @@ -224,12 +224,12 @@ jobs: CF_INT_CLIENT_ID: 'potato-face' 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 + env_name=$(cat metadata.json | jq -r '.name') + jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.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_PASSWORD="$(credhub get -n /bosh-lite/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_OIDC_PASSWORD=$(credhub get -n /bosh-lite/cf/uaa_oidc_admin_password | bosh interpolate --path /value -) API_URL="$(jq -r .cf.api_url metadata.json)" export CF_INT_API="https://$API_URL" export CF_DIAL_TIMEOUT=15 From cfbf7c3cc235e6ddef1f973c7ef644cd557d2981 Mon Sep 17 00:00:00 2001 From: AL Berez Date: Tue, 15 Oct 2024 21:11:14 -0700 Subject: [PATCH 05/29] Control test NODES via variables --- .github/workflows/tests-integration-reusable.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index a768f9259fc..49fbbe5716c 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -25,7 +25,10 @@ on: gitRef: type: string default: ${{github.event.workflow_run.head_sha}} - + +env: + NODES: ${{ vars.TEST_NODES || '10' }} + jobs: run-integration-tests: defaults: From ca1c2f61e2b51589bbdc8c9ea3fa81dd7284737c Mon Sep 17 00:00:00 2001 From: AL Berez Date: Wed, 16 Oct 2024 13:28:16 -0700 Subject: [PATCH 06/29] Expose TEST_FLAKE_ATTEMPTS and TEST_NODES --- .github/workflows/tests-integration-reusable.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 49fbbe5716c..bb84cb30645 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -28,7 +28,7 @@ on: env: NODES: ${{ vars.TEST_NODES || '10' }} - + FLAKE_ATTEMPTS: ${{ vars.TEST_FLAKE_ATTEMPTS || '2' }} jobs: run-integration-tests: defaults: @@ -188,8 +188,8 @@ jobs: --keep-going \ --randomize-all \ --skip-package=helpers \ - --nodes="12" \ - --flake-attempts=2 \ + --nodes="${NODES}" \ + --flake-attempts=${FLAKE_ATTEMPTS} \ --timeout="2h" \ --no-color @@ -206,8 +206,6 @@ jobs: export CF_INT_API="https://$API_URL" export CF_DIAL_TIMEOUT=15 export CF_USERNAME=admin - export FLAKE_ATTEMPTS=2 - export NODES=16 export GOPATH=$PWD/go export PATH="$GOPATH/bin:$PATH" export PATH="$PWD/out:$PATH" @@ -237,8 +235,6 @@ jobs: export CF_INT_API="https://$API_URL" export CF_DIAL_TIMEOUT=15 export CF_USERNAME=admin - export FLAKE_ATTEMPTS=2 - export NODES=16 export GOPATH=$PWD/go export PATH="$GOPATH/bin:$PATH" export PATH="$PWD/out:$PATH" From e2357c6a0e3766a1963b3f67c845c6cd0890ce98 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Wed, 16 Oct 2024 19:17:57 -0700 Subject: [PATCH 07/29] Set default FLAKE_ATTEMPTS --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index dabbe1d5c76..55c9269533b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ CF_DIAL_TIMEOUT ?= 15 NODES ?= 10 +FLAKE_ATTEMPTS ?=5 PACKAGES ?= api actor command types util version integration/helpers LC_ALL = "en_US.UTF-8" From ba2930886be51630e378360e88a20a4e1df6e05e Mon Sep 17 00:00:00 2001 From: Al Berez Date: Thu, 17 Oct 2024 02:27:30 -0700 Subject: [PATCH 08/29] Bump gha test suit timeout from 60 to 120m --- .github/workflows/tests-integration-reusable.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index bb84cb30645..670ffd0f993 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -29,13 +29,15 @@ on: env: NODES: ${{ vars.TEST_NODES || '10' }} FLAKE_ATTEMPTS: ${{ vars.TEST_FLAKE_ATTEMPTS || '2' }} + jobs: run-integration-tests: defaults: run: shell: bash - runs-on: ${{ inputs.os }} + runs-on: ${{ inputs.os }} container: us-west2-docker.pkg.dev/shepherd-268822/shepherd2/concourse-resource:latest + timeout-minutes: 120 steps: - name: Checkout cli uses: actions/checkout@v4 From 2d1bd7b97d9e2147f8d8990887cd18952a2993d5 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Thu, 17 Oct 2024 02:40:54 -0700 Subject: [PATCH 09/29] Enter nodes as workflow_dispatch input --- .github/workflows/tests-integration-reusable.yml | 5 ++++- .github/workflows/tests-integration.yml | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 670ffd0f993..4d42026efa2 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -25,9 +25,12 @@ on: gitRef: type: string default: ${{github.event.workflow_run.head_sha}} + nodes: + type: number + default: 8 env: - NODES: ${{ vars.TEST_NODES || '10' }} + NODES: ${{ inputs.nodes }} FLAKE_ATTEMPTS: ${{ vars.TEST_FLAKE_ATTEMPTS || '2' }} jobs: diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 1c3bbd3aab5..9149bf3bc28 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -14,6 +14,12 @@ on: - run-integration-tests-cf-env - run-integration-tests-cf-env-with-client-creds - run-cats-cf-env + nodes: + description: Number of test nodes + required: false + type: number + default: 8 + push: tags: - "v8.*" @@ -224,6 +230,7 @@ jobs: name: Integration gitRef: ${{needs.get-sha.outputs.gitRef}} lease-id: ${{ needs.claim-env.outputs.leaseid }} + nodes: ${{ inputs.nodes }} secrets: inherit run-integration-tests-cf-env-with-client-creds: From 541c05dc346be922e3ec084b34e16666ee330d90 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Thu, 17 Oct 2024 07:09:22 -0700 Subject: [PATCH 10/29] Pass nodes parameter as a string --- .github/workflows/tests-integration-reusable.yml | 4 ++-- .github/workflows/tests-integration.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 4d42026efa2..29feecbdc8e 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -26,8 +26,8 @@ on: type: string default: ${{github.event.workflow_run.head_sha}} nodes: - type: number - default: 8 + type: string + default: "8" env: NODES: ${{ inputs.nodes }} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 9149bf3bc28..67cd4d5cc20 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -17,8 +17,8 @@ on: nodes: description: Number of test nodes required: false - type: number - default: 8 + type: string + default: "8" push: tags: From 097fd487e3c42c8c875749678accedddcc06fa15 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Thu, 17 Oct 2024 20:01:36 -0700 Subject: [PATCH 11/29] Skip steps if SHEPHERD_LEASE_ID defined --- .github/workflows/tests-integration.yml | 68 +++++++++++++++---------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 67cd4d5cc20..6120572be26 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -37,7 +37,12 @@ on: - ".grype.yaml" - ".git*" - ".golangci.json" + +env: + SHEPHERD_LEASE_ID: ${{ vars.SHEPHERD_LEASE_ID }} + jobs: + get-sha: runs-on: ubuntu-latest outputs: @@ -71,7 +76,10 @@ jobs: go-version-file: go.mod check-latest: true - name: Run Units - run: make units + run: | + if [[ -z $SHEPHERD_LEASE_ID ]]; then + make units + fi claim-env: name: Claim and Prep Environment @@ -102,16 +110,22 @@ jobs: run: | shepherd login service-account ${account_token} - lease_id=$( shepherd create lease \ - --duration ${pool_duration} \ - --pool ${pool_name} \ - --pool-namespace ${pool_namespace} \ - --namespace ${namespace} \ - --description "Claimed by CF CLI workflow ${{ github.workflow_run.url }}" \ - --json \ - | jq -r .id - ) - + if [[ -z $SHEPHERD_LEASE_ID ]]; then + lease_id=$( shepherd create lease \ + --duration ${pool_duration} \ + --pool ${pool_name} \ + --pool-namespace ${pool_namespace} \ + --namespace ${namespace} \ + --description "Claimed by CF CLI workflow ${{ github.workflow_run.url }}" \ + --json \ + | jq -r .id + ) + else + lease_id=$SHEPHERD_LEASE_ID + fi + + echo "Shepherd lease ID: ${lease_id}" + # Give sometime for the lease to complete. Shepherd may take upto an 3 hours to create an env # if the pool is empty. count=0 @@ -174,8 +188,7 @@ jobs: env: capi_release_version: ${{ vars.CAPI_RELEASE_VERSION }} run: | - if [ -z "$capi_release_version" ] - then + if [ -z "$capi_release_version" ]; then capi_release_version=$(curl -s https://api.github.com/repos/cloudfoundry/capi-release/releases/latest | jq -r .tag_name) fi @@ -185,7 +198,9 @@ jobs: env_name=$(jq -r .name metadata.json) jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv - bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version" + if [[ -z $SHEPHERD_LEASE_ID ]]; then + bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version" + fi - name: Checkout cf-deployment uses: actions/checkout@v4 @@ -200,19 +215,20 @@ jobs: jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv eval "$(bbl print-env --metadata-file metadata.json)" - # deploy - bosh -d cf manifest > /tmp/manifest.yml - bosh interpolate /tmp/manifest.yml \ - -o cf-deployment/operations/use-internal-lookup-for-route-services.yml \ - -o cf-deployment/operations/add-persistent-isolation-segment-diego-cell.yml \ - -o .github/ops-files/use-latest-capi.yml \ - -o .github/ops-files/add-oidc-provider.yml \ - -o .github/ops-files/add-uaa-client-credentials.yml \ - -o .github/ops-files/diego-cell-instances.yml \ - -v client-secret="${{ secrets.CLIENT_SECRET }}" \ - > ./director.yml + if [[ -z $SHEPHERD_LEASE_ID ]]; then + bosh -d cf manifest > /tmp/manifest.yml + bosh interpolate /tmp/manifest.yml \ + -o cf-deployment/operations/use-internal-lookup-for-route-services.yml \ + -o cf-deployment/operations/add-persistent-isolation-segment-diego-cell.yml \ + -o .github/ops-files/use-latest-capi.yml \ + -o .github/ops-files/add-oidc-provider.yml \ + -o .github/ops-files/add-uaa-client-credentials.yml \ + -o .github/ops-files/diego-cell-instances.yml \ + -v client-secret="${{ secrets.CLIENT_SECRET }}" \ + > ./director.yml - bosh -d cf deploy director.yml -n + bosh -d cf deploy director.yml -n + fi echo "Deployed CAPI version:" bosh -d cf releases | grep capi From 6717156615cf79c0b8516d73a8227480afe4efe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Fri, 18 Oct 2024 13:53:49 -0500 Subject: [PATCH 12/29] Skip scaling tests that are testing CAPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- integration/v7/isolated/scale_command_test.go | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/integration/v7/isolated/scale_command_test.go b/integration/v7/isolated/scale_command_test.go index 1774c1c39a8..f0bc26933d9 100644 --- a/integration/v7/isolated/scale_command_test.go +++ b/integration/v7/isolated/scale_command_test.go @@ -108,7 +108,7 @@ var _ = Describe("scale command", func() { helpers.WaitForAppMemoryToTakeEffect(appName, 0, 0, false, "1G") }) - When("scale option flags are not provided", func() { + XWhen("scale option flags are not provided", func() { It("displays the current scale properties for all processes", func() { session := helpers.CF("scale", appName) @@ -179,7 +179,17 @@ var _ = Describe("scale command", func() { }) }) - When("Scaling the memory", func() { + When("-f flag provided", func() { + It("scales without prompt", func() { + session := helpers.CF("scale", appName, "-m", "64M", "-f") + Eventually(session).Should(Exit(0)) + Expect(session).To(Say("Scaling app %s in org %s / space %s as %s...", appName, orgName, spaceName, userName)) + + helpers.WaitForAppMemoryToTakeEffect(appName, 0, 0, false, "64M") + }) + }) + + XWhen("Scaling the memory", func() { It("scales memory to 64M", func() { buffer := NewBuffer() _, err := buffer.Write([]byte("y\n")) @@ -194,7 +204,7 @@ var _ = Describe("scale command", func() { helpers.WaitForAppMemoryToTakeEffect(appName, 0, 0, false, "64M") }) - When("-f flag provided", func() { + XWhen("-f flag provided", func() { It("scales without prompt", func() { session := helpers.CF("scale", appName, "-m", "64M", "-f") Eventually(session).Should(Exit(0)) @@ -205,7 +215,7 @@ var _ = Describe("scale command", func() { }) }) - When("Scaling the disk space", func() { + XWhen("Scaling the disk space", func() { It("scales disk to 512M", func() { buffer := NewBuffer() _, err := buffer.Write([]byte("y\n")) @@ -221,7 +231,7 @@ var _ = Describe("scale command", func() { helpers.WaitForAppDiskToTakeEffect(appName, 0, 0, false, "512M") }) - When("-f flag provided", func() { + XWhen("-f flag provided", func() { It("scales without prompt", func() { session := helpers.CF("scale", appName, "-k", "512M", "-f") Eventually(session).Should(Exit(0)) @@ -232,7 +242,7 @@ var _ = Describe("scale command", func() { }) }) - When("Scaling the log rate limit", func() { + XWhen("Scaling the log rate limit", func() { BeforeEach(func() { helpers.SkipIfVersionLessThan(ccversion.MinVersionLogRateLimitingV3) }) @@ -252,7 +262,7 @@ var _ = Describe("scale command", func() { helpers.WaitForLogRateLimitToTakeEffect(appName, 0, 0, false, "1M") }) - When("-f flag provided", func() { + XWhen("-f flag provided", func() { It("scales without prompt", func() { session := helpers.CF("scale", appName, "-l", "1M", "-f") Eventually(session).Should(Exit(0)) From b2ce5d6d448207f7e4c7f2da5c1bf53a9c9cc8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Mon, 21 Oct 2024 10:01:37 -0500 Subject: [PATCH 13/29] bosh-light environment default memory is 256Mb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- integration/v7/isolated/scale_command_test.go | 4 ++-- integration/v7/isolated/start_command_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/v7/isolated/scale_command_test.go b/integration/v7/isolated/scale_command_test.go index f0bc26933d9..dbfc9af9cf2 100644 --- a/integration/v7/isolated/scale_command_test.go +++ b/integration/v7/isolated/scale_command_test.go @@ -105,7 +105,7 @@ var _ = Describe("scale command", func() { helpers.WithProcfileApp(func(appDir string) { Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, "push", appName)).Should(Exit(0)) }) - helpers.WaitForAppMemoryToTakeEffect(appName, 0, 0, false, "1G") + helpers.WaitForAppMemoryToTakeEffect(appName, 0, 0, false, "256M") }) XWhen("scale option flags are not provided", func() { @@ -162,7 +162,7 @@ var _ = Describe("scale command", func() { Consistently(session).ShouldNot(Say("Stopping")) Consistently(session).ShouldNot(Say("Starting")) - helpers.WaitForAppMemoryToTakeEffect(appName, 0, 0, true, "1G") + helpers.WaitForAppMemoryToTakeEffect(appName, 0, 0, true, "256M") session = helpers.CF("app", appName) Eventually(session).Should(Exit(0)) diff --git a/integration/v7/isolated/start_command_test.go b/integration/v7/isolated/start_command_test.go index f1dab044bda..fcb0d942e57 100644 --- a/integration/v7/isolated/start_command_test.go +++ b/integration/v7/isolated/start_command_test.go @@ -128,7 +128,7 @@ var _ = Describe("start command", func() { Eventually(session).Should(Say(`routes:\s+%s.%s`, appName, helpers.DefaultSharedDomain())) Eventually(session).Should(Say(`type:\s+web`)) Eventually(session).Should(Say(`instances:\s+1/1`)) - Eventually(session).Should(Say(`memory usage:\s+1024M`)) + Eventually(session).Should(Say(`memory usage:\s+256M`)) Eventually(session).Should(Say(`\s+state\s+since\s+cpu entitlement\s+memory\s+disk\s+logging\s+details`)) Eventually(session).Should(Say(`#0\s+(starting|running)\s+\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z`)) From c5fc522d87431dac9aada5e1c69faa4d4718a9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Mon, 21 Oct 2024 15:31:32 -0500 Subject: [PATCH 14/29] Expose as parameters to automate make runs easier to configure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/tests-integration.yml | 30 ++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 6120572be26..da87e18a344 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -19,6 +19,20 @@ on: required: false type: string default: "8" + lease_id: + description: When running in a pre-provisioned environment if the user provides the lease-id the workflow will not try to claim a new one + required: false + type: string + run_unit_tests: + description: allow users to skip running unit tests whe calling the workflow directly + required: false + type: boolean + default: true + reinstall_cfd: + description: When lease_id is provided the user can opt out of reinstalling CFD + required: false + type: boolean + default: true push: tags: @@ -39,7 +53,7 @@ on: - ".golangci.json" env: - SHEPHERD_LEASE_ID: ${{ vars.SHEPHERD_LEASE_ID }} + SHEPHERD_LEASE_ID: ${{ vars.SHEPHERD_LEASE_ID || inputs.lease_id }} jobs: @@ -62,6 +76,7 @@ jobs: fi units: name: Basic units to gate for integration tests + if: ${{ inputs.run_unit_tests == 'true' }} runs-on: ubuntu-latest needs: - get-sha @@ -76,10 +91,7 @@ jobs: go-version-file: go.mod check-latest: true - name: Run Units - run: | - if [[ -z $SHEPHERD_LEASE_ID ]]; then - make units - fi + run: make units claim-env: name: Claim and Prep Environment @@ -185,6 +197,7 @@ jobs: apt-get install -y build-essential unzip - name: Upload latest CAPI release + if: ${{ inputs.lease_id == '' || inputs.reinstall_cfd == 'true' }} env: capi_release_version: ${{ vars.CAPI_RELEASE_VERSION }} run: | @@ -198,11 +211,10 @@ jobs: env_name=$(jq -r .name metadata.json) jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv - if [[ -z $SHEPHERD_LEASE_ID ]]; then - bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version" - fi + bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version" - name: Checkout cf-deployment + if: ${{ inputs.lease_id == '' || inputs.reinstall_cfd == 'true' }} uses: actions/checkout@v4 with: repository: cloudfoundry/cf-deployment @@ -210,6 +222,7 @@ jobs: ref: ${{steps.claim.outputs.cf_deployment_version}} - name: Deploy Isolation Segment and OIDC Provider + if: ${{ inputs.lease_id == '' || inputs.reinstall_cfd == 'true' }} run: | env_name=$(jq -r .name metadata.json) jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv @@ -284,6 +297,7 @@ jobs: unclaim-env: name: Unclaim environment + if: ${{ inputs.lease_id == '' }} runs-on: ubuntu-latest container: us-west2-docker.pkg.dev/shepherd-268822/shepherd2/concourse-resource:latest needs: From 6fc60ab900e905a8985d5ec8331cb35821598993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Mon, 21 Oct 2024 17:00:51 -0500 Subject: [PATCH 15/29] Make options easier to understand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/tests-integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index da87e18a344..9a53b0f64f0 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -20,16 +20,16 @@ on: type: string default: "8" lease_id: - description: When running in a pre-provisioned environment if the user provides the lease-id the workflow will not try to claim a new one + description: Pre-provisioned environment lease-id to use in tests required: false type: string run_unit_tests: - description: allow users to skip running unit tests whe calling the workflow directly + description: Run unit tests required: false type: boolean default: true reinstall_cfd: - description: When lease_id is provided the user can opt out of reinstalling CFD + description: Force re-installation of CFD required: false type: boolean default: true From 55049bdb778de14ac31b08c0752e8a06f57c578d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Mon, 21 Oct 2024 17:06:43 -0500 Subject: [PATCH 16/29] units jobs needs to run always but steps could be conditional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/tests-integration.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 9a53b0f64f0..b4fbf057267 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -76,21 +76,23 @@ jobs: fi units: name: Basic units to gate for integration tests - if: ${{ inputs.run_unit_tests == 'true' }} runs-on: ubuntu-latest needs: - get-sha steps: - name: Checkout uses: actions/checkout@v4 + if: ${{ inputs.run_unit_tests == 'true' }} with: ref: ${{needs.get-sha.outputs.gitRef}} - name: Set Up Go uses: actions/setup-go@v5 + if: ${{ inputs.run_unit_tests == 'true' }} with: go-version-file: go.mod check-latest: true - name: Run Units + if: ${{ inputs.run_unit_tests == 'true' }} run: make units claim-env: From 825bce31b9f3ce377d6ab0d55633a08536dcd3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Mon, 21 Oct 2024 17:13:53 -0500 Subject: [PATCH 17/29] Fix boolean check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/tests-integration.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index b4fbf057267..29f8c8d0414 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -180,6 +180,7 @@ jobs: check-latest: true - name: Install Tools + if: ${{ (inputs.lease_id == '') || (inputs.reinstall_cfd == true) }} run: | go version @@ -199,7 +200,7 @@ jobs: apt-get install -y build-essential unzip - name: Upload latest CAPI release - if: ${{ inputs.lease_id == '' || inputs.reinstall_cfd == 'true' }} + if: ${{ (inputs.lease_id == '') || (inputs.reinstall_cfd == true) }} env: capi_release_version: ${{ vars.CAPI_RELEASE_VERSION }} run: | @@ -216,7 +217,7 @@ jobs: bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version" - name: Checkout cf-deployment - if: ${{ inputs.lease_id == '' || inputs.reinstall_cfd == 'true' }} + if: ${{ (inputs.lease_id == '') || (inputs.reinstall_cfd == true) }} uses: actions/checkout@v4 with: repository: cloudfoundry/cf-deployment @@ -224,7 +225,7 @@ jobs: ref: ${{steps.claim.outputs.cf_deployment_version}} - name: Deploy Isolation Segment and OIDC Provider - if: ${{ inputs.lease_id == '' || inputs.reinstall_cfd == 'true' }} + if: ${{ (inputs.lease_id == '') || (inputs.reinstall_cfd == true) }} run: | env_name=$(jq -r .name metadata.json) jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv From 080bc10ae4ee4bb9c9626f45effa3289832fdcc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Tue, 22 Oct 2024 09:21:25 -0500 Subject: [PATCH 18/29] Change order it gets the SHEPHERD_LEASE_ID from MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .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 29f8c8d0414..29108febcb8 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -53,7 +53,7 @@ on: - ".golangci.json" env: - SHEPHERD_LEASE_ID: ${{ vars.SHEPHERD_LEASE_ID || inputs.lease_id }} + SHEPHERD_LEASE_ID: ${{ inputs.lease_id || vars.SHEPHERD_LEASE_ID}} jobs: From 7fa6f9f5f9cd1cad6102cba7399dd8cec801c312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Tue, 22 Oct 2024 10:03:47 -0500 Subject: [PATCH 19/29] Fixed the issue with force update of bosh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/tests-integration.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 29108febcb8..23d06e425ea 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -231,20 +231,18 @@ jobs: jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv eval "$(bbl print-env --metadata-file metadata.json)" - if [[ -z $SHEPHERD_LEASE_ID ]]; then - bosh -d cf manifest > /tmp/manifest.yml - bosh interpolate /tmp/manifest.yml \ - -o cf-deployment/operations/use-internal-lookup-for-route-services.yml \ - -o cf-deployment/operations/add-persistent-isolation-segment-diego-cell.yml \ - -o .github/ops-files/use-latest-capi.yml \ - -o .github/ops-files/add-oidc-provider.yml \ - -o .github/ops-files/add-uaa-client-credentials.yml \ - -o .github/ops-files/diego-cell-instances.yml \ - -v client-secret="${{ secrets.CLIENT_SECRET }}" \ - > ./director.yml + bosh -d cf manifest > /tmp/manifest.yml + bosh interpolate /tmp/manifest.yml \ + -o cf-deployment/operations/use-internal-lookup-for-route-services.yml \ + -o cf-deployment/operations/add-persistent-isolation-segment-diego-cell.yml \ + -o .github/ops-files/use-latest-capi.yml \ + -o .github/ops-files/add-oidc-provider.yml \ + -o .github/ops-files/add-uaa-client-credentials.yml \ + -o .github/ops-files/diego-cell-instances.yml \ + -v client-secret="${{ secrets.CLIENT_SECRET }}" \ + > ./director.yml - bosh -d cf deploy director.yml -n - fi + bosh -d cf deploy director.yml -n echo "Deployed CAPI version:" bosh -d cf releases | grep capi From 9ef406418f71b4feec7c2d8724b9df01fa8ead4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Wed, 23 Oct 2024 11:12:07 -0500 Subject: [PATCH 20/29] Delete created orgs during tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- integration/helpers/org_and_space.go | 12 ++--- .../shared/isolated/spaces_command_test.go | 4 ++ integration/shared/plugin/api_test.go | 53 ++++++++++++------- .../running_security_groups_command_test.go | 1 + .../v7/global/set_space_role_command_test.go | 1 + .../staging_security_groups_command_test.go | 1 + .../create_space_quota_command_test.go | 4 ++ .../v7/isolated/move_route_command_test.go | 2 + .../v7/isolated/org_users_command_test.go | 4 ++ .../v7/isolated/rename_org_command_test.go | 4 ++ .../isolated/security_groups_command_test.go | 1 + .../v7/isolated/services_command_test.go | 8 ++- .../v7/isolated/share_private_domain_test.go | 5 ++ .../v7/isolated/share_route_command_test.go | 1 + .../v7/isolated/space_quota_command_test.go | 4 ++ .../v7/isolated/space_users_command_test.go | 4 ++ .../v7/isolated/spaces_command_test.go | 4 ++ .../isolated/unshare_private_domain_test.go | 8 +++ .../v7/isolated/unshare_route_command_test.go | 1 + 19 files changed, 94 insertions(+), 28 deletions(-) diff --git a/integration/helpers/org_and_space.go b/integration/helpers/org_and_space.go index e098a3bcd16..c08150762eb 100644 --- a/integration/helpers/org_and_space.go +++ b/integration/helpers/org_and_space.go @@ -112,7 +112,7 @@ func GetSpaceGUID(spaceName string) string { } // QuickDeleteOrg deletes the org with the given name, if provided, using -// 'cf curl /v2/organizations... -X DELETE'. +// 'cf curl /v3/organizations... -X DELETE'. func QuickDeleteOrg(orgName string) { // If orgName is empty, the BeforeSuite has failed and attempting to delete // will produce a meaningless error. @@ -122,13 +122,13 @@ func QuickDeleteOrg(orgName string) { } guid := GetOrgGUID(orgName) - url := fmt.Sprintf("/v2/organizations/%s?recursive=true&async=true", guid) + url := fmt.Sprintf("/v3/organizations/%s", guid) session := CF("curl", "-X", "DELETE", url) Eventually(session).Should(Exit(0)) } // QuickDeleteOrgIfExists deletes the org with the given name, if it exists, using -// 'cf curl /v2/organizations... -X DELETE'. +// 'cf curl /v3/organizations... -X DELETE'. func QuickDeleteOrgIfExists(orgName string) { session := CF("org", "--guid", orgName) Eventually(session).Should(Exit()) @@ -136,16 +136,16 @@ func QuickDeleteOrgIfExists(orgName string) { return } guid := strings.TrimSpace(string(session.Out.Contents())) - url := fmt.Sprintf("/v2/organizations/%s?recursive=true&async=true", guid) + url := fmt.Sprintf("/v3/organizations/%s", guid) session = CF("curl", "-X", "DELETE", url) Eventually(session).Should(Exit()) } // QuickDeleteSpace deletes the space with the given name, if it exists, using -// 'cf curl /v2/spaces... -X DELETE'. +// 'cf curl /v3/spaces... -X DELETE'. func QuickDeleteSpace(spaceName string) { guid := GetSpaceGUID(spaceName) - url := fmt.Sprintf("/v2/spaces/%s?recursive=true&async=true", guid) + url := fmt.Sprintf("/v3/spaces/%s", guid) session := CF("curl", "-X", "DELETE", url) Eventually(session).Should(Exit(0)) } diff --git a/integration/shared/isolated/spaces_command_test.go b/integration/shared/isolated/spaces_command_test.go index 2fca098d47a..96ccccdc4d9 100644 --- a/integration/shared/isolated/spaces_command_test.go +++ b/integration/shared/isolated/spaces_command_test.go @@ -30,6 +30,10 @@ var _ = Describe("spaces command", func() { helpers.TargetOrg(orgName) }) + AfterEach(func() { + helpers.QuickDeleteOrg(orgName) + }) + When("there are no spaces", func() { It("displays no spaces found", func() { session := helpers.CF("spaces") diff --git a/integration/shared/plugin/api_test.go b/integration/shared/plugin/api_test.go index 8b2b4a56dde..eee9b6eee6a 100644 --- a/integration/shared/plugin/api_test.go +++ b/integration/shared/plugin/api_test.go @@ -13,11 +13,15 @@ import ( ) var _ = Describe("plugin API", func() { + var orgName string BeforeEach(func() { installTestPlugin() }) AfterEach(func() { + if orgName != "" { + helpers.QuickDeleteOrg(orgName) + } uninstallTestPlugin() }) @@ -63,7 +67,7 @@ var _ = Describe("plugin API", func() { Describe("GetApp", func() { var appName string BeforeEach(func() { - createTargetedOrgAndSpace() + orgName, _ = createTargetedOrgAndSpace() appName = helpers.PrefixedRandomName("APP") helpers.WithHelloWorldApp(func(appDir string) { Eventually(helpers.CF("push", appName, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) @@ -78,7 +82,7 @@ var _ = Describe("plugin API", func() { Describe("GetApps", func() { var appName1, appName2 string BeforeEach(func() { - createTargetedOrgAndSpace() + orgName, _ = createTargetedOrgAndSpace() appName1 = helpers.PrefixedRandomName("APP") helpers.WithHelloWorldApp(func(appDir string) { Eventually(helpers.CF("push", appName1, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) @@ -97,29 +101,35 @@ var _ = Describe("plugin API", func() { Describe("GetCurrentOrg", func() { It("gets the current targeted org", func() { - org, _ := createTargetedOrgAndSpace() - confirmTestPluginOutput("GetCurrentOrg", org) + orgName, _ = createTargetedOrgAndSpace() + confirmTestPluginOutput("GetCurrentOrg", orgName) }) }) Describe("GetCurrentSpace", func() { It("gets the current targeted Space", func() { - _, space := createTargetedOrgAndSpace() + var space string + orgName, space = createTargetedOrgAndSpace() confirmTestPluginOutput("GetCurrentSpace", space) }) }) Describe("GetOrg", func() { It("gets the given org", func() { - org, _ := createTargetedOrgAndSpace() - confirmTestPluginOutputWithArg("GetOrg", org, org) + orgName, _ = createTargetedOrgAndSpace() + confirmTestPluginOutputWithArg("GetOrg", orgName, orgName) }) }) Describe("GetOrgs", func() { + var org1, org2 string + AfterEach(func() { + helpers.QuickDeleteOrg(org1) + helpers.QuickDeleteOrg(org2) + }) It("gets information for multiple orgs", func() { - org1, _ := createTargetedOrgAndSpace() - org2, _ := createTargetedOrgAndSpace() + org1, _ = createTargetedOrgAndSpace() + org2, _ = createTargetedOrgAndSpace() orgNameRegexp := fmt.Sprintf("(?:%s|%s)", org1, org2) confirmTestPluginOutput("GetOrgs", orgNameRegexp, orgNameRegexp) }) @@ -127,17 +137,17 @@ var _ = Describe("plugin API", func() { Describe("GetOrgUsers", func() { It("returns the org users", func() { - org, _ := createTargetedOrgAndSpace() + orgName, _ = createTargetedOrgAndSpace() username, _ := helpers.GetCredentials() - confirmTestPluginOutputWithArg("GetOrgUsers", org, username) + confirmTestPluginOutputWithArg("GetOrgUsers", orgName, username) }) }) Describe("GetOrgUsers", func() { It("returns the org users", func() { - org, _ := createTargetedOrgAndSpace() + orgName, _ = createTargetedOrgAndSpace() username, _ := helpers.GetCredentials() - confirmTestPluginOutputWithArg("GetOrgUsers", org, username) + confirmTestPluginOutputWithArg("GetOrgUsers", orgName, username) }) }) @@ -148,7 +158,7 @@ var _ = Describe("plugin API", func() { broker *servicebrokerstub.ServiceBrokerStub ) BeforeEach(func() { - createTargetedOrgAndSpace() + orgName, _ = createTargetedOrgAndSpace() serviceInstance1 = helpers.PrefixedRandomName("SI1") serviceInstance2 = helpers.PrefixedRandomName("SI2") @@ -159,6 +169,7 @@ var _ = Describe("plugin API", func() { }) AfterEach(func() { + helpers.QuickDeleteOrg(orgName) broker.Forget() }) @@ -172,7 +183,8 @@ var _ = Describe("plugin API", func() { Describe("GetSpace", func() { It("gets the given space", func() { - _, space := createTargetedOrgAndSpace() + var space string + orgName, space = createTargetedOrgAndSpace() confirmTestPluginOutputWithArg("GetSpace", space, space) }) }) @@ -181,7 +193,7 @@ var _ = Describe("plugin API", func() { var space1, space2 string BeforeEach(func() { - _, space1 = createTargetedOrgAndSpace() + orgName, space1 = createTargetedOrgAndSpace() space2 = helpers.NewSpaceName() helpers.CreateSpace(space2) }) @@ -195,8 +207,9 @@ var _ = Describe("plugin API", func() { Describe("GetSpaceUsers", func() { It("returns the space users", func() { username, _ := helpers.GetCredentials() - org, space := createTargetedOrgAndSpace() - session := helpers.CF("GetSpaceUsers", org, space) + var space string + orgName, space = createTargetedOrgAndSpace() + session := helpers.CF("GetSpaceUsers", orgName, space) Eventually(session).Should(Say(username)) Eventually(session).Should(Exit(0)) }) @@ -210,14 +223,14 @@ var _ = Describe("plugin API", func() { Describe("HasOrganization", func() { It("returns true", func() { - createTargetedOrgAndSpace() + orgName, _ = createTargetedOrgAndSpace() confirmTestPluginOutput("HasOrganization", "true") }) }) Describe("HasSpace", func() { It("returns true", func() { - createTargetedOrgAndSpace() + orgName, _ = createTargetedOrgAndSpace() confirmTestPluginOutput("HasSpace", "true") }) }) diff --git a/integration/v7/global/running_security_groups_command_test.go b/integration/v7/global/running_security_groups_command_test.go index e253e821d98..fe8b1cd267e 100644 --- a/integration/v7/global/running_security_groups_command_test.go +++ b/integration/v7/global/running_security_groups_command_test.go @@ -70,6 +70,7 @@ var _ = Describe("running-security-groups command", func() { AfterEach(func() { helpers.DeleteSecurityGroup(securityGroup) + helpers.QuickDeleteOrg(orgName) }) It("displays the globally enabled running security groups exits 0", func() { diff --git a/integration/v7/global/set_space_role_command_test.go b/integration/v7/global/set_space_role_command_test.go index 9e2f99df4e2..aa203a6c046 100644 --- a/integration/v7/global/set_space_role_command_test.go +++ b/integration/v7/global/set_space_role_command_test.go @@ -26,6 +26,7 @@ var _ = Describe("set-space-role command", func() { AfterEach(func() { helpers.EnableFeatureFlag("set_roles_by_username") + helpers.QuickDeleteOrg(orgName) }) When("the user does not exist", func() { diff --git a/integration/v7/global/staging_security_groups_command_test.go b/integration/v7/global/staging_security_groups_command_test.go index 49049c28379..280512a3b03 100644 --- a/integration/v7/global/staging_security_groups_command_test.go +++ b/integration/v7/global/staging_security_groups_command_test.go @@ -70,6 +70,7 @@ var _ = Describe("staging-security-groups command", func() { AfterEach(func() { helpers.DeleteSecurityGroup(securityGroup) + helpers.QuickDeleteOrg(orgName) }) It("displays the globally enabled staging security groups exits 0", func() { diff --git a/integration/v7/isolated/create_space_quota_command_test.go b/integration/v7/isolated/create_space_quota_command_test.go index 424023515df..048547566ac 100644 --- a/integration/v7/isolated/create_space_quota_command_test.go +++ b/integration/v7/isolated/create_space_quota_command_test.go @@ -60,6 +60,10 @@ var _ = Describe("create-space-quota command", func() { spaceQuotaName = helpers.QuotaName() }) + AfterEach(func() { + helpers.QuickDeleteOrg(orgName) + }) + When("the quota name is not provided", func() { It("tells the user that the quota name is required, prints help text, and exits 1", func() { session := helpers.CF("create-space-quota") diff --git a/integration/v7/isolated/move_route_command_test.go b/integration/v7/isolated/move_route_command_test.go index 242871705a0..2ea4a7c6b1f 100644 --- a/integration/v7/isolated/move_route_command_test.go +++ b/integration/v7/isolated/move_route_command_test.go @@ -147,6 +147,8 @@ var _ = Describe("move route command", func() { AfterEach(func() { domain.DeleteShared() + helpers.QuickDeleteOrg(targetOrgName) + helpers.QuickDeleteOrg(orgName) }) It("Transfers ownership of the route to the destination space", func() { diff --git a/integration/v7/isolated/org_users_command_test.go b/integration/v7/isolated/org_users_command_test.go index f2f6ec63871..f013da9db1b 100644 --- a/integration/v7/isolated/org_users_command_test.go +++ b/integration/v7/isolated/org_users_command_test.go @@ -40,6 +40,10 @@ var _ = Describe("org-users command", func() { helpers.CreateOrg(orgName) }) + AfterEach(func() { + helpers.QuickDeleteOrg(orgName) + }) + When("the target org has multiple users with different roles", func() { var ( orgManagerUser string diff --git a/integration/v7/isolated/rename_org_command_test.go b/integration/v7/isolated/rename_org_command_test.go index ad5accf8993..e8bb88ecbb0 100644 --- a/integration/v7/isolated/rename_org_command_test.go +++ b/integration/v7/isolated/rename_org_command_test.go @@ -107,6 +107,10 @@ var _ = Describe("rename-org command", func() { helpers.CreateOrg(orgNameNew) }) + AfterEach(func() { + helpers.QuickDeleteOrg(orgNameNew) + }) + It("fails to rename the org", func() { session := helpers.CF("rename-org", orgName, orgNameNew) userName, _ := helpers.GetCredentials() diff --git a/integration/v7/isolated/security_groups_command_test.go b/integration/v7/isolated/security_groups_command_test.go index 8581aa8f1db..ed2538be128 100644 --- a/integration/v7/isolated/security_groups_command_test.go +++ b/integration/v7/isolated/security_groups_command_test.go @@ -118,6 +118,7 @@ var _ = Describe("security-groups command", func() { helpers.DeleteSecurityGroup(securityGroup3) helpers.DeleteSecurityGroup(securityGroup4) helpers.DeleteSecurityGroup(securityGroup5) + helpers.QuickDeleteOrg(orgName) }) It("displays the security groups exits 0", func() { diff --git a/integration/v7/isolated/services_command_test.go b/integration/v7/isolated/services_command_test.go index 6afe49ffa03..a04819006df 100644 --- a/integration/v7/isolated/services_command_test.go +++ b/integration/v7/isolated/services_command_test.go @@ -163,11 +163,11 @@ var _ = Describe("services command", func() { Context("has shared service instances", func() { var ( - managedService, appNameOnSpaceA, appNameOnSpaceB string + managedService, appNameOnSpaceA, appNameOnSpaceB, orgName string ) BeforeEach(func() { - orgName := helpers.NewOrgName() + orgName = helpers.NewOrgName() spaceA := helpers.NewSpaceName() spaceB := helpers.NewSpaceName() managedService = helpers.PrefixedRandomName("MANAGED1") @@ -193,6 +193,10 @@ var _ = Describe("services command", func() { helpers.TargetOrgAndSpace(orgName, spaceA) }) + AfterEach(func() { + helpers.QuickDeleteOrg(orgName) + }) + It("should not output bound apps in the shared spaces", func() { session := helpers.CF(command) Eventually(session).Should(Exit(0)) diff --git a/integration/v7/isolated/share_private_domain_test.go b/integration/v7/isolated/share_private_domain_test.go index e9e62700353..f6c416fdb6b 100644 --- a/integration/v7/isolated/share_private_domain_test.go +++ b/integration/v7/isolated/share_private_domain_test.go @@ -58,6 +58,11 @@ var _ = Describe("share-private-domain command", func() { domain.CreatePrivate() }) + AfterEach(func() { + helpers.QuickDeleteOrg(sharedWithOrgName) + helpers.QuickDeleteOrg(orgName) + }) + It("should create the shared domain", func() { session := helpers.CF("share-private-domain", sharedWithOrgName, domainName) diff --git a/integration/v7/isolated/share_route_command_test.go b/integration/v7/isolated/share_route_command_test.go index 8697ac71e95..5c5e6369916 100644 --- a/integration/v7/isolated/share_route_command_test.go +++ b/integration/v7/isolated/share_route_command_test.go @@ -147,6 +147,7 @@ var _ = Describe("share route command", func() { AfterEach(func() { domain.Delete() + helpers.QuickDeleteOrg(targetOrgName) }) It("shared the route to the destination space", func() { diff --git a/integration/v7/isolated/space_quota_command_test.go b/integration/v7/isolated/space_quota_command_test.go index 99203a033b3..e2c7094f954 100644 --- a/integration/v7/isolated/space_quota_command_test.go +++ b/integration/v7/isolated/space_quota_command_test.go @@ -49,6 +49,10 @@ var _ = Describe("space-quota command", func() { helpers.TargetOrg(orgName) }) + AfterEach(func() { + helpers.QuickDeleteOrg(orgName) + }) + When("the quota does not exist", func() { It("displays quota not found and exits 1", func() { session := helpers.CF("space-quota", quotaName) diff --git a/integration/v7/isolated/space_users_command_test.go b/integration/v7/isolated/space_users_command_test.go index 2932a3af070..f2d594aaf24 100644 --- a/integration/v7/isolated/space_users_command_test.go +++ b/integration/v7/isolated/space_users_command_test.go @@ -42,6 +42,10 @@ var _ = Describe("space-users command", func() { helpers.CreateOrgAndSpace(orgName, spaceName) }) + AfterEach(func() { + helpers.QuickDeleteOrg(orgName) + }) + When("the target space has multiple users with different roles", func() { var ( spaceManagerUser string diff --git a/integration/v7/isolated/spaces_command_test.go b/integration/v7/isolated/spaces_command_test.go index 5ae047e821c..540c7da5d0d 100644 --- a/integration/v7/isolated/spaces_command_test.go +++ b/integration/v7/isolated/spaces_command_test.go @@ -60,6 +60,10 @@ var _ = Describe("spaces command", func() { helpers.CreateSpace(spaceName6) }) + AfterEach(func() { + helpers.QuickDeleteOrg(orgName) + }) + When("the --labels flag is given", func() { BeforeEach(func() { diff --git a/integration/v7/isolated/unshare_private_domain_test.go b/integration/v7/isolated/unshare_private_domain_test.go index aa30eea5552..638cacff0c8 100644 --- a/integration/v7/isolated/unshare_private_domain_test.go +++ b/integration/v7/isolated/unshare_private_domain_test.go @@ -70,6 +70,10 @@ var _ = Describe("unshare-private-domain command", func() { domain.V7Share(sharedToOrgName) }) + AfterEach(func() { + helpers.QuickDeleteOrg(sharedToOrgName) + }) + It("unshares the domain from the org", func() { buffer := NewBuffer() _, err := buffer.Write([]byte("y\n")) @@ -98,6 +102,10 @@ var _ = Describe("unshare-private-domain command", func() { domain.V7Share(sharedToOrgName) }) + AfterEach(func() { + helpers.QuickDeleteOrg(sharedToOrgName) + }) + It("does not unshare the domain from the org", func() { buffer := NewBuffer() _, err := buffer.Write([]byte("n\n")) diff --git a/integration/v7/isolated/unshare_route_command_test.go b/integration/v7/isolated/unshare_route_command_test.go index 8520edf2b5f..ce745ec5001 100644 --- a/integration/v7/isolated/unshare_route_command_test.go +++ b/integration/v7/isolated/unshare_route_command_test.go @@ -152,6 +152,7 @@ var _ = Describe("unshare route command", func() { AfterEach(func() { domain.Delete() + helpers.QuickDeleteOrg(targetOrgName) }) It("unshared the route from the intended space", func() { From 44e31de594eedd4440936dd107385a7afc0db85e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Thu, 24 Oct 2024 13:12:14 -0500 Subject: [PATCH 21/29] Ensure that the orgName is empty for each test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- integration/shared/plugin/api_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/integration/shared/plugin/api_test.go b/integration/shared/plugin/api_test.go index eee9b6eee6a..b609eff4338 100644 --- a/integration/shared/plugin/api_test.go +++ b/integration/shared/plugin/api_test.go @@ -15,6 +15,7 @@ import ( var _ = Describe("plugin API", func() { var orgName string BeforeEach(func() { + orgName = "" installTestPlugin() }) From 949cf6c1d07d091ab771ddf55dd1fcfe186060c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Thu, 24 Oct 2024 13:37:37 -0500 Subject: [PATCH 22/29] Prevent double deletion of org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- integration/shared/plugin/api_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/integration/shared/plugin/api_test.go b/integration/shared/plugin/api_test.go index b609eff4338..8ffb206371f 100644 --- a/integration/shared/plugin/api_test.go +++ b/integration/shared/plugin/api_test.go @@ -170,7 +170,6 @@ var _ = Describe("plugin API", func() { }) AfterEach(func() { - helpers.QuickDeleteOrg(orgName) broker.Forget() }) From 5cda0eb983abe5cecc08f57d150c0049fd230836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Thu, 24 Oct 2024 15:33:07 -0500 Subject: [PATCH 23/29] Lower number of tests running using client credentials to avoid flakes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/tests-integration-reusable.yml | 2 +- Makefile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 29feecbdc8e..f2954952263 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -251,4 +251,4 @@ jobs: cf api ${CF_INT_API} --skip-ssl-validation cf auth - make integration-tests-full-ci \ No newline at end of file + make integration-tests-ci-client-creds diff --git a/Makefile b/Makefile index 55c9269533b..83423e8e012 100644 --- a/Makefile +++ b/Makefile @@ -132,6 +132,7 @@ integration-selfcontained: build install-test-deps integration-tests: build integration-cleanup integration-isolated integration-push integration-global integration-selfcontained ## Run all isolated, push, selfcontained, and global integration tests +integration-tests-ci-client-creds: build integration-cleanup integration-push integration-global integration-selfcontained i: integration-tests-full integration-full-tests: integration-tests-full From 4a1628625c6aa04d5076a32a6b0c9213cca10999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Thu, 24 Oct 2024 15:36:35 -0500 Subject: [PATCH 24/29] Allow user to define namespace of the leased environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/tests-integration.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 23d06e425ea..e763e9fa785 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -23,6 +23,10 @@ on: description: Pre-provisioned environment lease-id to use in tests required: false type: string + lease_namespace: + description: Pre-provisioned environment lease namespace to use in tests + required: false + type: string run_unit_tests: description: Run unit tests required: false @@ -120,7 +124,7 @@ jobs: pool_name: ${{ vars.SHEPHERD_POOL_NAME }} pool_duration: ${{ vars.SHEPHERD_POOL_DURATION || '8h' }} pool_namespace: ${{ vars.SHEPHERD_POOL_NAMESPACE || 'official' }} - namespace: ${{ vars.POOL_NAMESPACE || 'tas-devex' }} + namespace: ${{ inputs.lease_namespace || vars.POOL_NAMESPACE || 'tas-devex' }} run: | shepherd login service-account ${account_token} From d3fcf31b961d0b7fcf31424efdadfeecbe249c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Thu, 24 Oct 2024 16:44:06 -0500 Subject: [PATCH 25/29] Pass namespace of the lease to the reusable workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/tests-integration-reusable.yml | 4 ++++ .github/workflows/tests-integration.yml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index f2954952263..c4ee7160c76 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -22,6 +22,9 @@ on: lease-id: required: true type: string + lease-namespace: + required: false + type: string gitRef: type: string default: ${{github.event.workflow_run.head_sha}} @@ -70,6 +73,7 @@ jobs: - name: Install Tools env: account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} + namespace: ${{ inputs.lease-namespace || vars.POOL_NAMESPACE || 'tas-devex' }} run: | go version diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index e763e9fa785..123006ff0fc 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -264,6 +264,7 @@ jobs: name: Integration gitRef: ${{needs.get-sha.outputs.gitRef}} lease-id: ${{ needs.claim-env.outputs.leaseid }} + lease-namespace: ${{ inputs.lease_namespace }} nodes: ${{ inputs.nodes }} secrets: inherit @@ -281,6 +282,7 @@ jobs: name: Integration client creds gitRef: ${{needs.get-sha.outputs.gitRef}} lease-id: ${{ needs.claim-env.outputs.leaseid }} + lease-namespace: ${{ inputs.lease_namespace }} secrets: inherit run-cats-cf-env: @@ -298,6 +300,7 @@ jobs: name: cats gitRef: ${{needs.get-sha.outputs.gitRef}} lease-id: ${{ needs.claim-env.outputs.leaseid }} + lease-namespace: ${{ inputs.lease_namespace }} secrets: inherit unclaim-env: From f39f3d7383f59494f8ecb067c7853d328de7e356 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Fri, 25 Oct 2024 09:51:07 -0700 Subject: [PATCH 26/29] Ignore act files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index bdd84341efc..cc14c3edb44 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,5 @@ integration/assets/test_plugin/test_plugin ### VisualStudioCode ### .vscode +.secrets +.vars From 21376fd6cf66eb9e8606d67246c06a1ac531168c Mon Sep 17 00:00:00 2001 From: Al Berez Date: Fri, 25 Oct 2024 11:17:19 -0700 Subject: [PATCH 27/29] Clean vars --- .../workflows/tests-integration-reusable.yml | 10 +++-- .github/workflows/tests-integration.yml | 41 ++++++++++++------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index c4ee7160c76..9134e1c7e63 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -3,7 +3,7 @@ # secrets.CLIENT_SECRET # secrets.GITHUB_TOKEN # secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN -# vars.SHEPHERD_POOL_NAME +# vars.TEST_FLAKE_ATTEMPTS name: "pvt: run integration tests" @@ -25,6 +25,7 @@ on: lease-namespace: required: false type: string + default: 'tas-devex' gitRef: type: string default: ${{github.event.workflow_run.head_sha}} @@ -72,8 +73,9 @@ jobs: - name: Install Tools env: - account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} - namespace: ${{ inputs.lease-namespace || vars.POOL_NAMESPACE || 'tas-devex' }} + account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} + lease_namespace: ${{ inputs.lease-namespace }} + lease_id: ${{ inputs.lease-id }} run: | go version @@ -107,7 +109,7 @@ jobs: apt-get install -y build-essential unzip shepherd login service-account ${account_token} - shepherd get lease ${{ inputs.lease-id }} --namespace tas-devex --json | jq .output > metadata.json + shepherd get lease ${lease_id} --namespace ${lease_namespace} --json | jq .output > metadata.json - name: Add CATS config if: ${{ inputs.name == 'cats' }} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 123006ff0fc..df95cae95ff 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -1,3 +1,13 @@ +# GitHub repo level Secrets and Variables + +# secrets.CLIENT_SECRET +# secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN +# vars.CAPI_RELEASE_VERSION +# vars.SHEPHERD_LEASE_NAMESPACE +# vars.SHEPHERD_POOL_DURATION +# vars.SHEPHERD_POOL_NAME +# vars.SHEPHERD_POOL_NAMESPACE + name: "Tests: Integration" run-name: "Integration [${{ github.event_name }}: ${{ github.event.pull_request.head.sha || github.event.push.after || github.event.workflow_run.head_sha}}]: ${{ github.event.workflow_run.head_commit.message }}" @@ -57,7 +67,7 @@ on: - ".golangci.json" env: - SHEPHERD_LEASE_ID: ${{ inputs.lease_id || vars.SHEPHERD_LEASE_ID}} + SHEPHERD_LEASE_ID: ${{ inputs.lease_id }} jobs: @@ -120,20 +130,20 @@ jobs: - name: claim id: claim env: - account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} - pool_name: ${{ vars.SHEPHERD_POOL_NAME }} - pool_duration: ${{ vars.SHEPHERD_POOL_DURATION || '8h' }} - pool_namespace: ${{ vars.SHEPHERD_POOL_NAMESPACE || 'official' }} - namespace: ${{ inputs.lease_namespace || vars.POOL_NAMESPACE || 'tas-devex' }} + account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} + pool_name: ${{ vars.SHEPHERD_POOL_NAME }} + pool_duration: ${{ vars.SHEPHERD_POOL_DURATION || '8h' }} + pool_namespace: ${{ vars.SHEPHERD_POOL_NAMESPACE || 'official' }} + lease_namespace: ${{ inputs.lease_namespace || vars.SHEPHERD_LEASE_NAMESPACE || 'tas-devex' }} run: | shepherd login service-account ${account_token} if [[ -z $SHEPHERD_LEASE_ID ]]; then lease_id=$( shepherd create lease \ - --duration ${pool_duration} \ - --pool ${pool_name} \ - --pool-namespace ${pool_namespace} \ - --namespace ${namespace} \ + --duration ${pool_duration} \ + --pool ${pool_name} \ + --pool-namespace ${pool_namespace} \ + --namespace ${lease_namespace} \ --description "Claimed by CF CLI workflow ${{ github.workflow_run.url }}" \ --json \ | jq -r .id @@ -150,13 +160,13 @@ jobs: while [ $count -lt 360 ] ; do sleep 30 status=$( shepherd get lease ${lease_id} \ - --namespace ${namespace} \ + --namespace ${lease_namespace} \ --json \ | jq -r .status ) if [ $status == "LEASED" ] ; then shepherd get lease ${lease_id} \ - --namespace ${namespace} \ + --namespace ${lease_namespace} \ --json \ | jq .output > metadata.json break @@ -314,10 +324,11 @@ jobs: steps: - name: unclaim env: - account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} - namespace: ${{ vars.POOL_NAMESPACE || 'tas-devex' }} + account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }} + lease_namespace: ${{ inputs.lease_namespace || vars.SHEPHERD_LEASE_NAMESPACE || 'tas-devex' }} run: | shepherd login service-account ${account_token} set -x shepherd delete lease ${{ needs.claim-env.outputs.leaseid }} \ - --namespace ${namespace} + --namespace ${lease_namespace} + From c131c1c03bd28b8dc3c2e3cc00268f7a318c2537 Mon Sep 17 00:00:00 2001 From: AL Berez Date: Mon, 28 Oct 2024 11:55:45 -0700 Subject: [PATCH 28/29] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Pereira --- .github/workflows/tests-integration-reusable.yml | 2 +- .github/workflows/tests-integration.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 9134e1c7e63..ae3aa7a6c1a 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -31,7 +31,7 @@ on: default: ${{github.event.workflow_run.head_sha}} nodes: type: string - default: "8" + default: "12" env: NODES: ${{ inputs.nodes }} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index df95cae95ff..531c4081229 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -293,6 +293,7 @@ jobs: gitRef: ${{needs.get-sha.outputs.gitRef}} lease-id: ${{ needs.claim-env.outputs.leaseid }} lease-namespace: ${{ inputs.lease_namespace }} + nodes: ${{ inputs.nodes }} secrets: inherit run-cats-cf-env: @@ -311,6 +312,7 @@ jobs: gitRef: ${{needs.get-sha.outputs.gitRef}} lease-id: ${{ needs.claim-env.outputs.leaseid }} lease-namespace: ${{ inputs.lease_namespace }} + nodes: ${{ inputs.nodes }} secrets: inherit unclaim-env: From 604591a5d65d29603aa980f530897ecdcc2d8e1e Mon Sep 17 00:00:00 2001 From: AL Berez Date: Mon, 28 Oct 2024 12:02:37 -0700 Subject: [PATCH 29/29] Update number of nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Pereira --- .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 531c4081229..d2ee21648d5 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -28,7 +28,7 @@ on: description: Number of test nodes required: false type: string - default: "8" + default: "12" lease_id: description: Pre-provisioned environment lease-id to use in tests required: false