Add support for appArmorProfile in security context if supported #6795
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI-FIPS | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| pull_request: | |
| branches: | |
| - "*" | |
| merge_group: | |
| types: [checks_requested] | |
| permissions: | |
| contents: read | |
| env: | |
| IMAGE_REGISTRY: ghcr.io | |
| IMAGE_NAME: dynatrace/dynatrace-operator | |
| jobs: | |
| detect-changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| go_changed: ${{ steps.go-files.outputs.any_changed == 'true' && 'true' || '' }} | |
| docker_changed: ${{ steps.dockerfile.outputs.any_changed == 'true' && 'true' || '' }} | |
| ci_changed: ${{ steps.ci.outputs.any_changed == 'true' && 'true' || '' }} | |
| is_protected_branch: ${{ steps.is-protected-branch.outputs.is_protected_branch == 'true' && 'true' || '' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: ${{ github.event_name == 'merge_group' && 0 || 2 }} | |
| ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }} | |
| - name: Check if it is a protected branch | |
| id: is-protected-branch | |
| run: | | |
| if [[ "$GITHUB_REF" == "refs/heads/main" || "$GITHUB_REF" == refs/heads/release-* || "$GITHUB_EVENT_NAME" == "merge_group" ]]; then | |
| echo "is_protected_branch=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_protected_branch=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Detect CI file changes | |
| uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1 | |
| id: ci | |
| with: | |
| files: | | |
| .github/workflows/** | |
| .github/actions/** | |
| base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }} | |
| - name: Detect Go file changes | |
| uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1 | |
| id: go-files | |
| with: | |
| files: | | |
| **/*.go | |
| go.mod | |
| base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }} | |
| - name: Detect fips.Dockerfile changes | |
| uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1 | |
| id: dockerfile | |
| with: | |
| files: | | |
| fips.Dockerfile | |
| base_sha: ${{ github.event.pull_request.base.sha || github.event.merge_group.head_sha || github.event.before }} | |
| - name: List Changed Files | |
| run: | | |
| echo "CI changed: ${CHANGED_CI_FILES}" | |
| echo "Go changed: ${CHANGED_GO_FILES}" | |
| echo "Dockerfile changed: ${CHANGED_DOCKERFILE}" | |
| env: | |
| CHANGED_CI_FILES: ${{ steps.ci.outputs.all_changed_files }} | |
| CHANGED_GO_FILES: ${{ steps.go-files.outputs.all_changed_files }} | |
| CHANGED_DOCKERFILE: ${{ steps.dockerfile.outputs.all_changed_files }} | |
| prepare: | |
| name: Prepare properties | |
| needs: [detect-changes] | |
| if: needs.detect-changes.outputs.is_protected_branch || needs.detect-changes.outputs.go_changed || needs.detect-changes.outputs.docker_changed || needs.detect-changes.outputs.ci_changed | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Prepare build parameters | |
| id: prep | |
| run: | | |
| hack/build/ci/prepare-build-variables.sh | |
| outputs: | |
| labels: ${{ steps.prep.outputs.docker_image_labels }} | |
| version: ${{ steps.prep.outputs.docker_image_tag }} | |
| build-images: | |
| name: Build images | |
| needs: [detect-changes] | |
| if: needs.detect-changes.outputs.is_protected_branch || needs.detect-changes.outputs.go_changed || needs.detect-changes.outputs.docker_changed || needs.detect-changes.outputs.ci_changed | |
| strategy: | |
| matrix: | |
| platform: [linux/arm64, linux/amd64] | |
| include: | |
| - platform: linux/arm64 | |
| image-postfix: fips-arm64 | |
| runner: ubuntu-24.04-arm | |
| - platform: linux/amd64 | |
| image-postfix: fips-amd64 | |
| runner: ubuntu-latest | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Login to Registry | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ${{ env.IMAGE_REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build ${{ matrix.platform }} image | |
| uses: ./.github/actions/build-push-image | |
| with: | |
| platforms: ${{ matrix.platform }} | |
| images: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }} | |
| suffix: ${{ matrix.image-postfix }} | |
| dockerfile: ./fips.Dockerfile | |
| index: | |
| name: Create image-index | |
| needs: [detect-changes, prepare, build-images] | |
| if: needs.detect-changes.outputs.is_protected_branch || needs.detect-changes.outputs.go_changed || needs.detect-changes.outputs.docker_changed || needs.detect-changes.outputs.ci_changed | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Login to Registry | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ${{ env.IMAGE_REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Manifests | |
| env: | |
| IMAGE: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }}-fips | |
| shell: bash | |
| run: | | |
| hack/build/ci/create-image-index.sh "${IMAGE}" |