Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 44 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ on:
push:
branches: [ "main", "release*" ]
tags: [ "*" ]
pull_request:
pull_request_target:
branches: [ "main", "release*" ]
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to test (optional)'
required: false
type: string

env:
GO_VERSION: 1.24
Expand All @@ -20,12 +26,19 @@ jobs:
build-operator:
name: Build-operator
runs-on: ubuntu-24.04
# Use protected environment for security - requires manual approval for forked PRs
environment:
name: "secure-build"
permissions:
contents: read
packages: write
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
# For pull_request_target, checkout the PR head
# For workflow_dispatch, checkout specified PR or current ref
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || (github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.ref }}

- name: Install Go
uses: actions/setup-go@v5
Expand All @@ -49,12 +62,16 @@ jobs:
build-bundle:
name: Build-bundle-image
runs-on: ubuntu-24.04
environment:
name: "secure-build"
permissions:
contents: read
packages: write
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || (github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.ref }}

- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
Expand All @@ -81,13 +98,17 @@ jobs:
build-fbc:
name: Build-fbc
runs-on: ubuntu-24.04
environment:
name: "secure-build"
permissions:
contents: read
packages: write
needs: build-bundle
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || (github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.ref }}

- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
Expand Down Expand Up @@ -179,6 +200,8 @@ jobs:
test-kind:
name: Test kind deployment
runs-on: ubuntu-24.04
environment:
name: "secure-build"
permissions:
contents: read
packages: read
Expand All @@ -188,6 +211,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || (github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.ref }}

- name: Install Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -269,6 +294,8 @@ jobs:
test-upgrade:
name: Test upgrade operator
runs-on: ubuntu-24.04
environment:
name: "secure-build"
permissions:
contents: read
packages: read
Expand All @@ -279,6 +306,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || (github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.ref }}

- name: Install Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -352,6 +381,8 @@ jobs:
test-ha-install:
name: Test with High Availability
runs-on: ubuntu-24.04
environment:
name: "secure-build"
permissions:
contents: read
packages: read
Expand All @@ -360,6 +391,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || (github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.ref }}

- name: Install Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -443,6 +476,8 @@ jobs:
test-custom-install:
name: Test with custom operator installation
runs-on: ubuntu-24.04
environment:
name: "secure-build"
permissions:
contents: read
packages: read
Expand All @@ -451,6 +486,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || (github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.ref }}

- name: Install Go
uses: actions/setup-go@v5
Expand All @@ -466,7 +503,7 @@ jobs:
auth_file_path: /tmp/config.json

- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
Expand Down Expand Up @@ -519,6 +556,8 @@ jobs:
test-e2e:
name: Execute securesign/sigstore-e2e
runs-on: ubuntu-24.04
environment:
name: "secure-build"
permissions:
contents: read
packages: read
Expand All @@ -529,6 +568,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || (github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.ref }}
- name: Checkout test source repository
uses: actions/checkout@v4
with:
Expand All @@ -549,7 +590,7 @@ jobs:
auth_file_path: /tmp/config.json

- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
uses: redhat-actions/podman-login@v1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR Validation

on:
pull_request:
branches: [ "main", "release*" ]

env:
GO_VERSION: 1.24

jobs:
validate-pr:
name: Basic PR Validation
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Run unit tests
run: make test

- name: Generate and validate manifests
run: |
make manifests generate fmt vet

- name: Check if generated files are up to date
run: |
if ! git diff --exit-code; then
echo "❌ Generated files are not up to date"
echo "Please run 'make manifests generate fmt' and commit the changes"
git diff
exit 1
else
echo "✅ Generated files are up to date"
fi

Loading