|
| 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 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + create-matrix: |
| 15 | + runs-on: ubuntu-24.04 |
| 16 | + outputs: |
| 17 | + matrix: ${{ steps.generate.outputs.matrix }} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - id: generate |
| 21 | + uses: elastic/oblt-actions/version-framework@v1 |
| 22 | + with: |
| 23 | + versions-file: .ci/.matrix_python_fips.yml |
| 24 | + frameworks-file: .ci/.matrix_framework_fips.yml |
| 25 | + |
| 26 | + test-fips: |
| 27 | + needs: create-matrix |
| 28 | + runs-on: ubuntu-24.04 |
| 29 | + # https://docs.github.com/en/actions/writing-workflows/choosing-where-your-workflow-runs/running-jobs-in-a-container |
| 30 | + # docker run -it --rm --name fipsy docker.elastic.co/wolfi/python-fips:3.12 |
| 31 | + container: |
| 32 | + image: docker.elastic.co/wolfi/python-fips:3.12-dev |
| 33 | + options: --user root |
| 34 | + credentials: |
| 35 | + username: ${{ secrets.ELASTIC_DOCKER_USERNAME }} |
| 36 | + password: ${{ secrets.ELASTIC_DOCKER_PASSWORD }} |
| 37 | + timeout-minutes: 30 |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + max-parallel: 10 |
| 41 | + matrix: ${{ fromJSON(needs.create-matrix.outputs.matrix) }} |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + - name: check that python has fips mode enabled |
| 45 | + run: | |
| 46 | + python3 -c 'import _hashlib; assert _hashlib.get_fips_mode() == 1' |
| 47 | + - name: install run_tests.sh requirements |
| 48 | + run: apk add netcat-openbsd tzdata |
| 49 | + - name: Run tests |
| 50 | + run: ./tests/scripts/run_tests.sh |
| 51 | + env: |
| 52 | + FRAMEWORK: ${{ matrix.framework }} |
| 53 | + |
| 54 | + notify-on-failure: |
| 55 | + if: always() |
| 56 | + runs-on: ubuntu-24.04 |
| 57 | + needs: test-fips |
| 58 | + steps: |
| 59 | + - id: check |
| 60 | + uses: elastic/oblt-actions/check-dependent-jobs@v1 |
| 61 | + with: |
| 62 | + jobs: ${{ toJSON(needs) }} |
| 63 | + - name: Notify in Slack |
| 64 | + if: steps.check.outputs.status == 'failure' |
| 65 | + uses: elastic/oblt-actions/slack/notify-result@v1 |
| 66 | + with: |
| 67 | + bot-token: ${{ secrets.SLACK_BOT_TOKEN }} |
| 68 | + status: ${{ steps.check.outputs.status }} |
| 69 | + channel-id: "#apm-agent-python" |
0 commit comments