diff --git a/.github/workflows/build-cf-cli.yml b/.github/workflows/build-cf-cli.yml new file mode 100644 index 00000000000..93e3914e49b --- /dev/null +++ b/.github/workflows/build-cf-cli.yml @@ -0,0 +1,154 @@ +name: Build Binaries + +on: + workflow_dispatch: + pull_request: + branches: + - main + - v8 + - v7 + paths-ignore: + - 'doc/**' + - '.gitpod.yml' + - 'README.md' + push: + # branches: + # - main + # - v8 + # - v7 + # paths-ignore: + # - 'doc/**' + # - '.github/**' + # - '.gitpod.yml' + # - 'README.md' + +# permissions: +# contents: read + +jobs: + shared-values: + name: Shared Values + runs-on: ubuntu-latest + outputs: + go-version: ${{ steps.set-go-version.outputs.go-version }} + cf-build-sha: ${{ steps.set-build-sha.outputs.cf-build-sha }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - 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 "go-version=${go_version[1]}" >> $GITHUB_OUTPUT + + - id: set-build-sha + name: Get Build SHA + run: | + build_sha=$(git rev-parse --short HEAD) + echo "cf-build-sha=${build_sha}" >> $GITHUB_OUTPUT + # echo $build-sha > ./sha + + # - name: 'Export SHA' + # uses: actions/upload-artifact@v3 + # with: + # name: sha + # path: ./sha + + build-linux-binaries: + name: Build Linux binaries + runs-on: ubuntu-latest + needs: + - shared-values + outputs: + linux-binaries: ${{ steps.build-linux-binaries.outputs.linux-binaries }} + 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 }} + + - name: Build Linux + id: build-linux + run: | + set -ex + + export GOPATH=$PWD/gopath + export PATH=$GOPATH/bin:$PATH + + go version + + export CF_BUILD_SHA=${{ needs.shared-values.outputs.cf-build-sha }} + + # echo "Building 32-bit Linux" + # make out/cf-cli_linux_i686 + + echo "Building 64-bit Linux" + make out/cf-cli_linux_x86-64 + + echo "Creating tarball" + tar -cvzf ${PWD}/cf-cli-linux-binaries-${CF_BUILD_SHA}.tgz -C out . + linux_binaries="cf-cli-linux-binaries-${CF_BUILD_SHA}.tgz" + echo "linux-binaries=${linux_binaries}" >> $GITHUB_OUTPUT + + - name: 'Upload Linux Binaries' + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build-linux.outputs.linux-binaries }} + path: ./cf-cli-linux-binaries-* + + # build-windows-binaries: + # name: Build Windows binaries + # runs-on: windows-latest + # needs: + # - shared-values + # outputs: + # windows-binaries: ${{ steps.build-windows-binaries.outputs.windows-binaries }} + # 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 }} + + # - name: Get build-time dependencies + # run: | + # choco install --no-progress --limit-output -y make + # go install github.com/akavel/rsrc@v0.10.2 + + # - name: Build Windows + # id: build-windows + # run: | + # Get-Command make + # Get-Item Makefile + + # $CF_BUILD_SHA="${{ needs.shared-values.outputs.cf-build-sha }}" + + # # echo "Building 32-bit Windows" + # # make out/cf-cli_win32.exe + + # echo "Building 64-bit Windows" + # make out/cf-cli_winx64.exe + + # echo "Creating tarball" + # tar -cvzf cf-cli-windows-binaries-${CF_BUILD_SHA}.tgz -C out . + # $windows_binaries="cf-cli-windows-binaries-${CF_BUILD_SHA}.tgz" + # echo "windows-binaries ================ ${windows_binaries}" + # echo "windows-binaries=${windows_binaries}" >> $GITHUB_OUTPUT + + # - name: 'Upload Windows Binaries' + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ steps.build-windows.outputs.windows-binaries }} + # path: cf-cli-windows-binaries-* + + # - name: Setup tmate session + # if: always() + # uses: mxschmitt/action-tmate@v3 diff --git a/.github/workflows/cf-env-setup.yml b/.github/workflows/cf-env-setup.yml index 83b4f1c019c..ff6546e716f 100644 --- a/.github/workflows/cf-env-setup.yml +++ b/.github/workflows/cf-env-setup.yml @@ -61,113 +61,113 @@ jobs: 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: Checkout cf-deployment Min CAPI - if: ${{ inputs.capi-version != 'edge' }} - uses: actions/checkout@v3 - with: - repository: cloudfoundry/cf-deployment - path: cf-deployment - ref: ${{ inputs.capi-version }} - - - name: Checkout cf-deployment - uses: actions/checkout@v3 - if: ${{ inputs.capi-version == 'edge' }} - with: - repository: cloudfoundry/cf-deployment - path: cf-deployment - - - name: Checkout CF deployment tasks - uses: actions/checkout@v3 - with: - repository: cloudfoundry/cf-deployment-concourse-tasks - path: cf-deployment-concourse-tasks - - - 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 - 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 - - - name: Deploy edge CAPI with Isolation Segment and OIDC Provider - if: ${{ inputs.capi-version == 'edge' }} - env: - CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - 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 - eval "$(bbl print-env --metadata-file metadata.json)" - bosh upload-release --sha2 "$FILENAME" - rm $FILENAME - - # deploy - bosh -d cf manifest > /tmp/manifest.yml - bosh interpolate /tmp/manifest.yml \ - -o cf-deployment/operations/test/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 \ - -o cli-ci/ci/infrastructure/operations/use-latest-capi.yml \ - -v client-secret="${CF_INT_CLIENT_SECRET}" \ - > ./director.yml - - bosh -d cf deploy director.yml -n - echo "Deployed CAPI version:" - bosh -d cf releases | grep capi - - - name: Deploy MIN CAPI with Isolation Segment and OIDC Provider - if: ${{ inputs.capi-version != 'edge' }} - run: | - # Creates vars files - mkdir vars-files - echo "cs = ${{ secrets.CLIENT_SECRET }}" - cat << EOF > vars-files/vars.yml - client-secret: ${{ secrets.CLIENT_SECRET }} - EOF - - # Copy Ops files - mkdir ops-files - cp cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml ops-files/ - cp cli-ci/ci/infrastructure/operations/add-oidc-provider.yml ops-files/ - cp cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml ops-files/ - - # Deletes CF-D - eval "$(bbl print-env --metadata-file metadata.json)" - bosh -d cf delete-deployment -n - - # Deploy CF-D - mkdir toolsmiths-env - cp metadata.json toolsmiths-env/metadata - cat metadata.json | jq -r .name > toolsmiths-env/name - export VARS_FILES="vars.yml" - export MANIFEST_FILE="cf-deployment.yml" - export SYSTEM_DOMAIN="" - export REGENERATE_CREDENTIALS=false - export DEPLOY_WITH_UPTIME_MEASUREMENTS=false - export MEASURE_SYSLOG_AVAILABILITY=false - export TCP_DOMAIN="" - export AVAILABLE_PORT="" - export FAIL_ON_DOWNTIME=false - export APP_PUSHABILITY_THRESHOLD=0 - export HTTP_AVAILABILITY_THRESHOLD=0 - export RECENT_LOGS_THRESHOLD=0 - export STREAMING_LOGS_THRESHOLD=0 - export APP_SYSLOG_AVAILABILITY_THRESHOLD=0 - export USE_SINGLE_APP_INSTANCE=false - export BOSH_DEPLOY_ARGS="" - export BOSH_LITE=false - export BBL_JSON_CONFIG="" - export OPS_FILES="add-persistent-isolation-segment-diego-cell.yml \ - add-uaa-client-credentials.yml \ - add-oidc-provider.yml" - ./cf-deployment-concourse-tasks/bosh-deploy/task + # - name: Checkout cli-ci + # uses: actions/checkout@v3 + # with: + # repository: cloudfoundry/cli-ci + # path: cli-ci + + # - name: Checkout cf-deployment Min CAPI + # if: ${{ inputs.capi-version != 'edge' }} + # uses: actions/checkout@v3 + # with: + # repository: cloudfoundry/cf-deployment + # path: cf-deployment + # ref: ${{ inputs.capi-version }} + + # - name: Checkout cf-deployment + # uses: actions/checkout@v3 + # if: ${{ inputs.capi-version == 'edge' }} + # with: + # repository: cloudfoundry/cf-deployment + # path: cf-deployment + + # - name: Checkout CF deployment tasks + # uses: actions/checkout@v3 + # with: + # repository: cloudfoundry/cf-deployment-concourse-tasks + # path: cf-deployment-concourse-tasks + + # - 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 + # 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 + + # - name: Deploy edge CAPI with Isolation Segment and OIDC Provider + # if: ${{ inputs.capi-version == 'edge' }} + # env: + # CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + # 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 + # eval "$(bbl print-env --metadata-file metadata.json)" + # bosh upload-release --sha2 "$FILENAME" + # rm $FILENAME + + # # deploy + # bosh -d cf manifest > /tmp/manifest.yml + # bosh interpolate /tmp/manifest.yml \ + # -o cf-deployment/operations/test/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 \ + # -o cli-ci/ci/infrastructure/operations/use-latest-capi.yml \ + # -v client-secret="${CF_INT_CLIENT_SECRET}" \ + # > ./director.yml + + # bosh -d cf deploy director.yml -n + # echo "Deployed CAPI version:" + # bosh -d cf releases | grep capi + + # - name: Deploy MIN CAPI with Isolation Segment and OIDC Provider + # if: ${{ inputs.capi-version != 'edge' }} + # run: | + # # Creates vars files + # mkdir vars-files + # echo "cs = ${{ secrets.CLIENT_SECRET }}" + # cat << EOF > vars-files/vars.yml + # client-secret: ${{ secrets.CLIENT_SECRET }} + # EOF + + # # Copy Ops files + # mkdir ops-files + # cp cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml ops-files/ + # cp cli-ci/ci/infrastructure/operations/add-oidc-provider.yml ops-files/ + # cp cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml ops-files/ + + # # Deletes CF-D + # eval "$(bbl print-env --metadata-file metadata.json)" + # bosh -d cf delete-deployment -n + + # # Deploy CF-D + # mkdir toolsmiths-env + # cp metadata.json toolsmiths-env/metadata + # cat metadata.json | jq -r .name > toolsmiths-env/name + # export VARS_FILES="vars.yml" + # export MANIFEST_FILE="cf-deployment.yml" + # export SYSTEM_DOMAIN="" + # export REGENERATE_CREDENTIALS=false + # export DEPLOY_WITH_UPTIME_MEASUREMENTS=false + # export MEASURE_SYSLOG_AVAILABILITY=false + # export TCP_DOMAIN="" + # export AVAILABLE_PORT="" + # export FAIL_ON_DOWNTIME=false + # export APP_PUSHABILITY_THRESHOLD=0 + # export HTTP_AVAILABILITY_THRESHOLD=0 + # export RECENT_LOGS_THRESHOLD=0 + # export STREAMING_LOGS_THRESHOLD=0 + # export APP_SYSLOG_AVAILABILITY_THRESHOLD=0 + # export USE_SINGLE_APP_INSTANCE=false + # export BOSH_DEPLOY_ARGS="" + # export BOSH_LITE=false + # export BBL_JSON_CONFIG="" + # export OPS_FILES="add-persistent-isolation-segment-diego-cell.yml \ + # add-uaa-client-credentials.yml \ + # add-oidc-provider.yml" + # ./cf-deployment-concourse-tasks/bosh-deploy/task diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index ce1a4e9841a..4ea6ac953ea 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,42 +1,36 @@ name: Integration Tests on: - workflow_dispatch: - pull_request: - branches: - - main - - v8 - - v7 - paths-ignore: - - 'doc/**' - - '.gitpod.yml' - - 'README.md' - push: - branches: - - main - - v8 - - v7 - paths-ignore: - - 'doc/**' - - '.github/**' - - '.gitpod.yml' - - 'README.md' + workflow_run: + workflows: [Build Binaries] + types: [completed] permissions: contents: read -jobs: +jobs: shared-values: name: Shared Values + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest outputs: secrets-environment: ${{ steps.set-secrets-environment.outputs.secrets-environment }} go-version: ${{ steps.set-go-version.outputs.go-version }} min-capi: ${{ steps.get-min-capi.outputs.min-capi }} + cf-build-sha: ${{ steps.set-build-sha.outputs.cf-build-sha }} steps: + - id: set-build-sha + name: Get Build SHA + run: | + # build_sha=$(echo '${{ github.event.workflow_run.head_sha }}' | awk '{print substr($0,0,7)}') + # echo "cf-build-sha=${build_sha}" >> $GITHUB_OUTPUT + echo "cf-build-sha=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_OUTPUT + - name: Checkout uses: actions/checkout@v3 + with: + ref: ${{ github.event.workflow_run.head_sha }} - id: set-secrets-environment name: Set environment @@ -55,6 +49,10 @@ jobs: min_capi=($(yq .cf-d-capi-version-min build_data.yml)) echo "Minimum CAPI version: ${min_capi}" echo "min-capi=${min_capi}" >> $GITHUB_OUTPUT + + # - name: Setup tmate session + # if: always() + # uses: mxschmitt/action-tmate@v3 ## START edge CAPI @@ -74,6 +72,7 @@ jobs: - get-cf-env-with-edge-capi uses: ./.github/workflows/run-integration-tests.yml with: + cf-build-sha: ${{ needs.shared-values.outputs.cf-build-sha }} go-version: ${{ needs.shared-values.outputs.go-version}} environment: ${{ needs.shared-values.outputs.secrets-environment }} environment-name: ${{ needs.get-cf-env-with-edge-capi.outputs.environment-name }} @@ -94,211 +93,211 @@ jobs: ## END edge CAPI -## Start edge CAPI Client Creds - get-cf-env-with-edge-capi-client-creds: - name: Setup CF env with EDGE CAPI Client Credentials - needs: shared-values - uses: ./.github/workflows/cf-env-setup.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - capi-version: edge - secrets: inherit +# ## Start edge CAPI Client Creds +# get-cf-env-with-edge-capi-client-creds: +# name: Setup CF env with EDGE CAPI Client Credentials +# needs: shared-values +# uses: ./.github/workflows/cf-env-setup.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# capi-version: edge +# secrets: inherit - run-integration-tests-cf-env-with-edge-capi-client-creds: - name: Integration tests with EDGE CAPI Client Credentials - needs: - - shared-values - - get-cf-env-with-edge-capi-client-creds - uses: ./.github/workflows/run-integration-tests.yml - with: - go-version: ${{ needs.shared-values.outputs.go-version}} - environment: ${{ needs.shared-values.outputs.secrets-environment }} - environment-name: ${{ needs.get-cf-env-with-edge-capi-client-creds.outputs.environment-name }} - run-with-client-creds: true - secrets: inherit +# run-integration-tests-cf-env-with-edge-capi-client-creds: +# name: Integration tests with EDGE CAPI Client Credentials +# needs: +# - shared-values +# - get-cf-env-with-edge-capi-client-creds +# uses: ./.github/workflows/run-integration-tests.yml +# with: +# go-version: ${{ needs.shared-values.outputs.go-version}} +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# environment-name: ${{ needs.get-cf-env-with-edge-capi-client-creds.outputs.environment-name }} +# run-with-client-creds: true +# secrets: inherit - unclaim-cf-env-with-edge-capi-client-creds: - name: Unclaim CF env with EDGE CAPI - needs: - - shared-values - - get-cf-env-with-edge-capi-client-creds - - run-integration-tests-cf-env-with-edge-capi-client-creds - if: always() - uses: ./.github/workflows/cf-env-unclaim.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - toolsmith-env-name: ${{ needs.get-cf-env-with-edge-capi-client-creds.outputs.environment-name }} - secrets: inherit -## END edge CAPI Client Creds +# unclaim-cf-env-with-edge-capi-client-creds: +# name: Unclaim CF env with EDGE CAPI +# needs: +# - shared-values +# - get-cf-env-with-edge-capi-client-creds +# - run-integration-tests-cf-env-with-edge-capi-client-creds +# if: always() +# uses: ./.github/workflows/cf-env-unclaim.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# toolsmith-env-name: ${{ needs.get-cf-env-with-edge-capi-client-creds.outputs.environment-name }} +# secrets: inherit +# ## END edge CAPI Client Creds -## START min CAPI - get-cf-env-with-min-capi: - name: Setup CF env with MIN CAPI - needs: shared-values - uses: ./.github/workflows/cf-env-setup.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - capi-version: ${{ needs.shared-values.outputs.min-capi}} - secrets: inherit +# ## START min CAPI +# get-cf-env-with-min-capi: +# name: Setup CF env with MIN CAPI +# needs: shared-values +# uses: ./.github/workflows/cf-env-setup.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# capi-version: ${{ needs.shared-values.outputs.min-capi}} +# secrets: inherit - run-integration-tests-cf-env-with-min-capi: - name: Integration tests with MIN CAPI - needs: - - shared-values - - get-cf-env-with-min-capi - uses: ./.github/workflows/run-integration-tests.yml - with: - go-version: ${{ needs.shared-values.outputs.go-version}} - environment: ${{ needs.shared-values.outputs.secrets-environment }} - environment-name: ${{ needs.get-cf-env-with-min-capi.outputs.environment-name }} - run-with-client-creds: false +# run-integration-tests-cf-env-with-min-capi: +# name: Integration tests with MIN CAPI +# needs: +# - shared-values +# - get-cf-env-with-min-capi +# uses: ./.github/workflows/run-integration-tests.yml +# with: +# go-version: ${{ needs.shared-values.outputs.go-version}} +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# environment-name: ${{ needs.get-cf-env-with-min-capi.outputs.environment-name }} +# run-with-client-creds: false - unclaim-cf-env-with-min-capi: - name: Unclaim CF env with MIN CAPI - needs: - - shared-values - - get-cf-env-with-min-capi - - run-integration-tests-cf-env-with-min-capi - if: always() - uses: ./.github/workflows/cf-env-unclaim.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - toolsmith-env-name: ${{ needs.get-cf-env-with-min-capi.outputs.environment-name }} - secrets: inherit +# unclaim-cf-env-with-min-capi: +# name: Unclaim CF env with MIN CAPI +# needs: +# - shared-values +# - get-cf-env-with-min-capi +# - run-integration-tests-cf-env-with-min-capi +# if: always() +# uses: ./.github/workflows/cf-env-unclaim.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# toolsmith-env-name: ${{ needs.get-cf-env-with-min-capi.outputs.environment-name }} +# secrets: inherit -## END min CAPI +# ## END min CAPI -## START windows - get-windows-cf-env-with-edge-capi: - name: Setup CF env with EDGE CAPI for windows - needs: shared-values - uses: ./.github/workflows/cf-env-setup.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - capi-version: edge - secrets: inherit +# ## START windows +# get-windows-cf-env-with-edge-capi: +# name: Setup CF env with EDGE CAPI for windows +# needs: shared-values +# uses: ./.github/workflows/cf-env-setup.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# capi-version: edge +# secrets: inherit - setup-windows-integration: - name: Setup Integration Tests Windows - needs: - - shared-values - - get-windows-cf-env-with-edge-capi - uses: ./.github/workflows/windows-integration-setup.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - environment-name: ${{ needs.get-windows-cf-env-with-edge-capi.outputs.environment-name }} +# setup-windows-integration: +# name: Setup Integration Tests Windows +# needs: +# - shared-values +# - get-windows-cf-env-with-edge-capi +# uses: ./.github/workflows/windows-integration-setup.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# environment-name: ${{ needs.get-windows-cf-env-with-edge-capi.outputs.environment-name }} - run-windows-integration-tests: - name: Run Integration tests Windows - needs: - - shared-values - - get-windows-cf-env-with-edge-capi - - setup-windows-integration - runs-on: windows-latest - defaults: - run: - shell: pwsh - environment: ${{ needs.shared-values.outputs.secrets-environment }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: cli - - 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: ${{ needs.get-windows-cf-env-with-edge-capi.outputs.environment-name }} +# run-windows-integration-tests: +# name: Run Integration tests Windows +# needs: +# - shared-values +# - get-windows-cf-env-with-edge-capi +# - setup-windows-integration +# runs-on: windows-latest +# defaults: +# run: +# shell: pwsh +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# with: +# path: cli +# - 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: ${{ needs.get-windows-cf-env-with-edge-capi.outputs.environment-name }} - - name: Download CF data - uses: actions/download-artifact@v3 - with: - name: cf-windows-data - - name: Run Integration Tests - run: cli/.github/win/integrations/integration-tests.ps1 +# - name: Download CF data +# uses: actions/download-artifact@v3 +# with: +# name: cf-windows-data +# - name: Run Integration Tests +# run: cli/.github/win/integrations/integration-tests.ps1 - unclaim-cf-windows-env-with-edge-capi: - name: Unclaim CF windows env with edge CAPI - needs: - - shared-values - - get-windows-cf-env-with-edge-capi - - run-windows-integration-tests - if: always() - uses: ./.github/workflows/cf-env-unclaim.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - toolsmith-env-name: ${{ needs.get-windows-cf-env-with-edge-capi.outputs.environment-name }} - secrets: inherit +# unclaim-cf-windows-env-with-edge-capi: +# name: Unclaim CF windows env with edge CAPI +# needs: +# - shared-values +# - get-windows-cf-env-with-edge-capi +# - run-windows-integration-tests +# if: always() +# uses: ./.github/workflows/cf-env-unclaim.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# toolsmith-env-name: ${{ needs.get-windows-cf-env-with-edge-capi.outputs.environment-name }} +# secrets: inherit -## START windows client credentials - get-windows-cc-cf-env-with-edge-capi: - name: Setup CF env with EDGE CAPI for windows Client Credentials - needs: shared-values - uses: ./.github/workflows/cf-env-setup.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - capi-version: edge - secrets: inherit +# ## START windows client credentials +# get-windows-cc-cf-env-with-edge-capi: +# name: Setup CF env with EDGE CAPI for windows Client Credentials +# needs: shared-values +# uses: ./.github/workflows/cf-env-setup.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# capi-version: edge +# secrets: inherit - setup-windows-integration-client-credentials: - name: Setup Integration Tests Windows Client Credentials - needs: - - shared-values - - get-windows-cc-cf-env-with-edge-capi - uses: ./.github/workflows/windows-integration-setup.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - environment-name: ${{ needs.get-windows-cc-cf-env-with-edge-capi.outputs.environment-name }} +# setup-windows-integration-client-credentials: +# name: Setup Integration Tests Windows Client Credentials +# needs: +# - shared-values +# - get-windows-cc-cf-env-with-edge-capi +# uses: ./.github/workflows/windows-integration-setup.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# environment-name: ${{ needs.get-windows-cc-cf-env-with-edge-capi.outputs.environment-name }} - run-windows-integration-client-credentials-tests: - name: Run Integration tests Windows with Client Credentials - env: - CF_INT_CLIENT_ID: potato-face - CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - needs: - - shared-values - - get-windows-cc-cf-env-with-edge-capi - - setup-windows-integration-client-credentials - runs-on: windows-latest - defaults: - run: - shell: pwsh - environment: ${{ needs.shared-values.outputs.secrets-environment }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: cli - - 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: ${{ needs.get-windows-cc-cf-env-with-edge-capi.outputs.environment-name }} +# run-windows-integration-client-credentials-tests: +# name: Run Integration tests Windows with Client Credentials +# env: +# CF_INT_CLIENT_ID: potato-face +# CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} +# needs: +# - shared-values +# - get-windows-cc-cf-env-with-edge-capi +# - setup-windows-integration-client-credentials +# runs-on: windows-latest +# defaults: +# run: +# shell: pwsh +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# with: +# path: cli +# - 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: ${{ needs.get-windows-cc-cf-env-with-edge-capi.outputs.environment-name }} - - name: Download CF data - uses: actions/download-artifact@v3 - with: - name: cf-windows-data - - name: Run Integration Tests - run: cli/.github/win/integrations/integration-tests.ps1 +# - name: Download CF data +# uses: actions/download-artifact@v3 +# with: +# name: cf-windows-data +# - name: Run Integration Tests +# run: cli/.github/win/integrations/integration-tests.ps1 - unclaim-cf-windows-cc-env-with-edge-capi: - name: Unclaim CF windows with Client Credentials env with edge CAPI - needs: - - shared-values - - get-windows-cc-cf-env-with-edge-capi - - run-windows-integration-client-credentials-tests - if: always() - uses: ./.github/workflows/cf-env-unclaim.yml - with: - environment: ${{ needs.shared-values.outputs.secrets-environment }} - toolsmith-env-name: ${{ needs.get-windows-cc-cf-env-with-edge-capi.outputs.environment-name }} - secrets: inherit +# unclaim-cf-windows-cc-env-with-edge-capi: +# name: Unclaim CF windows with Client Credentials env with edge CAPI +# needs: +# - shared-values +# - get-windows-cc-cf-env-with-edge-capi +# - run-windows-integration-client-credentials-tests +# if: always() +# uses: ./.github/workflows/cf-env-unclaim.yml +# with: +# environment: ${{ needs.shared-values.outputs.secrets-environment }} +# toolsmith-env-name: ${{ needs.get-windows-cc-cf-env-with-edge-capi.outputs.environment-name }} +# secrets: inherit diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index a5f26d113c6..84c0030b917 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -15,6 +15,9 @@ on: run-with-client-creds: required: true type: boolean + cf-build-sha: + required: true + type: string jobs: run-integration-tests: name: Run Integration Tests @@ -25,6 +28,7 @@ jobs: uses: actions/checkout@v3 with: path: cli + ref: ${{ inputs.cf-build-sha }} - name: Set Up Go uses: actions/setup-go@v3 with: @@ -51,6 +55,25 @@ jobs: chmod +x /usr/local/bin/credhub credhub --version rm ~/credhub-linux-2.9.4.tgz + + - name: Get Artifact Name + id: get-artifact-name + run: | + build_short_sha=$(echo '${{ inputs.cf-build-sha }}' | awk '{print substr($0,0,7)}') + # build_short_sha=$(echo '${{ steps.set-build-sha.outputs.cf-build-sha }}' | awk '{print substr($0,0,7)}') + echo "artifact-name=cf-cli-linux-binaries-${build_short_sha}.tgz" >> $GITHUB_OUTPUT + + - name: Download binaries + uses: dawidd6/action-download-artifact@v2 + with: + run_id: ${{ github.event.workflow_run.id }} + name: ${{ steps.get-artifact-name.outputs.artifact-name }} + path: cf-cli-binaries + + # - name: Setup tmate session + # if: always() + # uses: mxschmitt/action-tmate@v3 + - name: Run Integration Tests if: ${{ !inputs.run-with-client-creds }} run: | @@ -69,16 +92,24 @@ jobs: export GOPATH=$PWD/go export PATH=$GOPATH/bin:$PATH + pushd cf-cli-binaries + tar xvzf ${{ steps.get-artifact-name.outputs.artifact-name }} + chmod +x cf-cli_linux_x86-64 + mkdir -p $GOPATH/bin + mv cf-cli_linux_x86-64 $GOPATH/bin/cf + popd + cd $GOPATH/src/code.cloudfoundry.org/cli go install github.com/onsi/ginkgo/ginkgo@v1.16.4 - make build - export PATH="$(pwd)/out:$PATH" + # make build + # export PATH="$(pwd)/out:$PATH" export CF_PASSWORD=${CF_INT_PASSWORD} cf api ${CF_INT_API} --skip-ssl-validation cf auth make integration-tests-full-ci + - name: Run Integration Tests with client credentials if: ${{ inputs.run-with-client-creds }} env: @@ -103,8 +134,15 @@ jobs: cd $GOPATH/src/code.cloudfoundry.org/cli go install github.com/onsi/ginkgo/ginkgo@v1.16.4 - make build - export PATH="$(pwd)/out:$PATH" + pushd cf-cli-binaries + tar xvzf cf-cli-binaries.tgz + chmod +x cf-cli_linux_x86-64 + mkdir -p $GOPATH/bin + mv cf-cli_linux_x86-64 $GOPATH/bin/cf + popd + + # make build + # export PATH="$(pwd)/out:$PATH" export CF_PASSWORD=${CF_INT_PASSWORD} cf api ${CF_INT_API} --skip-ssl-validation cf auth