Skip to content

Switch test environments to cfd bosh lites #5

Switch test environments to cfd bosh lites

Switch test environments to cfd bosh lites #5

# GitHub repo level Secrets and Variables
# secrets.CLIENT_SECRET
# secrets.GITHUB_TOKEN
# secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN
# vars.TEST_FLAKE_ATTEMPTS
name: "pvt: run integration tests"
on:
workflow_call:
inputs:
run-with-client-creds:
required: true
type: boolean
os:
required: true
type: string
name:
required: true
type: string
lease-id:
required: true
type: string
lease-namespace:
required: false
type: string
default: 'tas-devex'
gitRef:
type: string
default: ${{github.event.workflow_run.head_sha}}
nodes:
type: string
default: "16"
env:
NODES: ${{ inputs.nodes }}
FLAKE_ATTEMPTS: ${{ vars.TEST_FLAKE_ATTEMPTS || '4' }}
jobs:
run-integration-tests:
defaults:
run:
shell: bash
runs-on: ${{ inputs.os }}
container: us-west2-docker.pkg.dev/shepherd-268822/shepherd2/concourse-resource:latest
timeout-minutes: 120
steps:
- name: Checkout cli
uses: actions/checkout@v4
with:
ref: ${{inputs.gitRef}}
fetch-depth: 0
- name: Checkout CF deployment tasks
uses: actions/checkout@v4
with:
repository: cloudfoundry/cf-deployment-concourse-tasks
path: cf-deployment-concourse-tasks
- name: Set Up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Install Tools
env:
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
lease_namespace: ${{ inputs.lease-namespace }}
lease_id: ${{ inputs.lease-id }}
run: |
go version
if [[ ${{ inputs.os }} =~ "windows" ]]
then
install_location=/usr/bin
bbl_artifact=bbl-v8.4.110_windows.exe
bosh_cli_artifact=bosh-cli-7.7.2-windows-amd64.exe
credhub_artifact=credhub-windows-2.9.4.tgz
else
install_location=/usr/local/bin
bbl_artifact=bbl-v8.4.110_linux_x86-64
bosh_cli_artifact=bosh-cli-7.7.2-linux-amd64
credhub_artifact=credhub-linux-2.9.4.tgz
fi
curl https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/${bbl_artifact} --silent --location --output $install_location/bbl
chmod +x $install_location/bbl
bbl --version
curl https://github.com/cloudfoundry/bosh-cli/releases/download/v7.7.2/$bosh_cli_artifact --silent --output $install_location/bosh --location
chmod +x $install_location/bosh
bosh --version
curl https://github.com/cloudfoundry/credhub-cli/releases/download/2.9.4/$credhub_artifact --silent --output /tmp/$credhub_artifact --location
tar xzvf /tmp/$credhub_artifact
mv credhub $install_location/credhub
chmod +x $install_location/credhub
credhub --version
apt-get update
apt-get install -y build-essential unzip
shepherd login service-account ${account_token}
shepherd get lease ${lease_id} --namespace ${lease_namespace} --json | jq .output > metadata.json
- name: Run Integration Tests
if: ${{ !inputs.run-with-client-creds }}
run: |
env_name=$(cat metadata.json | jq -r '.name')
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv
eval "$(bbl print-env --metadata-file ./metadata.json)"
export CF_INT_PASSWORD="$(credhub get -n /bosh-lite/cf/cf_admin_password | bosh interpolate --path /value -)"
export CF_INT_OIDC_USERNAME="admin-oidc"
export CF_INT_OIDC_PASSWORD=$(credhub get -n /bosh-lite/cf/uaa_oidc_admin_password | bosh interpolate --path /value -)
API_URL="$(jq -r .cf.api_url metadata.json)"
export CF_INT_API="https://$API_URL"
export CF_DIAL_TIMEOUT=15
export CF_USERNAME=admin
export GOPATH=$PWD/go
export PATH="$GOPATH/bin:$PATH"
export PATH="$PWD/out:$PATH"
export CF_INT_TEST_NAME="int"
make build
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:
CF_INT_CLIENT_ID: 'potato-face'
CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: |
env_name=$(cat metadata.json | jq -r '.name')
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv
eval "$(bbl print-env --metadata-file ./metadata.json)"
export CF_INT_PASSWORD="$(credhub get -n /bosh-lite/cf/cf_admin_password | bosh interpolate --path /value -)"
export CF_INT_OIDC_USERNAME="admin-oidc"
export CF_INT_OIDC_PASSWORD=$(credhub get -n /bosh-lite/cf/uaa_oidc_admin_password | bosh interpolate --path /value -)
API_URL="$(jq -r .cf.api_url metadata.json)"
export CF_INT_API="https://$API_URL"
export CF_DIAL_TIMEOUT=15
export CF_USERNAME=admin
export GOPATH=$PWD/go
export PATH="$GOPATH/bin:$PATH"
export PATH="$PWD/out:$PATH"
export CF_INT_TEST_NAME="cc"
make build
export CF_PASSWORD=${CF_INT_PASSWORD}
cf api ${CF_INT_API} --skip-ssl-validation
cf auth
make integration-tests-ci
-client-creds

Check failure on line 161 in .github/workflows/tests-integration-reusable.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/tests-integration-reusable.yml

Invalid workflow file

You have an error in your yaml syntax on line 161