From 40223df1489b4f92c2a678fe33821a4947ef6bfb Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Thu, 29 Sep 2022 16:40:15 -0700 Subject: [PATCH 01/22] Add GitHub Actions for Linux Integration Test with latest CAPI - this leaves some room for future reuse (like min capi and windows) - not sure we should use upload artifact (maybe we can save just the enviornment name from toolsmiths and call down the metafile when needed?) - install tools when needed rather than use cf-deployment-concourse-tasks container --- .github/reusable-workflows/setup-cf-env.yml | 71 +++++++++++ .github/reusable-workflows/unclaim-cf-env.yml | 26 ++++ .github/workflows/integration.yml | 117 ++++++++++++++++++ 3 files changed, 214 insertions(+) create mode 100644 .github/reusable-workflows/setup-cf-env.yml create mode 100644 .github/reusable-workflows/unclaim-cf-env.yml create mode 100644 .github/workflows/integration.yml diff --git a/.github/reusable-workflows/setup-cf-env.yml b/.github/reusable-workflows/setup-cf-env.yml new file mode 100644 index 00000000000..66cba967a1b --- /dev/null +++ b/.github/reusable-workflows/setup-cf-env.yml @@ -0,0 +1,71 @@ +name: Setup CF Environment + +on: + workflow_call: + inputs: + environment: + required: true + type: string + capi-version: + required: true + type: string + identifier-for-metadata-file: + required: true + type: string + +jobs: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + steps: + - name: Claim Toolsmiths Environment + env: + - TOOLSMITHS_URL: https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&pool_name=cf-deployment¬es=github-actions-syslog-release + run: | + # tools + wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp && \ + mv /tmp/bbl-* /usr/local/bin/bbl && \ + chmod +x /usr/local/bin/bbl + + # claim + if ! curl --fail -X POST "$TOOLSMITHS_URL" > metadata.json + then + echo "UNABLE TO CLAIM AN ENVIRONMENT, PLEASE RETRY LATER" + exit 1 + fi + eval "$(bbl print-env --metadata-file ./metadata.json)" + + - name: Checkout cli-ci + uses: actions/checkout@v3 + with: + repository: cloudfoundry/cli-ci + path: cli-ci + + - name: Deploy edge CAPI + if: ${{ inputs.capi-version == 'edge' }} + run: | + # tools + wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P /tmp && \ + unzip -d /tmp /tmp/awscli-exe-linux-x86_64.zip && \ + ./tmp/aws/install + wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" && \ + chmod +x /usr/bin/bosh + + # find latest capi + FILENAME="$(aws s3 ls capi-releases --no-sign-request --recursive --region us-east-1 | sort | tail -n 1 | awk '{print $4}')" + aws s3 cp s3://capi-releases/$FILENAME $FILENAME --no-sign-request --region us-east-1 + eval "$(bbl print-env --metadata-file metadata.json)" + bosh upload-release --sha2 "$FILENAME" + rm $FILENAME + + # deploy + bosh -d cf manifest > /tmp/manifest.json + bosh -d cf deploy /tmp/manifest.json -o cli-ci/ci/infrastructure/operations/use-latest-capi.yml -n + + echo "Deployed CAPI version:" + bosh -d cf releases | grep capi + + - name: 'Upload Metadata' + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.identifier-for-metadata-file }} + path: metadata.json diff --git a/.github/reusable-workflows/unclaim-cf-env.yml b/.github/reusable-workflows/unclaim-cf-env.yml new file mode 100644 index 00000000000..336fde4d2cd --- /dev/null +++ b/.github/reusable-workflows/unclaim-cf-env.yml @@ -0,0 +1,26 @@ +name: Unclaim an environment + +on: + workflow_call: + inputs: + environment: + required: true + type: string + identifier-for-metadata-file: + required: true + type: string + +jobs: + build-env: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + + steps: + - name: Download metadata + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.test-name }} + + - name: Unclaim environment + run: | + curl -X POST "https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/unclaim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&name=$(cat metadata.json | jq -r .name)" \ No newline at end of file diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000000..30841d37014 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,117 @@ +name: Integration Tests + +on: + workflow_dispatch: + pull_request: + branches: + - master + - v8 + - v7 + paths-ignore: + - 'doc/**' + - '.github/**' + - '.gitpod.yml' + - 'README.md' + push: + branches: + - master + - v8 + - v7 + paths-ignore: + - 'doc/**' + - '.github/**' + - '.gitpod.yml' + - 'README.md' + +permissions: + contents: read + +jobs: + shared-values: + name: Shared Values + runs-on: ubuntu-latest + outputs: + secrets-environment: ${{ steps.set-secrets-environment.outputs.secrets-environment }} + go-version: ${{ steps.set-go-version.outputs.go-version }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - id: set-secrets-environment + name: Set environment + run: echo "::set-output name=secrets-environment::PROD" + + - id: set-go-version + name: Parse Golang Version + run: | + go_version=($(grep -E '^go 1\.[[:digit:]]{1,2}' go.mod)) + echo "golang version: ${go_version[1]}" + echo "::set-output name=go-version::${go_version[1]}" + + get-linux-env-with-edge-capi: + needs: shared-values + uses: ./.github/reusable-workflows/setup-cf-env.yml + with: + environment: ${{ needs.shared-values.outputs.secrets-environment }} + capi-version: edge + identifier-for-metadata-file: linux-env-with-edge-capi + secrets: inherit + + run-integration-tests-linux-env-with-edge-capi: + needs: + - shared-values + - get-linux-env-with-edge-capi + runs-on: ubuntu-latest + environment: ${{ needs.shared-values.outputs.secrets-environment }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set Up Go + uses: actions/setup-go@v3 + with: + go-version: ${{ needs.shared-values.outputs.go-version}} + check-latest: true + - name: Download metadata + uses: actions/download-artifact@v3 + with: + name: linux-env-with-edge-capi + - name: Run Integration Tests + run: | + # tools + wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp && \ + mv /tmp/bbl-* /usr/local/bin/bbl && \ + chmod +x /usr/local/bin/bbl + wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" && \ + chmod +x /usr/bin/bosh + wget https://github.com/cloudfoundry/credhub-cli/releases/download/2.9.4/credhub-linux-2.9.4.tgz -P /tmp && \ + tar xzvf /tmp/credhub-linux-2.9.4.tgz -C /usr/local/bin && \ + chmod +x /usr/local/bin/credhub + + # test setup + ENV=$(cat metadata.json | jq -r '.name') + 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" + export CF_DIAL_TIMEOUT=15 + export CF_USERNAME=admin + export FLAKE_ATTEMPTS=2 + export NODES=16 + cd cli + go install github.com/onsi/ginkgo/ginkgo@v1.16.4 + + make integration-tests-full-ci + + unclaim-linux-env-with-edge-capi: + needs: + - shared-values + - run-integration-tests-linux-env-with-edge-capi + if: always() + uses: ./.github/reusable-workflows/unclaim-cf-env.yml + with: + environment: ${{ needs.shared-values.outputs.secrets-environment }} + identifier-for-metadata-file: linux-env-with-edge-capi + secrets: inherit From 60c9b2f25acb9e5f38ec5823094051c6524f5e7c Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Thu, 29 Sep 2022 16:49:14 -0700 Subject: [PATCH 02/22] You apparently can't reference things outside of workflows for uses - so moved the directory --- .github/workflows/integration.yml | 4 ++-- .github/{ => workflows}/reusable-workflows/setup-cf-env.yml | 0 .github/{ => workflows}/reusable-workflows/unclaim-cf-env.yml | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename .github/{ => workflows}/reusable-workflows/setup-cf-env.yml (100%) rename .github/{ => workflows}/reusable-workflows/unclaim-cf-env.yml (100%) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 30841d37014..d86ede46264 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -51,7 +51,7 @@ jobs: get-linux-env-with-edge-capi: needs: shared-values - uses: ./.github/reusable-workflows/setup-cf-env.yml + uses: ./.github/workflows/reusable-workflows/setup-cf-env.yml with: environment: ${{ needs.shared-values.outputs.secrets-environment }} capi-version: edge @@ -110,7 +110,7 @@ jobs: - shared-values - run-integration-tests-linux-env-with-edge-capi if: always() - uses: ./.github/reusable-workflows/unclaim-cf-env.yml + uses: ./.github/workflows/reusable-workflows/unclaim-cf-env.yml with: environment: ${{ needs.shared-values.outputs.secrets-environment }} identifier-for-metadata-file: linux-env-with-edge-capi diff --git a/.github/reusable-workflows/setup-cf-env.yml b/.github/workflows/reusable-workflows/setup-cf-env.yml similarity index 100% rename from .github/reusable-workflows/setup-cf-env.yml rename to .github/workflows/reusable-workflows/setup-cf-env.yml diff --git a/.github/reusable-workflows/unclaim-cf-env.yml b/.github/workflows/reusable-workflows/unclaim-cf-env.yml similarity index 100% rename from .github/reusable-workflows/unclaim-cf-env.yml rename to .github/workflows/reusable-workflows/unclaim-cf-env.yml From 1ab5d266fed71390c5111f9df6ce9712070cadb0 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Fri, 30 Sep 2022 10:55:14 -0700 Subject: [PATCH 03/22] Use environment name as identifier for metadata instead of hardcoding - also fix a bug with wrong variable name in unclaim - adding Shwetha cause all the work has been cribbed off of her initial start Co-authored-by: Shwetha Gururaj --- .github/workflows/integration.yml | 6 +- .../reusable-workflows/setup-cf-env.yml | 116 +++++++++--------- .../reusable-workflows/unclaim-cf-env.yml | 2 +- 3 files changed, 65 insertions(+), 59 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d86ede46264..58b025b6c79 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -55,7 +55,6 @@ jobs: with: environment: ${{ needs.shared-values.outputs.secrets-environment }} capi-version: edge - identifier-for-metadata-file: linux-env-with-edge-capi secrets: inherit run-integration-tests-linux-env-with-edge-capi: @@ -76,7 +75,7 @@ jobs: - name: Download metadata uses: actions/download-artifact@v3 with: - name: linux-env-with-edge-capi + name: ${{ needs.get-linux-env-with-edge-capi.outputs.environment-name }} - name: Run Integration Tests run: | # tools @@ -108,10 +107,11 @@ jobs: unclaim-linux-env-with-edge-capi: needs: - shared-values + - get-linux-env-with-edge-capi - run-integration-tests-linux-env-with-edge-capi if: always() uses: ./.github/workflows/reusable-workflows/unclaim-cf-env.yml with: environment: ${{ needs.shared-values.outputs.secrets-environment }} - identifier-for-metadata-file: linux-env-with-edge-capi + identifier-for-metadata-file: ${{ needs.get-linux-env-with-edge-capi.outputs.environment-name }} secrets: inherit diff --git a/.github/workflows/reusable-workflows/setup-cf-env.yml b/.github/workflows/reusable-workflows/setup-cf-env.yml index 66cba967a1b..b6f19fe5074 100644 --- a/.github/workflows/reusable-workflows/setup-cf-env.yml +++ b/.github/workflows/reusable-workflows/setup-cf-env.yml @@ -9,63 +9,69 @@ on: capi-version: required: true type: string - identifier-for-metadata-file: - required: true - type: string + outputs: + environment-name: + description: "Name of claimed environment" + value: ${{ jobs.setup-cf-env.outputs.environment-name }} jobs: - runs-on: ubuntu-latest - environment: ${{ inputs.environment }} - steps: - - name: Claim Toolsmiths Environment - env: - - TOOLSMITHS_URL: https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&pool_name=cf-deployment¬es=github-actions-syslog-release - run: | - # tools - wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp && \ - mv /tmp/bbl-* /usr/local/bin/bbl && \ - chmod +x /usr/local/bin/bbl - - # claim - if ! curl --fail -X POST "$TOOLSMITHS_URL" > metadata.json - then - echo "UNABLE TO CLAIM AN ENVIRONMENT, PLEASE RETRY LATER" - exit 1 - fi - eval "$(bbl print-env --metadata-file ./metadata.json)" + setup-cf-env: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + steps: + - id: claim-toolsmiths-env + name: Claim Toolsmiths Environment + env: + - TOOLSMITHS_URL: https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&pool_name=cf-deployment¬es=github-actions-syslog-release + run: | + # tools + wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp && \ + mv /tmp/bbl-* /usr/local/bin/bbl && \ + chmod +x /usr/local/bin/bbl + + # claim + if ! curl --fail -X POST "$TOOLSMITHS_URL" > metadata.json + then + echo "UNABLE TO CLAIM AN ENVIRONMENT, PLEASE RETRY LATER" + exit 1 + fi + eval "$(bbl print-env --metadata-file ./metadata.json)" + + ENV=$(cat metadata.json | jq -r '.name') + echo "::set-output name=environment-name::${ENV}" + + - name: Checkout cli-ci + uses: actions/checkout@v3 + with: + repository: cloudfoundry/cli-ci + path: cli-ci + + - name: Deploy edge CAPI + if: ${{ inputs.capi-version == 'edge' }} + run: | + # tools + wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P /tmp && \ + unzip -d /tmp /tmp/awscli-exe-linux-x86_64.zip && \ + ./tmp/aws/install + wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" && \ + chmod +x /usr/bin/bosh + + # find latest capi + FILENAME="$(aws s3 ls capi-releases --no-sign-request --recursive --region us-east-1 | sort | tail -n 1 | awk '{print $4}')" + aws s3 cp s3://capi-releases/$FILENAME $FILENAME --no-sign-request --region us-east-1 + eval "$(bbl print-env --metadata-file metadata.json)" + bosh upload-release --sha2 "$FILENAME" + rm $FILENAME - - name: Checkout cli-ci - uses: actions/checkout@v3 - with: - repository: cloudfoundry/cli-ci - path: cli-ci + # deploy + bosh -d cf manifest > /tmp/manifest.json + bosh -d cf deploy /tmp/manifest.json -o cli-ci/ci/infrastructure/operations/use-latest-capi.yml -n - - name: Deploy edge CAPI - if: ${{ inputs.capi-version == 'edge' }} - run: | - # tools - wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P /tmp && \ - unzip -d /tmp /tmp/awscli-exe-linux-x86_64.zip && \ - ./tmp/aws/install - wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" && \ - chmod +x /usr/bin/bosh - - # find latest capi - FILENAME="$(aws s3 ls capi-releases --no-sign-request --recursive --region us-east-1 | sort | tail -n 1 | awk '{print $4}')" - aws s3 cp s3://capi-releases/$FILENAME $FILENAME --no-sign-request --region us-east-1 - eval "$(bbl print-env --metadata-file metadata.json)" - bosh upload-release --sha2 "$FILENAME" - rm $FILENAME - - # deploy - bosh -d cf manifest > /tmp/manifest.json - bosh -d cf deploy /tmp/manifest.json -o cli-ci/ci/infrastructure/operations/use-latest-capi.yml -n - - echo "Deployed CAPI version:" - bosh -d cf releases | grep capi + echo "Deployed CAPI version:" + bosh -d cf releases | grep capi - - name: 'Upload Metadata' - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.identifier-for-metadata-file }} - path: metadata.json + - name: 'Upload Metadata' + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.claim-toolsmiths-env.outputs.environment-name }} + path: metadata.json diff --git a/.github/workflows/reusable-workflows/unclaim-cf-env.yml b/.github/workflows/reusable-workflows/unclaim-cf-env.yml index 336fde4d2cd..a5df7442c77 100644 --- a/.github/workflows/reusable-workflows/unclaim-cf-env.yml +++ b/.github/workflows/reusable-workflows/unclaim-cf-env.yml @@ -19,7 +19,7 @@ jobs: - name: Download metadata uses: actions/download-artifact@v3 with: - name: ${{ inputs.test-name }} + name: ${{ inputs.identifier-for-metadata-file }} - name: Unclaim environment run: | From b0febe28413aaef398d40e2d1582e9c91913627f Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Fri, 30 Sep 2022 10:59:54 -0700 Subject: [PATCH 04/22] Apparently you can't have any nested folders with workflows in github actions --- .github/workflows/integration.yml | 4 ++-- .github/workflows/{reusable-workflows => }/setup-cf-env.yml | 0 .github/workflows/{reusable-workflows => }/unclaim-cf-env.yml | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{reusable-workflows => }/setup-cf-env.yml (100%) rename .github/workflows/{reusable-workflows => }/unclaim-cf-env.yml (100%) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 58b025b6c79..c89ce567dde 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -51,7 +51,7 @@ jobs: get-linux-env-with-edge-capi: needs: shared-values - uses: ./.github/workflows/reusable-workflows/setup-cf-env.yml + uses: ./.github/workflows/setup-cf-env.yml with: environment: ${{ needs.shared-values.outputs.secrets-environment }} capi-version: edge @@ -110,7 +110,7 @@ jobs: - get-linux-env-with-edge-capi - run-integration-tests-linux-env-with-edge-capi if: always() - uses: ./.github/workflows/reusable-workflows/unclaim-cf-env.yml + uses: ./.github/workflows/unclaim-cf-env.yml with: environment: ${{ needs.shared-values.outputs.secrets-environment }} identifier-for-metadata-file: ${{ needs.get-linux-env-with-edge-capi.outputs.environment-name }} diff --git a/.github/workflows/reusable-workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml similarity index 100% rename from .github/workflows/reusable-workflows/setup-cf-env.yml rename to .github/workflows/setup-cf-env.yml diff --git a/.github/workflows/reusable-workflows/unclaim-cf-env.yml b/.github/workflows/unclaim-cf-env.yml similarity index 100% rename from .github/workflows/reusable-workflows/unclaim-cf-env.yml rename to .github/workflows/unclaim-cf-env.yml From f97064905fe5d915ed8d68d2902a92c648ee8447 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Fri, 30 Sep 2022 11:09:57 -0700 Subject: [PATCH 05/22] inline url cause actions not happy with extraction --- .github/workflows/setup-cf-env.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index b6f19fe5074..ba041c06576 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -21,8 +21,6 @@ jobs: steps: - id: claim-toolsmiths-env name: Claim Toolsmiths Environment - env: - - TOOLSMITHS_URL: https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&pool_name=cf-deployment¬es=github-actions-syslog-release run: | # tools wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp && \ @@ -30,7 +28,7 @@ jobs: chmod +x /usr/local/bin/bbl # claim - if ! curl --fail -X POST "$TOOLSMITHS_URL" > metadata.json + if ! curl --fail -X POST " https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&pool_name=cf-deployment¬es=github-actions-syslog-release" > metadata.json then echo "UNABLE TO CLAIM AN ENVIRONMENT, PLEASE RETRY LATER" exit 1 From 32a0e8da491f6ff549cca52ba0d5e2d1b5a7bb99 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Fri, 30 Sep 2022 11:48:53 -0700 Subject: [PATCH 06/22] Separate tools installation from claim environment Co-authored-by: Michael Oleske Co-authored-by: Al Berez --- .github/workflows/setup-cf-env.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index ba041c06576..92eec8a6c8d 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -19,16 +19,16 @@ jobs: runs-on: ubuntu-latest environment: ${{ inputs.environment }} steps: + - name: Install Tools + run: | + wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp + mv /tmp/bbl-* /usr/local/bin/bbl + chmod +x /usr/local/bin/bbl + - id: claim-toolsmiths-env name: Claim Toolsmiths Environment run: | - # tools - wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp && \ - mv /tmp/bbl-* /usr/local/bin/bbl && \ - chmod +x /usr/local/bin/bbl - - # claim - if ! curl --fail -X POST " https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&pool_name=cf-deployment¬es=github-actions-syslog-release" > metadata.json + if ! curl --fail -X POST "https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&pool_name=cf-deployment¬es=github-actions-syslog-release" > metadata.json then echo "UNABLE TO CLAIM AN ENVIRONMENT, PLEASE RETRY LATER" exit 1 From ea9bed2582393124cd780f647a03f2d81f01fd37 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Fri, 30 Sep 2022 13:18:25 -0700 Subject: [PATCH 07/22] Remove unneeded && \ --- .github/workflows/integration.yml | 17 ++++++++--------- .github/workflows/setup-cf-env.yml | 6 +++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index c89ce567dde..2bbe12e94e1 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -76,19 +76,18 @@ jobs: uses: actions/download-artifact@v3 with: name: ${{ needs.get-linux-env-with-edge-capi.outputs.environment-name }} - - name: Run Integration Tests + - name: Install Tools run: | - # tools - wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp && \ - mv /tmp/bbl-* /usr/local/bin/bbl && \ + wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp + mv /tmp/bbl-* /usr/local/bin/bbl chmod +x /usr/local/bin/bbl - wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" && \ + wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" chmod +x /usr/bin/bosh - wget https://github.com/cloudfoundry/credhub-cli/releases/download/2.9.4/credhub-linux-2.9.4.tgz -P /tmp && \ - tar xzvf /tmp/credhub-linux-2.9.4.tgz -C /usr/local/bin && \ + wget https://github.com/cloudfoundry/credhub-cli/releases/download/2.9.4/credhub-linux-2.9.4.tgz -P /tmp + tar xzvf /tmp/credhub-linux-2.9.4.tgz -C /usr/local/bin chmod +x /usr/local/bin/credhub - - # test setup + - name: Run Integration Tests + run: | ENV=$(cat metadata.json | jq -r '.name') 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 -) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index 92eec8a6c8d..fa88f501df9 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -48,10 +48,10 @@ jobs: if: ${{ inputs.capi-version == 'edge' }} run: | # tools - wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P /tmp && \ - unzip -d /tmp /tmp/awscli-exe-linux-x86_64.zip && \ + wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P /tmp + unzip -d /tmp /tmp/awscli-exe-linux-x86_64.zip ./tmp/aws/install - wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" && \ + wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" chmod +x /usr/bin/bosh # find latest capi From c922064f8754d614dba82e66cc29bd792ec51039 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Fri, 30 Sep 2022 22:33:16 +0000 Subject: [PATCH 08/22] Intelligent toolsmith error handling Optimize steps order Co-authored-by: Michael Oleske --- .github/workflows/setup-cf-env.yml | 64 ++++++++++++++++++---------- .github/workflows/unclaim-cf-env.yml | 19 ++++++++- 2 files changed, 60 insertions(+), 23 deletions(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index fa88f501df9..55a2c0fb9f9 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -19,41 +19,67 @@ jobs: runs-on: ubuntu-latest environment: ${{ inputs.environment }} steps: - - name: Install Tools - run: | - wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp - mv /tmp/bbl-* /usr/local/bin/bbl - chmod +x /usr/local/bin/bbl - - id: claim-toolsmiths-env name: Claim Toolsmiths Environment + env: + api_token: ${{ secrets.TOOLSMITHS_API_TOKEN }} + hostname: environments.toolsmiths.cf-app.com + notes: CF CLI Github Actions Integration Tests + pool_name: cf-deployment run: | - if ! curl --fail -X POST "https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/claim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&pool_name=cf-deployment¬es=github-actions-syslog-release" > metadata.json - then - echo "UNABLE TO CLAIM AN ENVIRONMENT, PLEASE RETRY LATER" - exit 1 - fi - eval "$(bbl print-env --metadata-file ./metadata.json)" + while true; do + curl -s --show-error -D >(tee headers.txt >&2) -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..." + + 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" + + sleep 30 + done ENV=$(cat metadata.json | jq -r '.name') echo "::set-output name=environment-name::${ENV}" + - name: 'Upload Metadata' + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.claim-toolsmiths-env.outputs.environment-name }} + path: metadata.json + - name: Checkout cli-ci uses: actions/checkout@v3 with: repository: cloudfoundry/cli-ci path: cli-ci - - name: Deploy edge CAPI - if: ${{ inputs.capi-version == 'edge' }} + - name: Install Tools run: | - # tools + wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp + mv /tmp/bbl-* /usr/local/bin/bbl + chmod +x /usr/local/bin/bbl + wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P /tmp unzip -d /tmp /tmp/awscli-exe-linux-x86_64.zip ./tmp/aws/install + wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" chmod +x /usr/bin/bosh - + + - name: Deploy edge CAPI + if: ${{ inputs.capi-version == 'edge' }} + run: | # find latest capi FILENAME="$(aws s3 ls capi-releases --no-sign-request --recursive --region us-east-1 | sort | tail -n 1 | awk '{print $4}')" aws s3 cp s3://capi-releases/$FILENAME $FILENAME --no-sign-request --region us-east-1 @@ -67,9 +93,3 @@ jobs: echo "Deployed CAPI version:" bosh -d cf releases | grep capi - - - name: 'Upload Metadata' - uses: actions/upload-artifact@v3 - with: - name: ${{ steps.claim-toolsmiths-env.outputs.environment-name }} - path: metadata.json diff --git a/.github/workflows/unclaim-cf-env.yml b/.github/workflows/unclaim-cf-env.yml index a5df7442c77..970eef48906 100644 --- a/.github/workflows/unclaim-cf-env.yml +++ b/.github/workflows/unclaim-cf-env.yml @@ -22,5 +22,22 @@ jobs: name: ${{ inputs.identifier-for-metadata-file }} - name: Unclaim environment + env: + api_token: ${{ secrets.TOOLSMITHS_API_TOKEN }} + hostname: environments.toolsmiths.cf-app.com run: | - curl -X POST "https://environments.toolsmiths.cf-app.com/pooled_gcp_engineering_environments/unclaim?api_token=${{ secrets.TOOLSMITHS_API_TOKEN }}&name=$(cat metadata.json | jq -r .name)" \ No newline at end of file + env_name=$(cat metadata.json | jq -r .name) + + while true; do + output=$(curl -s --show-error -D >(tee headers.txt >&2) -H 'Accept: application/json' \ + -X POST "https://${hostname}/pooled_gcp_engineering_environments/unclaim" \ + --data-urlencode "api_token=${api_token}" \ + --data-urlencode "name=${env_name}") + + 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 \ No newline at end of file From 6aa2017bcb56dca6720a1a9ae9fe3ef95acfd993 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Fri, 30 Sep 2022 22:51:38 +0000 Subject: [PATCH 09/22] Make TOOLSMITHS_HOSTNAME secret Co-authored-by: Michael Oleske --- .github/workflows/setup-cf-env.yml | 2 +- .github/workflows/unclaim-cf-env.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index 55a2c0fb9f9..29a87a8f4ed 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -23,7 +23,7 @@ jobs: name: Claim Toolsmiths Environment env: api_token: ${{ secrets.TOOLSMITHS_API_TOKEN }} - hostname: environments.toolsmiths.cf-app.com + hostname: ${{ secrets.TOOLSMITHS_HOSTNAME }} notes: CF CLI Github Actions Integration Tests pool_name: cf-deployment run: | diff --git a/.github/workflows/unclaim-cf-env.yml b/.github/workflows/unclaim-cf-env.yml index 970eef48906..6871545663f 100644 --- a/.github/workflows/unclaim-cf-env.yml +++ b/.github/workflows/unclaim-cf-env.yml @@ -24,7 +24,7 @@ jobs: - name: Unclaim environment env: api_token: ${{ secrets.TOOLSMITHS_API_TOKEN }} - hostname: environments.toolsmiths.cf-app.com + hostname: ${{ secrets.TOOLSMITHS_HOSTNAME }} run: | env_name=$(cat metadata.json | jq -r .name) From e7bc25bc1df09124eda86f0b75ba1b05924caeef Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Mon, 3 Oct 2022 09:44:11 -0700 Subject: [PATCH 10/22] Use correct path for aws install - use absolute path (`/tmp/aws/install`) instead of relative path (`./tmp/aws/install`) --- .github/workflows/setup-cf-env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index 29a87a8f4ed..89fb3645ecf 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -72,7 +72,7 @@ jobs: wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P /tmp unzip -d /tmp /tmp/awscli-exe-linux-x86_64.zip - ./tmp/aws/install + /tmp/aws/install wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" chmod +x /usr/bin/bosh From d5a886cd3dabe0371a8f61c62f50eef51d073374 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Mon, 3 Oct 2022 10:17:59 -0700 Subject: [PATCH 11/22] Use output of step instead of job for setup-cf-env - previously was trying to get the output of a job, but the output is actually from a step, so would be blank --- .github/workflows/setup-cf-env.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index 89fb3645ecf..8b2ae4759f1 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -12,7 +12,7 @@ on: outputs: environment-name: description: "Name of claimed environment" - value: ${{ jobs.setup-cf-env.outputs.environment-name }} + value: ${{ steps.claim-toolsmiths-env.outputs.environment-name }} jobs: setup-cf-env: From 54e4b9f1caa2f99e1b0ad794a46b25105fcc89d7 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Tue, 4 Oct 2022 11:47:26 -0700 Subject: [PATCH 12/22] Add step output to setup cf env - you need to also output on the step, which you then pass to the job output --- .github/workflows/setup-cf-env.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index 8b2ae4759f1..ac671915de8 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -12,12 +12,14 @@ on: outputs: environment-name: description: "Name of claimed environment" - value: ${{ steps.claim-toolsmiths-env.outputs.environment-name }} + value: ${{ jobs.setup-cf-env.outputs.environment-name }} jobs: setup-cf-env: runs-on: ubuntu-latest environment: ${{ inputs.environment }} + outputs: + environment-name: ${{ steps.claim-toolsmiths-env.outputs.environment-name }} steps: - id: claim-toolsmiths-env name: Claim Toolsmiths Environment From d9660899daa6912a1c221b7626823f8456335e84 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Tue, 4 Oct 2022 16:29:47 -0700 Subject: [PATCH 13/22] remove aws cli install aws tools already exist on [github provided images](https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#cli-tools) --- .github/workflows/setup-cf-env.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index ac671915de8..fb0487c149e 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -72,10 +72,6 @@ jobs: mv /tmp/bbl-* /usr/local/bin/bbl chmod +x /usr/local/bin/bbl - wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P /tmp - unzip -d /tmp /tmp/awscli-exe-linux-x86_64.zip - /tmp/aws/install - wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" chmod +x /usr/bin/bosh From 86fa39af3ea2388582755cf3f19e19c2f478b7d0 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Tue, 4 Oct 2022 16:38:44 -0700 Subject: [PATCH 14/22] Use /usr/local/bin for bosh also add print of bosh --version and bbl --version just to make sure they are available --- .github/workflows/setup-cf-env.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/setup-cf-env.yml b/.github/workflows/setup-cf-env.yml index fb0487c149e..0e6a813c037 100644 --- a/.github/workflows/setup-cf-env.yml +++ b/.github/workflows/setup-cf-env.yml @@ -71,9 +71,11 @@ jobs: wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp mv /tmp/bbl-* /usr/local/bin/bbl chmod +x /usr/local/bin/bbl + bbl --version - wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" - chmod +x /usr/bin/bosh + wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/local/bin/bosh" + chmod +x /usr/local/bin/bosh + bosh --version - name: Deploy edge CAPI if: ${{ inputs.capi-version == 'edge' }} From acba28bb0f9e93f9533b27cd74907efaff23608d Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Tue, 4 Oct 2022 16:54:39 -0700 Subject: [PATCH 15/22] use /usr/local/bin for bosh missed this in the last commit :( --- .github/workflows/integration.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 2bbe12e94e1..98d06a9f2b9 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -81,11 +81,16 @@ jobs: wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp mv /tmp/bbl-* /usr/local/bin/bbl chmod +x /usr/local/bin/bbl - wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/bin/bosh" - chmod +x /usr/bin/bosh + bbl --version + + wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/local/bin/bosh" + chmod +x /usr/local/bin/bosh + bosh --version + wget https://github.com/cloudfoundry/credhub-cli/releases/download/2.9.4/credhub-linux-2.9.4.tgz -P /tmp tar xzvf /tmp/credhub-linux-2.9.4.tgz -C /usr/local/bin chmod +x /usr/local/bin/credhub + credhub --version - name: Run Integration Tests run: | ENV=$(cat metadata.json | jq -r '.name') From 1fdabae190537ca7e4feeb1223171f22c9a79aad Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Tue, 4 Oct 2022 17:14:56 -0700 Subject: [PATCH 16/22] extract credhub to tmp and then move to /usr/local/bin resolve the following error cause by tar permission issues ``` tar: .: Cannot utime: Operation not permitted tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted tar: Exiting with failure status due to previous errors ``` --- .github/workflows/integration.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 98d06a9f2b9..58d2245bdfa 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -88,7 +88,8 @@ jobs: bosh --version wget https://github.com/cloudfoundry/credhub-cli/releases/download/2.9.4/credhub-linux-2.9.4.tgz -P /tmp - tar xzvf /tmp/credhub-linux-2.9.4.tgz -C /usr/local/bin + tar xzvf /tmp/credhub-linux-2.9.4.tgz -C /tmp + mv /tmp/credhub /usr/local/bin/credhub chmod +x /usr/local/bin/credhub credhub --version - name: Run Integration Tests From d3c5b7a6ee1a467c0a27356d3fce999a1d47a097 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Wed, 5 Oct 2022 10:26:18 -0700 Subject: [PATCH 17/22] write credhub.tgz to home directory github provided machines don't allow tar to create folders in tmp for some reason, so this really resolves the error in the previously mentioned commit --- .github/workflows/integration.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 58d2245bdfa..27b358e3faa 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -87,11 +87,12 @@ jobs: chmod +x /usr/local/bin/bosh bosh --version - wget https://github.com/cloudfoundry/credhub-cli/releases/download/2.9.4/credhub-linux-2.9.4.tgz -P /tmp - tar xzvf /tmp/credhub-linux-2.9.4.tgz -C /tmp - mv /tmp/credhub /usr/local/bin/credhub + wget https://github.com/cloudfoundry/credhub-cli/releases/download/2.9.4/credhub-linux-2.9.4.tgz -P ~/ + tar xzvf ~/credhub-linux-2.9.4.tgz + mv credhub /usr/local/bin/credhub chmod +x /usr/local/bin/credhub credhub --version + rm ~/credhub-linux-2.9.4.tgz - name: Run Integration Tests run: | ENV=$(cat metadata.json | jq -r '.name') From 2bbfdfca558cd9d66b07c97274a8815e514685ac Mon Sep 17 00:00:00 2001 From: Juan Diego Date: Wed, 5 Oct 2022 14:43:25 -0500 Subject: [PATCH 18/22] Delets unecessary line Unclaiming the toolsmith environment does not need the integration test to be completed with an output in order to run the unclaim job --- .github/workflows/integration.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 27b358e3faa..cdfa7b2ea34 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -114,7 +114,6 @@ jobs: needs: - shared-values - get-linux-env-with-edge-capi - - run-integration-tests-linux-env-with-edge-capi if: always() uses: ./.github/workflows/unclaim-cf-env.yml with: From 4b8f3cc8226f6f9b9265fba80dcb99882d56732c Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Thu, 6 Oct 2022 15:20:08 -0700 Subject: [PATCH 19/22] don't need to cd into cli as that's what checkout does - use quotes on some exports when getting passwords out of credhub --- .github/workflows/integration.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index cdfa7b2ea34..7ba8b77b905 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -97,15 +97,14 @@ jobs: run: | ENV=$(cat metadata.json | jq -r '.name') 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-$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_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" export CF_DIAL_TIMEOUT=15 export CF_USERNAME=admin export FLAKE_ATTEMPTS=2 export NODES=16 - cd cli go install github.com/onsi/ginkgo/ginkgo@v1.16.4 make integration-tests-full-ci From 8f16cc59cd278f85d4c0329dfe68fe3912cff874 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Fri, 7 Oct 2022 09:36:03 -0700 Subject: [PATCH 20/22] Add built cli to path - because `make integration-tests-full-ci` expects cf cli to be on the path --- .github/workflows/integration.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7ba8b77b905..70dc5f0e43c 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -107,6 +107,8 @@ jobs: export NODES=16 go install github.com/onsi/ginkgo/ginkgo@v1.16.4 + make build + export PATH="$(pwd)/out:$PATH" make integration-tests-full-ci unclaim-linux-env-with-edge-capi: From eb2705e4325a7cd2d8398e97e6bacbd63875cb46 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Wed, 12 Oct 2022 14:40:56 -0700 Subject: [PATCH 21/22] remove oidc credentials cf toolsmiths environments don't have an oidc provider configured --- .github/workflows/integration.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 70dc5f0e43c..62039f63035 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -98,8 +98,6 @@ jobs: ENV=$(cat metadata.json | jq -r '.name') 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" export CF_DIAL_TIMEOUT=15 export CF_USERNAME=admin From f3209f4d88ac3422b18ab04b55c059790f5c160c Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Wed, 12 Oct 2022 16:09:01 -0700 Subject: [PATCH 22/22] force unclaim to only run after run-integration-tests - we removed this before, but it is needed to make sure we don't run the unclaim job before the integration tests run. Otherwise we've unclaimed and destroyed the environment before we even run integration tests! --- .github/workflows/integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 62039f63035..75be0376a87 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -113,6 +113,7 @@ jobs: needs: - shared-values - get-linux-env-with-edge-capi + - run-integration-tests-linux-env-with-edge-capi if: always() uses: ./.github/workflows/unclaim-cf-env.yml with: