Skip to content

Commit dc28a86

Browse files
committed
feat: auto-compute container matrix and set Python 3.14 as default
- Update default Python version from 3.13 to 3.14 (latest stable) - Auto-generate container build matrix from .project.yml python versions - Default Python version gets full security scan, others get basic - Hadolint runs only on default Python version - Eliminates manual matrix maintenance when adding new Python versions
1 parent 55df210 commit dc28a86

2 files changed

Lines changed: 10 additions & 21 deletions

File tree

.github/workflows/container-build.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,11 @@ jobs:
7575

7676
strategy:
7777
matrix:
78-
include:
79-
- python-version: "3.10"
80-
scan-level: basic
81-
push-to-registry: true
82-
- python-version: "3.11"
83-
scan-level: basic
84-
push-to-registry: true
85-
- python-version: "3.12"
86-
scan-level: basic
87-
push-to-registry: true
88-
- python-version: "3.13"
89-
scan-level: full
90-
push-to-registry: true
91-
- python-version: "3.14"
92-
scan-level: basic
93-
push-to-registry: true
78+
python-version: ${{ fromJSON(needs.config.outputs.python-versions) }}
79+
80+
env:
81+
SCAN_LEVEL: ${{ matrix.python-version == needs.config.outputs.default-python-version && 'full' || 'basic' }}
82+
PUSH_TO_REGISTRY: true
9483

9584
permissions:
9685
contents: read
@@ -129,7 +118,7 @@ jobs:
129118
VERSION: ${{ needs.config.outputs.package-version }}
130119
PYTHON_VERSION: ${{ matrix.python-version }}
131120
run: |
132-
if [[ "${{ matrix.push-to-registry }}" == "true" && "${{ github.event_name }}" != "pull_request" ]]; then
121+
if [[ "${{ env.PUSH_TO_REGISTRY }}" == "true" && "${{ github.event_name }}" != "pull_request" ]]; then
133122
# Build multi-platform image and push to registry
134123
docker buildx build \
135124
--platform linux/amd64,linux/arm64 \
@@ -169,7 +158,7 @@ jobs:
169158
format: 'sarif'
170159
output: 'trivy-results-py${{ matrix.python-version }}.sarif'
171160
exit-code: '0'
172-
severity: ${{ matrix.scan-level == 'full' && 'CRITICAL,HIGH,MEDIUM' || 'CRITICAL,HIGH' }}
161+
severity: ${{ env.SCAN_LEVEL == 'full' && 'CRITICAL,HIGH,MEDIUM' || 'CRITICAL,HIGH' }}
173162

174163
- name: Upload Trivy scan results
175164
uses: github/codeql-action/upload-sarif@v4
@@ -178,7 +167,7 @@ jobs:
178167
sarif_file: 'trivy-results-py${{ matrix.python-version }}.sarif'
179168

180169
- name: Run Hadolint Dockerfile scan
181-
if: matrix.python-version == '3.13'
170+
if: matrix.python-version == needs.config.outputs.default-python-version
182171
uses: hadolint/hadolint-action@v3.1.0
183172
with:
184173
dockerfile: Dockerfile
@@ -187,7 +176,7 @@ jobs:
187176
no-fail: true
188177

189178
- name: Upload Hadolint scan results
190-
if: matrix.python-version == '3.13'
179+
if: matrix.python-version == needs.config.outputs.default-python-version
191180
uses: github/codeql-action/upload-sarif@v4
192181
with:
193182
sarif_file: hadolint-dockerfile.sarif

.project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ project:
1212
license: "Apache-2.0"
1313
python:
1414
versions: ["3.10", "3.11", "3.12", "3.13", "3.14"] # Supported Python versions
15-
default_version: 3.13
15+
default_version: 3.14
1616
repository:
1717
org: awslabs
1818
name: open-resource-broker

0 commit comments

Comments
 (0)