Skip to content

Commit b1e706f

Browse files
authored
Use one environment to run int tests [v8] (#3243)
1 parent 2ae0aea commit b1e706f

File tree

9 files changed

+199
-104
lines changed

9 files changed

+199
-104
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: 14 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ 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}}
@@ -50,78 +47,41 @@ jobs:
5047
ref: release-candidate
5148
path: cf-acceptance-tests
5249

53-
- name: Checkout cf-deployment
54-
uses: actions/checkout@v4
55-
with:
56-
repository: cloudfoundry/cf-deployment
57-
path: cf-deployment
58-
5950
- name: Checkout CF deployment tasks
6051
uses: actions/checkout@v4
6152
with:
6253
repository: cloudfoundry/cf-deployment-concourse-tasks
6354
path: cf-deployment-concourse-tasks
6455

65-
- id: claim-env
66-
name: Claim Environment
67-
env:
68-
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
69-
pool_name: ${{ inputs.pool-name }}
70-
pool_namespace: ${{ inputs.pool-namespace }}
71-
run: |
72-
shepherd login service-account ${account_token}
73-
74-
echo "shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace ${pool_namespace} --namespace tas-devex --description 'CLI GHA'"
75-
lease_id=$(shepherd create lease --duration 8h --pool ${pool_name} --pool-namespace ${pool_namespace} --namespace tas-devex --json | jq -r .id)
76-
# Give sometime for the lease to complete. Shepherd may take upto an 3 hours to create an env
77-
# if the pool is empty.
78-
count=0
79-
while [ $count -lt 360 ] ; do
80-
sleep 30
81-
status=$(shepherd get lease ${lease_id} --namespace tas-devex --json | jq -r .status)
82-
if [ $status == "LEASED" ] ; then
83-
shepherd get lease ${lease_id} --namespace tas-devex --json | jq .output > metadata.json
84-
break
85-
elif [ $status == "FAILED" -o $status == "EXPIRED" ] ; then
86-
echo "There was an error obtaining the lease. Lease status is ${status}."
87-
exit 1
88-
else
89-
echo "Waiting for environment to be ready. Lease status is ${status}."
90-
fi
91-
count=$(($count+1))
92-
done
93-
94-
env_name=$(jq -r .name metadata.json)
95-
cat metadata.json | jq -r '.name'
96-
echo "lease-id=$lease_id" >> "${GITHUB_OUTPUT}"
97-
9856
- name: Set Up Go
9957
uses: actions/setup-go@v5
10058
with:
10159
go-version-file: go.mod
10260
check-latest: true
10361

10462
- name: Install Tools
63+
env:
64+
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
10565
run: |
10666
go version
10767
10868
if [[ ${{ inputs.os }} =~ "windows" ]]
10969
then
11070
install_location=/usr/bin
11171
bbl_artifact=bbl-v8.4.110_windows.exe
112-
bosh_cli_artifact=bosh-cli-7.0.1-windows-amd64.exe
72+
bosh_cli_artifact=bosh-cli-7.7.2-windows-amd64.exe
11373
credhub_artifact=credhub-windows-2.9.4.tgz
11474
else
11575
install_location=/usr/local/bin
11676
bbl_artifact=bbl-v8.4.110_linux_x86-64
117-
bosh_cli_artifact=bosh-cli-7.0.1-linux-amd64
77+
bosh_cli_artifact=bosh-cli-7.7.2-linux-amd64
11878
credhub_artifact=credhub-linux-2.9.4.tgz
11979
fi
12080
curl https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/${bbl_artifact} --silent --location --output $install_location/bbl
12181
chmod +x $install_location/bbl
12282
bbl --version
12383
124-
curl https://s3.amazonaws.com/bosh-cli-artifacts/$bosh_cli_artifact --silent --output $install_location/bosh --location
84+
curl https://github.com/cloudfoundry/bosh-cli/releases/download/v7.7.2/$bosh_cli_artifact --silent --output $install_location/bosh --location
12585
chmod +x $install_location/bosh
12686
bosh --version
12787
@@ -134,50 +94,13 @@ jobs:
13494
apt-get update
13595
apt-get install -y build-essential unzip
13696
137-
- name: Upload latest CAPI release
138-
env:
139-
capi_release_version: ${{ vars.CAPI_RELEASE_VERSION }}
140-
run: |
141-
if [ -z "$capi_release_version" ]
142-
then
143-
capi_release_version=$(curl -s https://api.github.com/repos/cloudfoundry/capi-release/releases/latest | jq -r .tag_name)
144-
fi
145-
146-
echo "Latest CAPI release is $capi_release_version"
147-
148-
eval "$(bbl print-env --metadata-file metadata.json)"
149-
env_name=$(jq -r .name metadata.json)
150-
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv
151-
152-
bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version"
153-
154-
- name: Deploy Isolation Segment and OIDC Provider
155-
run: |
156-
env_name=$(jq -r .name metadata.json)
157-
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv
158-
eval "$(bbl print-env --metadata-file metadata.json)"
159-
160-
# deploy
161-
bosh -d cf manifest > /tmp/manifest.yml
162-
bosh interpolate /tmp/manifest.yml \
163-
-o cf-deployment/operations/use-internal-lookup-for-route-services.yml \
164-
-o cf-deployment/operations/add-persistent-isolation-segment-diego-cell.yml \
165-
-o .github/ops-files/use-latest-capi.yml \
166-
-o .github/ops-files/add-oidc-provider.yml \
167-
-o .github/ops-files/add-uaa-client-credentials.yml \
168-
-o .github/ops-files/diego-cell-instances.yml \
169-
-v client-secret="${{ secrets.CLIENT_SECRET }}" \
170-
> ./director.yml
171-
172-
bosh -d cf deploy director.yml -n
173-
echo "Deployed CAPI version:"
174-
bosh -d cf releases | grep capi
97+
shepherd login service-account ${account_token}
98+
shepherd get lease ${{ inputs.lease-id }} --namespace tas-devex --json | jq .output > metadata.json
17599
176100
- name: Add CATS config
177101
if: ${{ inputs.name == 'cats' }}
178102
run: |
179103
set -eu
180-
181104
ENV=$(jq -r .name metadata.json)
182105
API="$(jq -r .cf.api_url metadata.json)"
183106
DOMAIN=$(echo $API | sed "s/^api\.//")
@@ -207,6 +130,7 @@ jobs:
207130
"include_container_networking": true,
208131
"include_detect": true,
209132
"include_docker": true,
133+
"include_cnb": true,
210134
"include_internet_dependent": true,
211135
"include_isolation_segments": true,
212136
"isolation_segment_name": "persistent_isolation_segment",
@@ -237,6 +161,7 @@ jobs:
237161
cf api ${API} --skip-ssl-validation
238162
cf auth
239163
cf enable-feature-flag diego_docker
164+
cf enable-feature-flag diego_cnb
240165
cf enable-feature-flag service_instance_sharing
241166
242167
- name: Run CATS Tests
@@ -282,6 +207,7 @@ jobs:
282207
export GOPATH=$PWD/go
283208
export PATH="$GOPATH/bin:$PATH"
284209
export PATH="$PWD/out:$PATH"
210+
export CF_INT_TEST_NAME="int"
285211
286212
make build
287213
@@ -312,20 +238,12 @@ jobs:
312238
export GOPATH=$PWD/go
313239
export PATH="$GOPATH/bin:$PATH"
314240
export PATH="$PWD/out:$PATH"
241+
export CF_INT_TEST_NAME="cc"
315242
316243
make build
317244
318245
export CF_PASSWORD=${CF_INT_PASSWORD}
319246
cf api ${CF_INT_API} --skip-ssl-validation
320247
cf auth
321248
322-
make integration-tests-full-ci
323-
324-
- name: Unclaim environment
325-
if: always()
326-
env:
327-
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
328-
run: |
329-
shepherd login service-account ${account_token}
330-
set -x
331-
shepherd delete lease ${{ steps.claim-env.outputs.lease-id }} --namespace tas-devex
249+
make integration-tests-full-ci

0 commit comments

Comments
 (0)