Skip to content

Commit e74749c

Browse files
authored
Merge branch 'stackhpc/2023.1' into firewall-config
2 parents 2c96950 + 7fc90f2 commit e74749c

File tree

175 files changed

+30806
-21499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+30806
-21499
lines changed

.github/path-filters.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is a list of path filters for the PR workflow in .github/workflows/stackhpc-pull-request.yml.
2-
aio:
2+
aio: &aio
33
- '.automation'
44
- '.automation.conf/config.sh'
55
- '.automation.conf/tempest/load-lists/default'
@@ -20,6 +20,11 @@ aio:
2020
- 'kayobe-env'
2121
- 'requirements.txt'
2222
- 'terraform/aio/**'
23-
check-tags:
23+
check-tags: &check-tags
2424
- '.github/workflows/stackhpc-check-tags.yml'
2525
- 'etc/kayobe/kolla-image-tags.yml'
26+
- 'etc/kayobe/pulp.yml'
27+
- 'tools/kolla-images.py'
28+
build-kayobe-image:
29+
- *aio
30+
- *check-tags
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Generate inputs for the reusable multinode.yml workflow.
2+
# The test scenario is randomly selected.
3+
# The inputs are printed to stdout in GitHub step output key=value format.
4+
5+
from dataclasses import dataclass
6+
import random
7+
import typing as t
8+
9+
10+
@dataclass
11+
class OSRelease:
12+
distribution: str
13+
release: str
14+
ssh_username: str
15+
16+
17+
@dataclass
18+
class OpenStackRelease:
19+
version: str
20+
previous_version: str
21+
os_releases: t.List[OSRelease]
22+
23+
24+
@dataclass
25+
class Scenario:
26+
openstack_release: OpenStackRelease
27+
os_release: OSRelease
28+
neutron_plugin: str
29+
upgrade: bool
30+
31+
32+
ROCKY_9 = OSRelease("rocky", "9", "cloud-user")
33+
UBUNTU_JAMMY = OSRelease("ubuntu", "jammy", "ubuntu")
34+
# NOTE(upgrade): Add supported releases here.
35+
OPENSTACK_RELEASES = [
36+
OpenStackRelease("2024.1", "2023.1", [ROCKY_9, UBUNTU_JAMMY]),
37+
OpenStackRelease("2023.1", "zed", [ROCKY_9, UBUNTU_JAMMY]),
38+
]
39+
NEUTRON_PLUGINS = ["ovs", "ovn"]
40+
41+
42+
def main() -> None:
43+
scenario = random_scenario()
44+
inputs = generate_inputs(scenario)
45+
for name, value in inputs.items():
46+
write_output(name, value)
47+
48+
49+
def random_scenario() -> Scenario:
50+
openstack_release = random.choice(OPENSTACK_RELEASES)
51+
os_release = random.choice(openstack_release.os_releases)
52+
neutron_plugin = random.choice(NEUTRON_PLUGINS)
53+
upgrade = random.random() > 0.6
54+
return Scenario(openstack_release, os_release, neutron_plugin, upgrade)
55+
56+
57+
def generate_inputs(scenario: Scenario) -> t.Dict[str, str]:
58+
branch = get_branch(scenario.openstack_release.version)
59+
previous_branch = get_branch(scenario.openstack_release.previous_version)
60+
inputs = {
61+
"os_distribution": scenario.os_release.distribution,
62+
"os_release": scenario.os_release.release,
63+
"ssh_username": scenario.os_release.ssh_username,
64+
"neutron_plugin": scenario.neutron_plugin,
65+
"upgrade": str(scenario.upgrade).lower(),
66+
"stackhpc_kayobe_config_version": branch,
67+
"stackhpc_kayobe_config_previous_version": previous_branch,
68+
}
69+
return inputs
70+
71+
72+
def get_branch(version: str) -> str:
73+
return f"stackhpc/{version}"
74+
75+
76+
def write_output(name: str, value: str) -> None:
77+
print(f"{name}={value}")
78+
79+
80+
if __name__ == "__main__":
81+
main()

.github/workflows/overcloud-host-image-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ jobs:
198198
source venvs/kayobe/bin/activate &&
199199
source src/kayobe-config/kayobe-env --environment ci-builder &&
200200
kayobe seed host command run \
201-
--command "sudo dnf config-manager --set-enabled crb && sudo dnf -y install epel-release && sudo dnf -y install zstd debootstrap kpartx cloud-init" --show-output
201+
--command "sudo dnf config-manager --set-enabled crb && sudo dnf -y install epel-release && sudo dnf -y install cloud-init debootstrap git kpartx zstd" --show-output
202202
env:
203203
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
204204

.github/workflows/stackhpc-all-in-one.yml

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
VM_NETWORK: ${{ inputs.vm_network }}
168168
VM_SUBNET: ${{ inputs.vm_subnet }}
169169
VM_INTERFACE: ${{ inputs.vm_interface }}
170-
VM_VOLUME_SIZE: ${{ inputs.upgrade && '45' || '35' }}
170+
VM_VOLUME_SIZE: ${{ inputs.upgrade && '55' || '40' }}
171171
VM_TAGS: '["skc-ci-aio", "PR=${{ github.event.number }}"]'
172172

173173
- name: Terraform Plan
@@ -179,6 +179,7 @@ jobs:
179179
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
180180

181181
- name: Terraform Apply
182+
id: tf_apply
182183
run: |
183184
for attempt in $(seq 5); do
184185
if terraform apply -auto-approve; then
@@ -355,28 +356,82 @@ jobs:
355356
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
356357
if: inputs.upgrade
357358

359+
- name: Ensure we have IP on breth1 to reach the instances
360+
# NOTE(wszumski): Whilst we don't need to create resources again, in some circumstances
361+
# we can lose the IP address that allows us to connect to the instances. This playbook
362+
# also fixes that issue.
363+
run: |
364+
docker run -t --rm \
365+
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
366+
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
367+
${{ steps.kayobe_image.outputs.kayobe_image }} \
368+
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh etc/kayobe/ansible/configure-aio-resources.yml
369+
env:
370+
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
371+
if: inputs.upgrade
372+
358373
- name: Tempest tests
374+
id: tempest
359375
run: |
360376
mkdir -p tempest-artifacts
361377
docker run -t --rm \
362378
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
363379
-v $(pwd)/tempest-artifacts:/stack/tempest-artifacts \
364380
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
365381
$KAYOBE_IMAGE \
366-
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/tempest.sh -e ansible_user=stack -e rally_no_sensitive_log=false
382+
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/tempest.sh -e ansible_user=stack
383+
env:
384+
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
385+
386+
- name: StackHPC OpenStack tests
387+
id: stackhpc-openstack-tests
388+
continue-on-error: true
389+
run: |
390+
mkdir -p sot-results
391+
docker run -t --rm \
392+
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
393+
-v $(pwd)/sot-results:/stack/sot-results \
394+
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
395+
$KAYOBE_IMAGE \
396+
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh '$KAYOBE_CONFIG_PATH/ansible/stackhpc-openstack-tests.yml'
397+
env:
398+
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
399+
400+
- name: Collect diagnostic information
401+
id: diagnostics
402+
run: |
403+
mkdir -p diagnostics
404+
sudo -E docker run -t --rm \
405+
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
406+
-v $(pwd)/diagnostics:/stack/diagnostics \
407+
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
408+
$KAYOBE_IMAGE \
409+
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh '$KAYOBE_CONFIG_PATH/ansible/diagnostics.yml'
367410
env:
368411
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
412+
if: ${{ !cancelled() && steps.tf_apply.outcome == 'success' }}
369413

370414
- name: Upload test result artifacts
371415
uses: actions/upload-artifact@v4
372416
with:
373-
name: tempest-results-${{ inputs.os_distribution }}-${{ inputs.os_release }}-${{ inputs.neutron_plugin }}${{ inputs.upgrade && '-upgrade' }}
374-
path: tempest-artifacts/*
417+
name: test-results-${{ inputs.os_distribution }}-${{ inputs.os_release }}-${{ inputs.neutron_plugin }}${{ inputs.upgrade && '-upgrade' || '' }}
418+
path: |
419+
diagnostics/
420+
tempest-artifacts/
421+
sot-results/
422+
if: ${{ !cancelled() && (steps.tempest.outcome == 'success' || steps.stackhpc-openstack-tests.outcome == 'success' || steps.diagnostics.outcome == 'success') }}
375423

376424
- name: Fail if any Tempest tests failed
377425
run: |
378426
test $(wc -l < tempest-artifacts/failed-tests) -lt 1
379427
428+
- name: Fail if any StackHPC OpenStack tests failed
429+
run: |
430+
echo "Some StackHPC OpenStack tests failed."
431+
echo "See HTML results artifact (sot-results) for details."
432+
exit 1
433+
if: steps.stackhpc-openstack-tests.outcome == 'failure'
434+
380435
- name: Destroy
381436
run: terraform destroy -auto-approve
382437
working-directory: ${{ github.workspace }}/terraform/aio

.github/workflows/stackhpc-check-tags.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ jobs:
4646
run: |
4747
docker image pull $KAYOBE_IMAGE
4848
49+
- name: Check kolla-images.py image map and tag hierarchy
50+
run: |
51+
docker run -t --rm \
52+
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
53+
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
54+
$KAYOBE_IMAGE \
55+
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh \
56+
'$KAYOBE_CONFIG_PATH/ansible/check-kolla-images-py.yml'
57+
4958
- name: Check container image tags
5059
run: |
5160
docker run -t --rm \

.github/workflows/stackhpc-container-image-build.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ on:
3434
required: false
3535
default: true
3636
push-dirty:
37-
description: Push scanned images that have vulnerabilities?
37+
description: Push scanned images that have critical vulnerabilities?
3838
type: boolean
3939
required: false
40-
# NOTE(Alex-Welsh): This default should be flipped once we resolve existing failures
41-
default: true
40+
default: false
4241

4342
env:
4443
ANSIBLE_FORCE_COLOR: True
@@ -136,6 +135,10 @@ jobs:
136135
run: |
137136
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin v0.49.0
138137
138+
- name: Install yq
139+
run: |
140+
curl -sL https://github.com/mikefarah/yq/releases/download/v4.42.1/yq_linux_amd64.tar.gz | tar xz && sudo mv yq_linux_amd64 /usr/bin/yq
141+
139142
- name: Install Kayobe
140143
run: |
141144
mkdir -p venvs &&
@@ -176,7 +179,7 @@ jobs:
176179
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
177180

178181
- name: Create build logs output directory
179-
run: mkdir image-build-logs
182+
run: mkdir image-build-logs
180183

181184
- name: Build kolla overcloud images
182185
id: build_overcloud_images
@@ -228,16 +231,23 @@ jobs:
228231
run: mv image-scan-output image-build-logs/image-scan-output
229232

230233
- name: Fail if no images have passed scanning
231-
run: if [ $(wc -l < image-build-logs/image-scan-output/clean-images.txt) -le 0 ]; then exit 1; fi
234+
run: if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then exit 1; fi
232235
if: ${{ !inputs.push-dirty }}
233236

234237
- name: Copy clean images to push-attempt-images list
235238
run: cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
236239
if: inputs.push
237240

241+
# NOTE(seunghun1ee): This always appends dirty images with CVEs severity lower than critical.
242+
# This should be reverted when it's decided to filter high level CVEs as well.
238243
- name: Append dirty images to push list
239244
run: |
240245
cat image-build-logs/image-scan-output/dirty-images.txt >> image-build-logs/push-attempt-images.txt
246+
if: ${{ inputs.push }}
247+
248+
- name: Append images with critical vulnerabilities to push list
249+
run: |
250+
cat image-build-logs/image-scan-output/critical-images.txt >> image-build-logs/push-attempt-images.txt
241251
if: ${{ inputs.push && inputs.push-dirty }}
242252

243253
- name: Push images
@@ -249,7 +259,7 @@ jobs:
249259
250260
while read -r image; do
251261
# Retries!
252-
for i in {1..5}; do
262+
for i in {1..5}; do
253263
if docker push $image; then
254264
echo "Pushed $image"
255265
break
@@ -283,8 +293,15 @@ jobs:
283293
run: if [ $(wc -l < image-build-logs/push-failed-images.txt) -gt 0 ]; then cat image-build-logs/push-failed-images.txt && exit 1; fi
284294
if: ${{ !cancelled() }}
285295

286-
- name: Fail when images failed scanning
287-
run: if [ $(wc -l < image-build-logs/dirty-images.txt) -gt 0 ]; then cat image-build-logs/dirty-images.txt && exit 1; fi
296+
# NOTE(seunghun1ee): Currently we want to mark the job fail only when critical CVEs are detected.
297+
# This can be used again instead of "Fail when critical vulnerabilities are found" when it's
298+
# decided to fail the job on detecting high CVEs as well.
299+
# - name: Fail when images failed scanning
300+
# run: if [ $(wc -l < image-build-logs/image-scan-output/dirty-images.txt) -gt 0 ]; then cat image-build-logs/image-scan-output/dirty-images.txt && exit 1; fi
301+
# if: ${{ !inputs.push-dirty && !cancelled() }}
302+
303+
- name: Fail when critical vulnerabilities are found
304+
run: if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then cat image-build-logs/image-scan-output/critical-images.txt && exit 1; fi
288305
if: ${{ !inputs.push-dirty && !cancelled() }}
289306

290307
# NOTE(mgoddard): Trigger another CI workflow in the
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
# This workflow provides a periodic deploy of a multi-node test cluster.
3+
# The test scenario is randomly selected.
4+
5+
name: Multinode periodic
6+
'on':
7+
schedule:
8+
# Runs nightly at 2:42 AM.
9+
- cron: "42 2 * * *"
10+
jobs:
11+
generate-inputs:
12+
name: Generate inputs
13+
runs-on: ubuntu-latest
14+
outputs:
15+
os_distribution: ${{ steps.generate-inputs.outputs.os_distribution }}
16+
os_release: ${{ steps.generate-inputs.outputs.os_release }}
17+
ssh_username: ${{ steps.generate-inputs.outputs.ssh_username }}
18+
neutron_plugin: ${{ steps.generate-inputs.outputs.neutron_plugin }}
19+
upgrade: ${{ steps.generate-inputs.outputs.upgrade }}
20+
stackhpc_kayobe_config_version: ${{ steps.generate-inputs.outputs.stackhpc_kayobe_config_version }}
21+
stackhpc_kayobe_config_previous_version: ${{ steps.generate-inputs.outputs.stackhpc_kayobe_config_previous_version }}
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Generate inputs for multinode workflow
27+
id: generate-inputs
28+
run: |
29+
python3 .github/workflows/multinode-inputs.py >> $GITHUB_OUTPUT
30+
31+
- name: Display generated inputs
32+
run: |
33+
echo '${{ toJSON(steps.generate-inputs.outputs) }}'
34+
multinode:
35+
name: Multinode periodic
36+
needs:
37+
- generate-inputs
38+
uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/[email protected]
39+
with:
40+
multinode_name: mn-prdc-${{ github.run_id }}
41+
os_distribution: ${{ needs.generate-inputs.outputs.os_distribution }}
42+
os_release: ${{ needs.generate-inputs.outputs.os_release }}
43+
ssh_username: ${{ needs.generate-inputs.outputs.ssh_username }}
44+
neutron_plugin: ${{ needs.generate-inputs.outputs.neutron_plugin }}
45+
upgrade: ${{ needs.generate-inputs.outputs.upgrade == 'true' }}
46+
stackhpc_kayobe_config_version: ${{ needs.generate-inputs.outputs.stackhpc_kayobe_config_version }}
47+
stackhpc_kayobe_config_previous_version: ${{ needs.generate-inputs.outputs.stackhpc_kayobe_config_previous_version }}
48+
enable_slack_alert: true
49+
secrets: inherit
50+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'

0 commit comments

Comments
 (0)