Skip to content

Commit d07ab12

Browse files
authored
ci: merge main to release (ietf-tools#8117)
2 parents f5c86d5 + e929002 commit d07ab12

2 files changed

Lines changed: 48 additions & 26 deletions

File tree

.github/workflows/build.yml

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ jobs:
139139
needs: [prepare]
140140
with:
141141
ignoreLowerCoverage: ${{ github.event.inputs.ignoreLowerCoverage == 'true' }}
142+
skipSelenium: true
142143
targetBaseVersion: ${{ needs.prepare.outputs.base_image_version }}
143144

144145
# -----------------------------------------------------------------
@@ -157,6 +158,7 @@ jobs:
157158
PKG_VERSION: ${{needs.prepare.outputs.pkg_version}}
158159
FROM_TAG: ${{needs.prepare.outputs.from_tag}}
159160
TO_TAG: ${{needs.prepare.outputs.to_tag}}
161+
TARGET_BASE: ${{needs.prepare.outputs.base_image_version}}
160162

161163
steps:
162164
- uses: actions/checkout@v4
@@ -166,13 +168,15 @@ jobs:
166168

167169
- name: Launch build VM
168170
id: azlaunch
171+
timeout-minutes: 10
169172
run: |
170173
echo "Authenticating to Azure..."
171174
az login --service-principal -u ${{ secrets.AZ_BUILD_APP_ID }} -p ${{ secrets.AZ_BUILD_PWD }} --tenant ${{ secrets.AZ_BUILD_TENANT_ID }}
175+
172176
echo "Creating VM..."
173177
vminfo=$(az vm create \
174178
--resource-group ghaDatatracker \
175-
--name tmpGhaBuildVM \
179+
--name tmpGhaBuildVM-${{ github.run_number }} \
176180
--image Ubuntu2204 \
177181
--admin-username azureuser \
178182
--generate-ssh-keys \
@@ -183,11 +187,19 @@ jobs:
183187
--os-disk-size-gb 100 \
184188
--eviction-policy Delete \
185189
--nic-delete-option Delete \
190+
--os-disk-delete-option Delete \
186191
--output tsv \
187192
--query "publicIpAddress")
188193
echo "ipaddr=$vminfo" >> "$GITHUB_OUTPUT"
189194
echo "VM Public IP: $vminfo"
190195
cat ~/.ssh/id_rsa > ${{ github.workspace }}/prvkey.key
196+
197+
echo "Fetching SSH host public keys..."
198+
until ssh-keyscan -t rsa $vminfo 2> /dev/null
199+
do
200+
echo "Will try again in 5 seconds..."
201+
sleep 5
202+
done
191203
ssh-keyscan -t rsa $vminfo >> ~/.ssh/known_hosts
192204
193205
- name: Remote SSH into Build VM
@@ -207,7 +219,7 @@ jobs:
207219
SKIP_TESTS: ${{ github.event.inputs.skiptests }}
208220
DEBIAN_FRONTEND: noninteractive
209221
BROWSERSLIST_IGNORE_OLD_DATA: 1
210-
TARGETBASE: ${{ needs.prepare.outputs.base_image_version }}
222+
TARGET_BASE: ${{ env.TARGET_BASE }}
211223
with:
212224
host: ${{ steps.azlaunch.outputs.ipaddr }}
213225
port: 22
@@ -318,7 +330,8 @@ jobs:
318330
echo "=========================================================================="
319331
echo "Collecting statics..."
320332
echo "=========================================================================="
321-
sudo docker run --rm --name collectstatics -v $(pwd):/workspace ghcr.io/ietf-tools/datatracker-app-base:$TARGETBASE sh dev/build/collectstatics.sh
333+
echo "Using ghcr.io/ietf-tools/datatracker-app-base:${{ env.TARGET_BASE }}"
334+
sudo docker run --rm --name collectstatics -v $(pwd):/workspace ghcr.io/ietf-tools/datatracker-app-base:${{ env.TARGET_BASE }} sh dev/build/collectstatics.sh
322335
echo "Pushing statics..."
323336
cd static
324337
aws s3 sync . s3://static/dt/$PKG_VERSION --only-show-errors
@@ -353,29 +366,29 @@ jobs:
353366
shell: pwsh
354367
run: |
355368
echo "Destroying VM..."
356-
az vm delete -g ghaDatatracker -n tmpGhaBuildVM --yes --force-deletion true
357-
358-
$resourceOrderRemovalOrder = [ordered]@{
359-
"Microsoft.Compute/virtualMachines" = 0
360-
"Microsoft.Compute/disks" = 1
361-
"Microsoft.Network/networkInterfaces" = 2
362-
"Microsoft.Network/publicIpAddresses" = 3
363-
"Microsoft.Network/networkSecurityGroups" = 4
364-
"Microsoft.Network/virtualNetworks" = 5
365-
}
366-
echo "Fetching remaining resources..."
367-
$resources = az resource list --resource-group ghaDatatracker | ConvertFrom-Json
368-
369-
$orderedResources = $resources
370-
| Sort-Object @{
371-
Expression = {$resourceOrderRemovalOrder[$_.type]}
372-
Descending = $False
373-
}
374-
375-
echo "Deleting remaining resources..."
376-
$orderedResources | ForEach-Object {
377-
az resource delete --resource-group ghaDatatracker --ids $_.id --verbose
378-
}
369+
az vm delete -g ghaDatatracker -n tmpGhaBuildVM-${{ github.run_number }} --yes --force-deletion true
370+
371+
# $resourceOrderRemovalOrder = [ordered]@{
372+
# "Microsoft.Compute/virtualMachines" = 0
373+
# "Microsoft.Compute/disks" = 1
374+
# "Microsoft.Network/networkInterfaces" = 2
375+
# "Microsoft.Network/publicIpAddresses" = 3
376+
# "Microsoft.Network/networkSecurityGroups" = 4
377+
# "Microsoft.Network/virtualNetworks" = 5
378+
# }
379+
# echo "Fetching remaining resources..."
380+
# $resources = az resource list --resource-group ghaDatatracker | ConvertFrom-Json
381+
382+
# $orderedResources = $resources
383+
# | Sort-Object @{
384+
# Expression = {$resourceOrderRemovalOrder[$_.type]}
385+
# Descending = $False
386+
# }
387+
388+
# echo "Deleting remaining resources..."
389+
# $orderedResources | ForEach-Object {
390+
# az resource delete --resource-group ghaDatatracker --ids $_.id --verbose
391+
# }
379392
380393
echo "Logout from Azure..."
381394
az logout

.github/workflows/tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
default: false
99
required: true
1010
type: boolean
11+
skipSelenium:
12+
description: 'Skip Selenium Tests'
13+
default: false
14+
required: true
15+
type: boolean
1116
targetBaseVersion:
1217
description: 'Target Base Image Version'
1318
default: latest
@@ -47,6 +52,10 @@ jobs:
4752
echo "Model changes without migrations found."
4853
exit 1
4954
fi
55+
if [[ "x${{ inputs.skipSelenium }}" == "xtrue" ]]; then
56+
echo "Disable selenium tests..."
57+
rm /usr/bin/geckodriver
58+
fi
5059
echo "Running tests..."
5160
if [[ "x${{ inputs.ignoreLowerCoverage }}" == "xtrue" ]]; then
5261
echo "Lower coverage failures will be ignored."

0 commit comments

Comments
 (0)