From 7c6c07e7c1eec2440184bc3c9c984550a1f3a7e0 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Fri, 14 Apr 2023 17:32:40 -0400 Subject: [PATCH] GHA Integration tests Review Changes (#2403) Fix GitHub Action tests and upgrade golang - Upgrade go from 1.18 to 1.19 Co-authored-by: Al Berez --- .../win/integrations/integration-tests.ps1 | 16 +- .github/workflows/build-cf-cli.yml | 154 ------ .github/workflows/integration.yml | 456 +++++++++--------- .github/workflows/package-cli.yml | 46 ++ .github/workflows/run-integration-tests.yml | 65 +-- 5 files changed, 310 insertions(+), 427 deletions(-) delete mode 100644 .github/workflows/build-cf-cli.yml create mode 100644 .github/workflows/package-cli.yml diff --git a/.github/win/integrations/integration-tests.ps1 b/.github/win/integrations/integration-tests.ps1 index b5303ac7117..11f4f0e4aaa 100644 --- a/.github/win/integrations/integration-tests.ps1 +++ b/.github/win/integrations/integration-tests.ps1 @@ -28,7 +28,7 @@ $Env:PATH="$Env:HOME\go\bin;" + "$Env:PATH" $Env:PATH="$Env:GOPATH\bin;" + "$Env:PATH" $Env:PATH="$Env:GOROOT\bin;" + "$Env:PATH" $Env:PATH="$pwd;" + "$Env:PATH" -$Env:PATH="$pwd\cli\out;" + "$Env:PATH" +$Env:PATH="$pwd\out;" + "$Env:PATH" # This is for DEBUG # function Get-Env-Info { @@ -63,15 +63,23 @@ $Env:CF_DIAL_TIMEOUT=15 Import-Certificate -Filepath "$pwd\$CF_INT_NAME.router.ca" -CertStoreLocation "cert:\LocalMachine\root" +pushd $pwd\cf-cli-binaries + 7z e cf-cli-windows-binaries.tgz -y + 7z x cf-cli-windows-binaries.tar -y + Move-Item -Path $pwd\cf-cli_winx64.exe -Destination ..\cf.exe -Force +popd + New-Item "go/src/code.cloudfoundry.org" -Type Directory -New-Item -ItemType SymbolicLink -Path "$pwd/go/src/code.cloudfoundry.org/cli" -Target "$pwd/cli" +New-Item -ItemType SymbolicLink -Path "$pwd/go/src/code.cloudfoundry.org/cli" -Target "$pwd" cd go/src/code.cloudfoundry.org/cli - go install github.com/akavel/rsrc@v0.10.2 +Get-Command make +Get-Item Makefile + make out/cf-cli_winx64.exe -Move-Item -Path ./out/cf-cli_winx64.exe -Destination ./out/cf.exe -Force +Move-Item -Path $pwd\out\cf-cli_winx64.exe -Destination $pwd\cf.exe -Force cf.exe api $Env:CF_INT_API --skip-ssl-validation cf.exe auth admin $Env:CF_INT_PASSWORD diff --git a/.github/workflows/build-cf-cli.yml b/.github/workflows/build-cf-cli.yml deleted file mode 100644 index 93e3914e49b..00000000000 --- a/.github/workflows/build-cf-cli.yml +++ /dev/null @@ -1,154 +0,0 @@ -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/integration.yml b/.github/workflows/integration.yml index 4ea6ac953ea..450c6a9b236 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -2,8 +2,10 @@ name: Integration Tests on: workflow_run: - workflows: [Build Binaries] - types: [completed] + workflows: + - Package CLI + types: + - completed permissions: contents: read @@ -17,20 +19,14 @@ jobs: 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 + - name: Download cli + uses: dawidd6/action-download-artifact@v2 with: - ref: ${{ github.event.workflow_run.head_sha }} + run_id: ${{ github.event.workflow_run.id }} + name: cf-cli.tgz + path: ${{ github.workspace }} - id: set-secrets-environment name: Set environment @@ -49,13 +45,8 @@ 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 - get-cf-env-with-edge-capi: name: Setup CF env with EDGE CAPI needs: shared-values @@ -72,7 +63,6 @@ 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 }} @@ -93,211 +83,223 @@ 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 - -# 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 - -# ## 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 - -# 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 - -# ## 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 }} - -# 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 - -# 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 - -# 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 }} - -# - 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 +## 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 + + 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 + + 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 +## 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 + + 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: 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: Download cli + uses: dawidd6/action-download-artifact@v2 + with: + run_id: ${{ github.event.workflow_run.id }} + name: cf-cli.tgz + path: ${{ github.workspace }} + + - name: Run Integration Tests + run: .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 + +## 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 }} + + + 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: 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: Download cli + uses: dawidd6/action-download-artifact@v2 + with: + run_id: ${{ github.event.workflow_run.id }} + name: cf-cli.tgz + path: ${{ github.workspace }} + + - name: Run Integration Tests + run: .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 diff --git a/.github/workflows/package-cli.yml b/.github/workflows/package-cli.yml new file mode 100644 index 00000000000..cc98aba191f --- /dev/null +++ b/.github/workflows/package-cli.yml @@ -0,0 +1,46 @@ +name: Package CLI + +on: + workflow_dispatch: + pull_request: + types: + - opened + - reopened + - ready_for_review + 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: + package-cli: + name: Package cli + runs-on: ubuntu-latest + outputs: + linux-binaries: ${{ steps.build-linux-binaries.outputs.linux-binaries }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: 'Upload cli' + uses: actions/upload-artifact@v3 + with: + name: cf-cli.tgz + path: ${{ github.workspace }} \ No newline at end of file diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 84c0030b917..1a9b071b84c 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -15,20 +15,14 @@ on: run-with-client-creds: required: true type: boolean - cf-build-sha: - required: true - type: string + jobs: run-integration-tests: name: Run Integration Tests runs-on: ubuntu-latest environment: ${{ inputs.environment }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: cli - ref: ${{ inputs.cf-build-sha }} + + steps: - name: Set Up Go uses: actions/setup-go@v3 with: @@ -56,29 +50,18 @@ jobs: 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 + - name: Download cli 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: cf-cli.tgz + path: ${{ github.workspace }} - name: Run Integration Tests if: ${{ !inputs.run-with-client-creds }} run: | mkdir -p go/src/code.cloudfoundry.org - ln -s ${PWD}/cli go/src/code.cloudfoundry.org + ln -s ${PWD} go/src/code.cloudfoundry.org 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 -)" @@ -92,18 +75,17 @@ 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 + make out/cf-cli_linux_x86-64 + export PATH="$(pwd)/out:$PATH" + + mkdir -p $GOPATH/bin + mv out/cf-cli_linux_x86-64 $GOPATH/bin/cf + + chmod 755 -R $GOPATH/src/code.cloudfoundry.org/cli cd $GOPATH/src/code.cloudfoundry.org/cli go install github.com/onsi/ginkgo/ginkgo@v1.16.4 - # make build - # export PATH="$(pwd)/out:$PATH" export CF_PASSWORD=${CF_INT_PASSWORD} cf api ${CF_INT_API} --skip-ssl-validation cf auth @@ -117,7 +99,7 @@ jobs: CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} run: | mkdir -p go/src/code.cloudfoundry.org - ln -s ${PWD}/cli go/src/code.cloudfoundry.org + ln -s ${PWD} go/src/code.cloudfoundry.org 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 -)" @@ -131,18 +113,17 @@ jobs: export GOPATH=$PWD/go export PATH=$GOPATH/bin:$PATH + make out/cf-cli_linux_x86-64 + export PATH="$(pwd)/out:$PATH" + + mkdir -p $GOPATH/bin + mv out/cf-cli_linux_x86-64 $GOPATH/bin/cf + + chmod 755 -R $GOPATH/src/code.cloudfoundry.org/cli + cd $GOPATH/src/code.cloudfoundry.org/cli go install github.com/onsi/ginkgo/ginkgo@v1.16.4 - 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