Skip to content

Commit 1e00166

Browse files
authored
Merge pull request #1130 from stackhpc/2023.1-zed-merge
2023.1: zed merge
2 parents e829797 + 2b191ab commit 1e00166

File tree

5 files changed

+48
-19
lines changed

5 files changed

+48
-19
lines changed

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

Lines changed: 20 additions & 7 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
@@ -180,7 +179,7 @@ jobs:
180179
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
181180

182181
- name: Create build logs output directory
183-
run: mkdir image-build-logs
182+
run: mkdir image-build-logs
184183

185184
- name: Build kolla overcloud images
186185
id: build_overcloud_images
@@ -239,9 +238,16 @@ jobs:
239238
run: cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
240239
if: inputs.push
241240

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.
242243
- name: Append dirty images to push list
243244
run: |
244245
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
245251
if: ${{ inputs.push && inputs.push-dirty }}
246252

247253
- name: Push images
@@ -253,7 +259,7 @@ jobs:
253259
254260
while read -r image; do
255261
# Retries!
256-
for i in {1..5}; do
262+
for i in {1..5}; do
257263
if docker push $image; then
258264
echo "Pushed $image"
259265
break
@@ -287,8 +293,15 @@ jobs:
287293
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
288294
if: ${{ !cancelled() }}
289295

290-
- name: Fail when images failed scanning
291-
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
292305
if: ${{ !inputs.push-dirty && !cancelled() }}
293306

294307
# NOTE(mgoddard): Trigger another CI workflow in the

doc/source/operations/octavia.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Octavia
33
=======
44

5+
.. _Amphora image:
6+
57
Building and rotating amphora images
68
====================================
79

doc/source/operations/upgrading.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ To upgrade the Ansible control host:
458458
Syncing Release Train artifacts
459459
-------------------------------
460460

461-
New `StackHPC Release Train <../configuration/release-train>` content should be
462-
synced to the local Pulp server. This includes host packages (Deb/RPM) and
461+
New `StackHPC Release Train <../configuration/release-train>`_ content should
462+
be synced to the local Pulp server. This includes host packages (Deb/RPM) and
463463
container images.
464464

465465
.. _sync-rt-package-repos:
@@ -1067,6 +1067,12 @@ scope of the upgrade:
10671067
10681068
kayobe overcloud service upgrade --tags config --kolla-tags keystone
10691069
1070+
Updating the Octavia Amphora Image
1071+
----------------------------------
1072+
1073+
If using Octavia with the Amphora driver, you should :ref:`build a new amphora
1074+
image <Amphora image>`.
1075+
10701076
Testing
10711077
-------
10721078

etc/kayobe/kolla/config/prometheus/system.rules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ groups:
2525
description: "Available memory is {{ $value }} GiB."
2626

2727
- alert: LowSwapSpace
28-
expr: (node_memory_SwapFree_bytes / node_memory_SwapTotal_bytes) < {% endraw %}{{ alertmanager_node_free_swap_warning_threshold_ratio }}{% raw %}
28+
expr: node_memory_SwapTotal_bytes > 0 and (node_memory_SwapFree_bytes / node_memory_SwapTotal_bytes) < {% endraw %}{{ alertmanager_node_free_swap_warning_threshold_ratio }}{% raw %}
2929
for: 1m
3030
labels:
3131
severity: warning
@@ -34,7 +34,7 @@ groups:
3434
description: "Available swap space is {{ $value | humanizePercentage }}. Running out of swap space causes OOM Kills."
3535

3636
- alert: LowSwapSpace
37-
expr: (node_memory_SwapFree_bytes / node_memory_SwapTotal_bytes) < {% endraw %}{{ alertmanager_node_free_swap_critical_threshold_ratio }}{% raw %}
37+
expr: node_memory_SwapTotal_bytes > 0 and (node_memory_SwapFree_bytes / node_memory_SwapTotal_bytes) < {% endraw %}{{ alertmanager_node_free_swap_critical_threshold_ratio }}{% raw %}
3838
for: 1m
3939
labels:
4040
severity: critical

tools/scan-images.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:$2" > $1-sca
2727
images=$(grep --invert-match --no-filename ^REPOSITORY $1-scanned-container-images.txt | sed 's/ \+/:/g' | cut -f 1,2 -d:)
2828

2929
# Ensure output files exist
30-
touch image-scan-output/clean-images.txt image-scan-output/dirty-images.txt
30+
touch image-scan-output/clean-images.txt image-scan-output/dirty-images.txt image-scan-output/critical-images.txt
3131

3232
# If Trivy detects no vulnerabilities, add the image name to clean-images.txt.
3333
# If there are vulnerabilities detected, add it to dirty-images.txt and
3434
# generate a csv summary
35+
# If the image contains at least one critical vulnerabilities, add it to
36+
# critical-images.txt
3537
for image in $images; do
3638
filename=$(basename $image | sed 's/:/\./g')
3739
imagename=$(echo $filename | cut -d "." -f 1 | sed 's/-/_/g')
@@ -59,15 +61,13 @@ for image in $images; do
5961
# Add the image to the clean list
6062
echo "${image}" >> image-scan-output/clean-images.txt
6163
else
62-
# Add the image to the dirty list
63-
echo "${image}" >> image-scan-output/dirty-images.txt
64-
64+
6565
# Write a header for the summary CSV
6666
echo '"PkgName","PkgPath","PkgID","VulnerabilityID","FixedVersion","PrimaryURL","Severity"' > image-scan-output/${filename}.summary.csv
6767

6868
# Write the summary CSV data
69-
jq -r '.Results[]
70-
| select(.Vulnerabilities)
69+
jq -r '.Results[]
70+
| select(.Vulnerabilities)
7171
| .Vulnerabilities
7272
# Ignore packages with "kernel" in the PkgName
7373
| map(select(.PkgName | test("kernel") | not ))
@@ -82,9 +82,17 @@ for image in $images; do
8282
.[0].PrimaryURL,
8383
.[0].Severity
8484
]
85-
)
86-
| .[]
85+
)
86+
| .[]
8787
| @csv' image-scan-output/${filename}.json >> image-scan-output/${filename}.summary.csv
88+
89+
if [ $(grep "CRITICAL" image-scan-output/${filename}.summary.csv -c) -gt 0 ]; then
90+
# If the image contains critical vulnerabilities, add the image to critical list
91+
echo "${image}" >> image-scan-output/critical-images.txt
92+
else
93+
# Otherwise, add the image to the dirty list
94+
echo "${image}" >> image-scan-output/dirty-images.txt
95+
fi
8896
fi
8997
rm .trivyignore
9098
done

0 commit comments

Comments
 (0)