Skip to content

Commit 3fbc9e9

Browse files
committed
bump image and test trivy scan
1 parent a256bce commit 3fbc9e9

File tree

3 files changed

+48
-24
lines changed

3 files changed

+48
-24
lines changed

.github/workflows/trivyscan.yml

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,56 @@ on:
88
jobs:
99
scan:
1010
concurrency:
11-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os_version }}-${{ matrix.build }} # to branch/PR + OS + build
11+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.build }} # to branch/PR + OS + build
1212
cancel-in-progress: true
1313
runs-on: ubuntu-latest
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os_version:
18-
- RL8
19-
- RL9
20-
build:
21-
- openstack.openhpc
22-
- openstack.openhpc-cuda
23-
exclude:
24-
- os_version: RL8
25-
build: openstack.openhpc-cuda
17+
build: ["RL8", "RL9", "RL9-cuda"]
2618
env:
27-
BUILD: ${{ matrix.build }}-${{ matrix.os_version }}
19+
JSON_PATH: environments/.stackhpc/terraform/cluster_image.json
20+
OS_CLOUD: openstack
21+
CI_CLOUD: ${{ vars.CI_CLOUD }}
2822

2923
steps:
30-
- name: Download image details artifact
31-
uses: actions/download-artifact@v4
32-
with:
33-
name: image-details-${{ env.BUILD }}
24+
- uses: actions/checkout@v2
25+
26+
- name: Record settings for CI cloud
27+
run: |
28+
echo CI_CLOUD: ${{ env.CI_CLOUD }}
29+
30+
- name: Setup ssh
31+
run: |
32+
set -x
33+
mkdir ~/.ssh
34+
echo "${{ secrets[format('{0}_SSH_KEY', env.CI_CLOUD)] }}" > ~/.ssh/id_rsa
35+
chmod 0600 ~/.ssh/id_rsa
36+
shell: bash
37+
38+
- name: Add bastion's ssh key to known_hosts
39+
run: cat environments/.stackhpc/bastion_fingerprints >> ~/.ssh/known_hosts
40+
shell: bash
41+
42+
- name: setup environment
43+
run: |
44+
python3 -m venv venv
45+
. venv/bin/activate
46+
pip install -U pip
47+
pip install $(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)
48+
shell: bash
49+
50+
- name: Write clouds.yaml
51+
run: |
52+
mkdir -p ~/.config/openstack/
53+
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
54+
shell: bash
3455

35-
- name: Use the downloaded artifact
56+
- name: Parse image name json
3657
id: manifest
3758
run: |
38-
IMAGE_ID=$(cat image-id.txt)
39-
IMAGE_NAME=$(cat image-name.txt)
59+
IMAGE_NAME=$(jq --arg version "${{ matrix.build }}" -r '.[$version]' "${{ env.JSON_PATH }}")
4060
echo "image-name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
41-
echo "image-id=${IMAGE_ID}" >> "$GITHUB_OUTPUT"
4261
4362
- name: Download image
4463
run: |
@@ -70,6 +89,8 @@ jobs:
7089
format: sarif
7190
output: "${{ steps.manifest.outputs.image-name }}.sarif"
7291
# turn off secret scanning to speed things up
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7394

7495
- name: Upload Trivy scan results to GitHub Security tab
7596
uses: github/codeql-action/upload-sarif@v3
@@ -87,3 +108,5 @@ jobs:
87108
exit-code: '1'
88109
severity: 'CRITICAL'
89110
ignore-unfixed: true
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"RL8": "openhpc-RL8-241003-1241-a256bce2",
3+
"RL9": "openhpc-RL9-241003-1241-a256bce2",
4+
"RL9-cuda": "openhpc-cuda-RL9-241003-1242-a256bce2"
5+
}

environments/.stackhpc/terraform/main.tf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ variable "os_version" {
2828
variable "cluster_image" {
2929
description = "single image for all cluster nodes, keyed by os_version - a convenience for CI"
3030
type = map(string)
31-
default = {
32-
# https://github.com/stackhpc/ansible-slurm-appliance/pull/427
33-
RL8: "openhpc-RL8-241003-1122-348c1508"
34-
RL9: "openhpc-RL9-241003-1122-348c1508"
35-
}
31+
default = jsondecode(file("./cluster_image.json"))
3632
}
3733

3834
variable "cluster_net" {}

0 commit comments

Comments
 (0)