Skip to content

Commit e4cbeba

Browse files
committed
Add testing against fips docker image
Schedule a weekly run for running a portion of the test suite inside a fips enabled container image.
1 parent 41f65b4 commit e4cbeba

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.ci/.matrix_python_fips.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VERSION:
2+
- python-3.12

.github/workflows/test-fips.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
# run test suite inside a FIPS 140 container
3+
name: test-fips
4+
5+
on:
6+
workflow_dispatch:
7+
schedule:
8+
- cron: '0 4 * * 1'
9+
pull_request:
10+
# FIXME: REMOVE ME
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
create-matrix:
17+
runs-on: ubuntu-24.04
18+
outputs:
19+
matrix: ${{ steps.generate.outputs.matrix }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- id: generate
23+
uses: elastic/oblt-actions/version-framework@v1
24+
with:
25+
versions-file: .ci/.matrix_python_fips.yml
26+
frameworks-file: .ci/.matrix_framework.yml
27+
excluded-file: .ci/.matrix_exclude.yml
28+
29+
test-fips:
30+
needs: create-matrix
31+
runs-on: ubuntu-24.04
32+
# https://docs.github.com/en/actions/writing-workflows/choosing-where-your-workflow-runs/running-jobs-in-a-container
33+
# docker run -it --rm --name fipsy docker.elastic.co/wolfi/chainguard-python-fips:3.12
34+
container:
35+
image: docker.elastic.co/wolfi/chainguard-python-fips:3.12-dev
36+
credentials:
37+
username: ${{ secrets.ELASTIC_DOCKER_USERNAME }}
38+
password: ${{ secrets.ELASTIC_DOCKER_PASSWORD }}
39+
strategy:
40+
fail-fast: false
41+
max-parallel: 10
42+
matrix: ${{ fromJSON(needs.create-matrix.outputs.matrix) }}
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: check that python has fips mode enabled
46+
run: |
47+
python3 -c 'import _hashlib; assert _hashlib.get_fips_mode() == 1'
48+
- name: Run tests
49+
run: ./tests/scripts/run_tests.sh ${{ matrix.version }} ${{ matrix.framework }}
50+
51+
notify-on-failure:
52+
if: always()
53+
runs-on: ubuntu-24.04
54+
needs: test-fips
55+
steps:
56+
- id: check
57+
uses: elastic/oblt-actions/check-dependent-jobs@v1
58+
with:
59+
jobs: ${{ toJSON(needs) }}
60+
- name: Notify in Slack
61+
if: steps.check.outputs.status == 'failure'
62+
uses: elastic/oblt-actions/slack/notify-result@v1
63+
with:
64+
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
65+
status: ${{ steps.check.outputs.status }}
66+
channel-id: "#apm-agent-python"

0 commit comments

Comments
 (0)