From f1c39eeb7fb43f504173a74ee210f7b9584eeafe Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Mon, 10 Jun 2024 13:56:51 -0400 Subject: [PATCH 1/7] Initial CATS commit --- .../workflows/tests-integration-reusable.yml | 111 +++++++++++++++++- .github/workflows/tests-integration.yml | 15 ++- 2 files changed, 119 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index e8a80a5915c..a62ba905a50 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -62,6 +62,13 @@ jobs: repository: cloudfoundry/cli-ci path: cli-ci + - name: Checkout cf-acceptance-tests + uses: actions/checkout@v4 + with: + repository: cloudfoundry/cf-acceptance-tests + ref: release-candidate + path: cf-acceptance-tests + - id: read-min-capi name: Read MIN CAPI run: | @@ -124,8 +131,16 @@ jobs: cat metadata.json | jq -r '.name' echo "lease-id=$lease_id" >> "${GITHUB_OUTPUT}" + - name: Set Up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + check-latest: true + - name: Install Tools run: | + go version + if [[ ${{ inputs.os }} =~ "windows" ]] then install_location=/usr/bin @@ -153,7 +168,7 @@ jobs: credhub --version apt-get update - apt-get install -y build-essential + apt-get install -y build-essential unzip - name: Deploy Isolation Segment and OIDC Provider if: ${{ inputs.capi-version == 'edge' }} @@ -168,6 +183,7 @@ jobs: bosh -d cf manifest > /tmp/manifest.yml bosh interpolate /tmp/manifest.yml \ -o .github/ops-files/use-cflinuxfs3.yml \ + -o cf-deployment/operations/use-internal-lookup-for-route-services.yml \ -o cf-deployment/operations/add-persistent-isolation-segment-diego-cell.yml \ -o cli-ci/ci/infrastructure/operations/add-oidc-provider.yml \ -o cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml \ @@ -201,11 +217,94 @@ jobs: echo "Deployed CAPI version:" bosh -d cf releases | grep capi - - name: Set Up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - check-latest: true + - name: Add CATS config + run: | + set -eu + + ENV=$(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 + 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 -) + + cat << EOF | jq -S . > cats_config.json + { + "admin_password": "${CF_INT_PASSWORD}", + "admin_user": "${CF_INT_USERNAME}", + "api": "${API}", + "apps_domain": "${DOMAIN}", + "backend" : "diego", + "broker_start_timeout": 330, + "cf_push_timeout": 210, + "default_timeout": 120, + "long_curl_timeout": 210, + "skip_ssl_validation": true, + "use_http": true, + "include_apps": true, + "include_backend_compatibility": false, + "include_container_networking": true, + "include_detect": true, + "include_docker": true, + "include_internet_dependent": true, + "include_isolation_segments": true, + "isolation_segment_name": "persistent_isolation_segment", + "include_private_docker_registry": false, + "include_route_services": true, + "include_routing": true, + "include_routing_isolation_segments": false, + "include_security_groups": true, + "include_services": true, + "include_service_discovery": true, + "include_service_instance_sharing": true, + "include_ssh": true, + "include_sso": false, + "include_tasks": true, + "include_tcp_routing": true, + "include_v3": true, + "include_zipkin": true + } + EOF + + make build + echo "$PWD/out" >> $GITHUB_PATH + export PATH="$PWD/out:$PATH" + cf version + + export CF_USERNAME=${CF_INT_USERNAME} + export CF_PASSWORD=${CF_INT_PASSWORD} + cf api ${API} --skip-ssl-validation + cf auth + cf enable-feature-flag diego_docker + cf enable-feature-flag service_instance_sharing + + - name: Run CATS Tests + run: | + set -xeu + + export CONFIG + CONFIG=$(mktemp) + + original_config="${PWD}/cats_config.json" + cp ${original_config} ${CONFIG} + + cd ./cf-acceptance-tests + export CF_DIAL_TIMEOUT=11 + export CF_PLUGIN_HOME=$HOME + go version + + ./bin/test \ + --keep-going \ + --randomize-all \ + --skip-package=helpers \ + --nodes="12" \ + --flake-attempts=2 \ + --timeout="2h" \ + --no-color - name: Run Integration Tests if: ${{ !inputs.run-with-client-creds }} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index baa7a4ad2a5..320805bb6c8 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -10,6 +10,7 @@ on: required: true type: choice options: + - run-CATS-tests-cf-env - run-integration-tests-cf-env - run-integration-tests-cf-env-with-client-creds - run-integration-tests-cf-env-with-min-capi @@ -21,7 +22,19 @@ on: types: - completed -jobs: +jobs: + run-CATS-tests-cf-env: + name: CATS tests + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-CATS-tests-cf-env') || github.event.workflow_run.conclusion == 'success' }} + uses: ./.github/workflows/tests-integration-reusable.yml + with: + capi-version: edge + run-with-client-creds: false + os: ubuntu-latest + name: CATS + is-pr: ${{ github.event_name != 'workflow_dispatch' }} + secrets: inherit + run-integration-tests-cf-env: name: Integration tests if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-integration-tests-cf-env') || github.event.workflow_run.conclusion == 'success' }} From ce32ab0ab205d9af81e312bd8ac68647eb3d8eb3 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Tue, 11 Jun 2024 09:06:32 -0400 Subject: [PATCH 2/7] Integrate CATS in Integration tests workflow --- .../workflows/tests-integration-reusable.yml | 4 ++- .github/workflows/tests-integration.yml | 26 +++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index a62ba905a50..bb43225c8d2 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -218,6 +218,7 @@ jobs: bosh -d cf releases | grep capi - name: Add CATS config + if: ${{ inputs.name == 'cats' }} run: | set -eu @@ -283,6 +284,7 @@ jobs: cf enable-feature-flag service_instance_sharing - name: Run CATS Tests + if: ${{ inputs.name == 'cats' }} run: | set -xeu @@ -307,7 +309,7 @@ jobs: --no-color - name: Run Integration Tests - if: ${{ !inputs.run-with-client-creds }} + 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 diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 320805bb6c8..7d73d88b79b 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -10,10 +10,10 @@ on: required: true type: choice options: - - run-CATS-tests-cf-env - run-integration-tests-cf-env - run-integration-tests-cf-env-with-client-creds - run-integration-tests-cf-env-with-min-capi + - run-cats-cf-env # - run-integration-windows # - run-integration-windows-client-credentials workflow_run: @@ -23,18 +23,6 @@ on: - completed jobs: - run-CATS-tests-cf-env: - name: CATS tests - if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-CATS-tests-cf-env') || github.event.workflow_run.conclusion == 'success' }} - uses: ./.github/workflows/tests-integration-reusable.yml - with: - capi-version: edge - run-with-client-creds: false - os: ubuntu-latest - name: CATS - is-pr: ${{ github.event_name != 'workflow_dispatch' }} - secrets: inherit - run-integration-tests-cf-env: name: Integration tests if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-integration-tests-cf-env') || github.event.workflow_run.conclusion == 'success' }} @@ -72,6 +60,18 @@ jobs: is-pr: ${{ github.event_name != 'workflow_dispatch' }} secrets: inherit + run-cats-cf-env: + name: CATS + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-CATS-tests-cf-env') || github.event.workflow_run.conclusion == 'success' }} + uses: ./.github/workflows/tests-integration-reusable.yml + with: + capi-version: edge + run-with-client-creds: false + os: ubuntu-latest + name: cats + is-pr: ${{ github.event_name != 'workflow_dispatch' }} + secrets: inherit + #run-integration-windows: # name: Windows # if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-integration-windows') || github.event.workflow_run.conclusion == 'success' }} From b67fb7ad90bce3f204cd3a0ba910f9224d99fceb Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Tue, 11 Jun 2024 09:11:40 -0400 Subject: [PATCH 3/7] Fix input 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 7d73d88b79b..e915c92df5b 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -62,7 +62,7 @@ jobs: run-cats-cf-env: name: CATS - if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-CATS-tests-cf-env') || github.event.workflow_run.conclusion == 'success' }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-cats-cf-env') || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml with: capi-version: edge From 8a22b62692ed12cf05574e296b59822c935034f3 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Tue, 11 Jun 2024 09:14:06 -0400 Subject: [PATCH 4/7] Set pool namespace --- .github/workflows/tests-integration-reusable.yml | 2 +- .github/workflows/tests-integration.yml | 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 bb43225c8d2..72a1cfe3427 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -27,7 +27,7 @@ on: default: ${{ vars.SHEPHERD_POOL_NAME }} pool-namespace: type: string - default: 'tas-devex' + default: 'official' is-pr: type: boolean default: true diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index e915c92df5b..42d5bb5cb9e 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -57,6 +57,7 @@ jobs: os: ubuntu-latest name: Integration MIN CAPI pool-name: cfd_16_11_0 + pool-namespace: tas-devex is-pr: ${{ github.event_name != 'workflow_dispatch' }} secrets: inherit From e8414dc24b64292b7a05744cf0eee10589b10bf6 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Tue, 11 Jun 2024 09:16:27 -0400 Subject: [PATCH 5/7] Fix pool namespace --- .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 72a1cfe3427..01427a1387c 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -107,8 +107,8 @@ jobs: run: | shepherd login service-account ${account_token} - echo "shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace tas-devex --namespace ${pool_namespace}" - lease_id=$(shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace tas-devex --namespace ${pool_namespace} --json | jq -r .id) + echo "shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace ${pool_namespace} --namespace tas-devex" + lease_id=$(shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace ${pool_namespace} --namespace tas-devex --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 From c3cb904af457c76d88f6223f12aa8032cad215d9 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Tue, 11 Jun 2024 09:20:38 -0400 Subject: [PATCH 6/7] Fix namespace references --- .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 01427a1387c..ac976acb42e 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -114,9 +114,9 @@ jobs: count=0 while [ $count -lt 360 ] ; do sleep 30 - status=$(shepherd get lease ${lease_id} --namespace ${pool_namespace} --json | jq -r .status) + status=$(shepherd get lease ${lease_id} --namespace tas-devex --json | jq -r .status) if [ $status == "LEASED" ] ; then - shepherd get lease ${lease_id} --namespace ${pool_namespace} --json | jq .output > metadata.json + 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}." From 381cc5923208a6a1f67b53895b8163ae72611f54 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Tue, 11 Jun 2024 11:43:18 -0400 Subject: [PATCH 7/7] Test workflow_run branch trigger --- .github/workflows/tests-integration.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 42d5bb5cb9e..ebf880350b9 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -21,9 +21,20 @@ on: - "Tests" types: - completed + branches: + - v8 jobs: + # setup: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout cli + # uses: actions/checkout@v4 + # with: + # ref: ${{github.event.workflow_run.head_sha}} + run-integration-tests-cf-env: + # needs: setup name: Integration tests if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-integration-tests-cf-env') || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml @@ -36,6 +47,7 @@ jobs: secrets: inherit run-integration-tests-cf-env-with-client-creds: + # needs: setup name: client creds if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-integration-tests-cf-env-with-client-creds') || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml @@ -48,6 +60,7 @@ jobs: secrets: inherit run-integration-tests-cf-env-with-min-capi: + # needs: setup name: MIN CAPI if: ${{ (github.event_name == 'workflow_dispatch' && inputs.workflow == 'run-integration-tests-cf-env-with-min-capi') || github.event.workflow_run.conclusion == 'success' }} uses: ./.github/workflows/tests-integration-reusable.yml