forked from 5GSEC/nimbus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(CI): Run CI based on conditional changes
Signed-off-by: Anurag Rajawat <[email protected]>
- Loading branch information
Anurag Rajawat
committed
May 22, 2024
1 parent
b6dd9b6
commit 98d5e8f
Showing
8 changed files
with
104 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,10 @@ | |
# Copyright 2023 Authors of Nimbus | ||
|
||
name: Latest release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- "v*" | ||
create: | ||
branches: | ||
- "v*" | ||
|
||
permissions: read-all | ||
|
||
|
@@ -19,16 +14,38 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
files-changed: | ||
name: Detect what files changed | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 3 | ||
outputs: | ||
nimbus: ${{ steps.filter.outputs.nimbus}} | ||
adapters: ${{ steps.filter.outputs.adapters }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dorny/[email protected] | ||
id: filter | ||
with: | ||
filters: | | ||
nimbus: | ||
- 'cmd/**' | ||
- 'internal/**' | ||
- 'pkg/processor/**' | ||
adapters: | ||
- 'pkg/adapter/**' | ||
release-nimbus-image: | ||
if: github.repository == '5GSEC/nimbus' | ||
needs: files-changed | ||
if: ${{ github.repository == '5GSEC/nimbus' && needs.files-changed.outputs.nimbus == 'true' }} | ||
name: Build and push nimbus image | ||
uses: ./.github/workflows/release-image.yaml | ||
with: | ||
WORKING_DIRECTORY: . | ||
secrets: inherit | ||
|
||
release-adapters-image: | ||
if: github.repository == '5GSEC/nimbus' | ||
needs: files-changed | ||
if: ${{ github.repository == '5GSEC/nimbus' && needs.files-changed.outputs.adapters == 'true' }} | ||
strategy: | ||
matrix: | ||
adapters: [ "nimbus-kubearmor", "nimbus-netpol", "nimbus-kyverno" ] | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,30 @@ on: | |
permissions: read-all | ||
|
||
jobs: | ||
files-changed: | ||
name: Detect what files changed | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 3 | ||
outputs: | ||
nimbus: ${{ steps.filter.outputs.nimbus}} | ||
adapters: ${{ steps.filter.outputs.adapters }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dorny/[email protected] | ||
id: filter | ||
with: | ||
filters: | | ||
nimbus: | ||
- 'api/**' | ||
- 'cmd/**' | ||
- 'internal/**' | ||
- 'pkg/processor/**' | ||
adapters: | ||
- 'pkg/adapter/**' | ||
license: | ||
needs: files-changed | ||
if: ${{ needs.files-changed.outputs.nimbus == 'true' || needs.files-changed.outputs.adapters == 'true' }} | ||
name: License | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
|
@@ -27,6 +50,8 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
static-checks: | ||
needs: files-changed | ||
if: ${{ needs.files-changed.outputs.nimbus == 'true' || needs.files-changed.outputs.adapters == 'true' }} | ||
name: Static checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -49,6 +74,8 @@ jobs: | |
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778 | ||
|
||
go-sec: | ||
needs: files-changed | ||
if: ${{ needs.files-changed.outputs.nimbus == 'true' || needs.files-changed.outputs.adapters == 'true' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
security-events: write | ||
|
@@ -70,6 +97,8 @@ jobs: | |
sarif_file: results.sarif | ||
|
||
build-nimbus-image: | ||
needs: files-changed | ||
if: ${{ needs.files-changed.outputs.nimbus == 'true' }} | ||
name: Build Nimbus Operator image | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
|
@@ -81,6 +110,8 @@ jobs: | |
run: make docker-build | ||
|
||
build-adapters-image: | ||
needs: files-changed | ||
if: ${{ needs.files-changed.outputs.adapters == 'true' }} | ||
strategy: | ||
matrix: | ||
adapters: [ "nimbus-kubearmor", "nimbus-netpol", "nimbus-kyverno" ] | ||
|
@@ -95,7 +126,9 @@ jobs: | |
working-directory: ./pkg/adapter/${{ matrix.adapters }} | ||
run: make docker-build | ||
|
||
chainsaw-integration-tests: | ||
integration-tests: | ||
needs: files-changed | ||
if: ${{ needs.files-changed.outputs.nimbus == 'true' }} | ||
name: Integration-Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -130,7 +163,9 @@ jobs: | |
- name: Run Tests | ||
run: make integration-test | ||
|
||
chainsaw-e2e-tests: | ||
e2e-tests: | ||
needs: files-changed | ||
if: ${{ needs.files-changed.outputs.nimbus == 'true' || needs.files-changed.outputs.adapters == 'true' }} | ||
name: E2E-Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -179,7 +214,6 @@ jobs: | |
run: | | ||
kubectl create -f https://raw.githubusercontent.com/kyverno/kyverno/main/config/crds/kyverno/kyverno.io_clusterpolicies.yaml | ||
kubectl create -f https://raw.githubusercontent.com/kyverno/kyverno/main/config/crds/kyverno/kyverno.io_policies.yaml | ||
- name: Install Nimbus | ||
run: | | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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