forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (120 loc) · 4.68 KB
/
tests-integration-reusable.yml
File metadata and controls
144 lines (120 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: "REUSABLE: Integration Tests"
on:
workflow_call:
inputs:
name:
required: true
type: string
env-name:
required: true
type: string
gitRef:
type: string
default: ${{github.event.workflow_run.head_sha}}
run-with-client-creds:
required: true
type: boolean
env:
ENV_NAME: ${{ inputs.env-name }}
NODES: 4
FLAKE_ATTEMPTS: ${{ vars.TEST_FLAKE_ATTEMPTS || '5' }}
BBL_CLI_VERSION: ${{ vars.BBL_CLI_VERSION }}
BOSH_CLI_VERSION: ${{ vars.BOSH_CLI_VERSION }}
CREDHUB_CLI_VERSION: ${{ vars.CREDHUB_CLI_VERSION }}
jobs:
run-integration-tests:
defaults:
run:
shell: bash
runs-on: ubuntu-latest
steps:
- name: Checkout cli
uses: actions/checkout@v6
with:
ref: ${{inputs.gitRef}}
fetch-depth: 0
path: cli
- name: Checkout CF deployment tasks
uses: actions/checkout@v6
with:
repository: cloudfoundry/cf-deployment-concourse-tasks
path: cf-deployment-concourse-tasks
- name: Set Up Go
uses: actions/setup-go@v6
with:
go-version-file: cli/go.mod
check-latest: true
- name: Install Tools
run: |
go version
install_location=/usr/local/bin
sudo curl https://github.com/cloudfoundry/bosh-bootloader/releases/download/v${BBL_CLI_VERSION}/bbl-v${BBL_CLI_VERSION}_linux_amd64 --silent --location --output $install_location/bbl
sudo chmod +x $install_location/bbl
bbl --version
sudo curl https://github.com/cloudfoundry/bosh-cli/releases/download/v${BOSH_CLI_VERSION}/bosh-cli-${BOSH_CLI_VERSION}-linux-amd64 --silent --output $install_location/bosh --location
sudo chmod +x $install_location/bosh
bosh --version
sudo curl https://github.com/cloudfoundry/credhub-cli/releases/download/${CREDHUB_CLI_VERSION}/credhub-linux-amd64-${CREDHUB_CLI_VERSION}.tgz --silent --location --output /tmp/credhub.tgz
sudo tar -xzf /tmp/credhub.tgz -C $install_location
sudo chmod +x $install_location/credhub
credhub --version
sudo apt-get update
sudo apt-get install -y build-essential unzip
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v3
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}
- name: Setup gcloud CLI
uses: google-github-actions/setup-gcloud@v3
- name: Download file from GCS
run: |
gsutil -m cp -R -P gs://cf-cli-bosh-lites/${ENV_NAME} .
- name: Run Integration Tests
if: ${{ !inputs.run-with-client-creds }}
run: |
pushd ./${ENV_NAME}/bbl-state
eval "$(bbl print-env --shell-type posix)"
popd
cd cli
export CF_INT_PASSWORD="$(credhub get -n /bosh-${ENV_NAME}/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_NAME}/cf/uaa_oidc_admin_password | bosh interpolate --path /value -)
API_URL="api.${ENV_NAME}.app-runtime-interfaces.ci.cloudfoundry.org"
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"
export CF_PASSWORD=${CF_INT_PASSWORD}
make build
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: |
pushd ./${ENV_NAME}/bbl-state
eval "$(bbl print-env --shell-type posix)"
popd
cd cli
export CF_INT_PASSWORD="$(credhub get -n /bosh-${ENV_NAME}/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_NAME}/cf/uaa_oidc_admin_password | bosh interpolate --path /value -)
API_URL="api.${ENV_NAME}.app-runtime-interfaces.ci.cloudfoundry.org"
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"
export CF_PASSWORD=${CF_INT_PASSWORD}
make build
cf api ${CF_INT_API} --skip-ssl-validation
cf auth
make integration-tests-ci-client-creds