Skip to content

Commit 1679714

Browse files
authored
Use one environment to run int tests [v7] (#3244)
1 parent c88114b commit 1679714

File tree

8 files changed

+241
-127
lines changed

8 files changed

+241
-127
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
- type: replace
33
path: /instance_groups/name=diego-cell/instances
4-
value: 3
4+
value: 4

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

Lines changed: 18 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,12 @@ on:
1919
name:
2020
required: true
2121
type: string
22-
pool-name:
23-
type: string
24-
default: ${{ vars.SHEPHERD_POOL_NAME }}
25-
pool-namespace:
22+
lease-id:
23+
required: true
2624
type: string
27-
default: 'official'
2825
gitRef:
2926
type: string
3027
default: ${{github.event.workflow_run.head_sha}}
31-
3228
jobs:
3329
run-integration-tests:
3430
defaults:
@@ -42,92 +38,41 @@ jobs:
4238
with:
4339
ref: ${{inputs.gitRef}}
4440

45-
- name: Checkout cli-ci
46-
uses: actions/checkout@v4
47-
with:
48-
repository: cloudfoundry/cli-ci
49-
path: cli-ci
50-
51-
- id: read-min-capi
52-
name: Read MIN CAPI
53-
run: |
54-
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\
55-
chmod +x /usr/bin/yq
56-
version=$(yq '.capi-version-min' build_data.yml)
57-
echo "version=$version" >> $GITHUB_OUTPUT
58-
59-
- name: Checkout cf-deployment Min CAPI
60-
if: ${{ inputs.capi-version != 'edge' }}
61-
uses: actions/checkout@v4
62-
with:
63-
repository: cloudfoundry/cf-deployment
64-
path: cf-deployment
65-
ref: ${{ steps.read-min-capi.outputs.version }}
66-
67-
- name: Checkout cf-deployment
68-
uses: actions/checkout@v4
69-
with:
70-
repository: cloudfoundry/cf-deployment
71-
path: cf-deployment
72-
7341
- name: Checkout CF deployment tasks
7442
uses: actions/checkout@v4
7543
with:
7644
repository: cloudfoundry/cf-deployment-concourse-tasks
7745
path: cf-deployment-concourse-tasks
7846

79-
- id: claim-env
80-
name: Claim Environment
47+
- name: Set Up Go
48+
uses: actions/setup-go@v5
49+
with:
50+
go-version-file: go.mod
51+
check-latest: true
52+
53+
- name: Install Tools
8154
env:
8255
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
83-
pool_name: ${{ inputs.pool-name }}
84-
pool_namespace: ${{ inputs.pool-namespace }}
8556
run: |
86-
shepherd login service-account ${account_token}
87-
88-
echo "shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace ${pool_namespace} --namespace tas-devex --description 'CLI GHA'"
89-
lease_id=$(shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace ${pool_namespace} --namespace tas-devex --json | jq -r .id)
90-
# Give sometime for the lease to complete. Shepherd may take upto an 3 hours to create an env
91-
# if the pool is empty.
92-
count=0
93-
while [ $count -lt 360 ] ; do
94-
sleep 30
95-
status=$(shepherd get lease ${lease_id} --namespace tas-devex --json | jq -r .status)
96-
if [ $status == "LEASED" ] ; then
97-
shepherd get lease ${lease_id} --namespace tas-devex --json | jq .output > metadata.json
98-
break
99-
elif [ $status == "FAILED" -o $status == "EXPIRED" ] ; then
100-
echo "There was an error obtaining the lease. Lease status is ${status}."
101-
exit 1
102-
else
103-
echo "Waiting for environment to be ready. Lease status is ${status}."
104-
fi
105-
count=$(($count+1))
106-
done
107-
108-
env_name=$(jq -r .name metadata.json)
109-
cat metadata.json | jq -r '.name'
110-
echo "lease-id=$lease_id" >> "${GITHUB_OUTPUT}"
57+
go version
11158
112-
- name: Install Tools
113-
run: |
11459
if [[ ${{ inputs.os }} =~ "windows" ]]
11560
then
11661
install_location=/usr/bin
11762
bbl_artifact=bbl-v8.4.110_windows.exe
118-
bosh_cli_artifact=bosh-cli-7.0.1-windows-amd64.exe
63+
bosh_cli_artifact=bosh-cli-7.7.2-windows-amd64.exe
11964
credhub_artifact=credhub-windows-2.9.4.tgz
12065
else
12166
install_location=/usr/local/bin
12267
bbl_artifact=bbl-v8.4.110_linux_x86-64
123-
bosh_cli_artifact=bosh-cli-7.0.1-linux-amd64
68+
bosh_cli_artifact=bosh-cli-7.7.2-linux-amd64
12469
credhub_artifact=credhub-linux-2.9.4.tgz
12570
fi
12671
curl https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/${bbl_artifact} --silent --location --output $install_location/bbl
12772
chmod +x $install_location/bbl
12873
bbl --version
12974
130-
curl https://s3.amazonaws.com/bosh-cli-artifacts/$bosh_cli_artifact --silent --output $install_location/bosh --location
75+
curl https://github.com/cloudfoundry/bosh-cli/releases/download/v7.7.2/$bosh_cli_artifact --silent --output $install_location/bosh --location
13176
chmod +x $install_location/bosh
13277
bosh --version
13378
@@ -138,51 +83,10 @@ jobs:
13883
credhub --version
13984
14085
apt-get update
141-
apt-get install -y build-essential
86+
apt-get install -y build-essential unzip
14287
143-
- name: Upload latest CAPI release
144-
env:
145-
capi_release_version: ${{ vars.CAPI_RELEASE_VERSION }}
146-
run: |
147-
if [ -z "$capi_release_version" ]
148-
then
149-
capi_release_version=$(curl -s https://api.github.com/repos/cloudfoundry/capi-release/releases/latest | jq -r .tag_name)
150-
fi
151-
152-
echo "Latest CAPI release is $capi_release_version"
153-
154-
eval "$(bbl print-env --metadata-file metadata.json)"
155-
env_name=$(jq -r .name metadata.json)
156-
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv
157-
bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version"
158-
159-
- name: Deploy Isolation Segment and OIDC Provider
160-
run: |
161-
env_name=$(jq -r .name metadata.json)
162-
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv
163-
eval "$(bbl print-env --metadata-file metadata.json)"
164-
165-
# deploy
166-
bosh -d cf manifest > /tmp/manifest.yml
167-
bosh interpolate /tmp/manifest.yml \
168-
-o cf-deployment/operations/use-internal-lookup-for-route-services.yml \
169-
-o cf-deployment/operations/add-persistent-isolation-segment-diego-cell.yml \
170-
-o .github/ops-files/use-latest-capi.yml \
171-
-o .github/ops-files/add-oidc-provider.yml \
172-
-o .github/ops-files/add-uaa-client-credentials.yml \
173-
-o .github/ops-files/diego-cell-instances.yml \
174-
-v client-secret="${{ secrets.CLIENT_SECRET }}" \
175-
> ./director.yml
176-
177-
bosh -d cf deploy director.yml -n
178-
echo "Deployed CAPI version:"
179-
bosh -d cf releases | grep capi
180-
181-
- name: Set Up Go
182-
uses: actions/setup-go@v5
183-
with:
184-
go-version-file: go.mod
185-
check-latest: true
88+
shepherd login service-account ${account_token}
89+
shepherd get lease ${{ inputs.lease-id }} --namespace tas-devex --json | jq .output > metadata.json
18690
18791
- name: Run Integration Tests
18892
if: ${{ !inputs.run-with-client-creds }}
@@ -202,6 +106,7 @@ jobs:
202106
export GOPATH=$PWD/go
203107
export PATH="$GOPATH/bin:$PATH"
204108
export PATH="$PWD/out:$PATH"
109+
export CF_INT_TEST_NAME="int"
205110
206111
make build
207112
@@ -232,6 +137,7 @@ jobs:
232137
export GOPATH=$PWD/go
233138
export PATH="$GOPATH/bin:$PATH"
234139
export PATH="$PWD/out:$PATH"
140+
export CF_INT_TEST_NAME="cc"
235141
236142
make build
237143
@@ -240,12 +146,3 @@ jobs:
240146
cf auth
241147
242148
make integration-tests-full-ci
243-
244-
- name: Unclaim environment
245-
if: always()
246-
env:
247-
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
248-
run: |
249-
shepherd login service-account ${account_token}
250-
set -x
251-
shepherd delete lease ${{ steps.claim-env.outputs.lease-id }} --namespace tas-devex

0 commit comments

Comments
 (0)