Skip to content

Commit

Permalink
Migrate fork to DG org
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwrona committed Feb 3, 2025
1 parent 413dc09 commit 4039bc0
Show file tree
Hide file tree
Showing 43 changed files with 160 additions and 864 deletions.
178 changes: 0 additions & 178 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,181 +100,3 @@ jobs:
uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
itest-trivy-operator:
name: Run integration tests
needs:
- operator-envtest
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install tools
uses: aquaproj/[email protected]
with:
aqua_version: v1.25.0

- name: Setup Kubernetes cluster (KIND)
uses: engineerd/[email protected]
with:
version: ${{ env.KIND_VERSION }}
image: ${{ env.KIND_IMAGE }}

- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl wait --for=condition=Ready nodes --all --timeout=300s
kubectl describe node
- name: Run integration tests
run: |
kubectl create -k deploy/static
mage test:integration
env:
KUBECONFIG: /home/runner/.kube/config
OPERATOR_NAMESPACE: trivy-system
OPERATOR_TARGET_NAMESPACES: default

- name: Upload code coverage
uses: codecov/codecov-action@v5
with:
files: ./itest/trivy-operator/coverage.txt

e2e-testing:
name: Run end to end testing
needs:
- itest-trivy-operator
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Release snapshot
uses: goreleaser/goreleaser-action@v6
with:
version: v2.4.8
args: release -f=goreleaser-e2e.yaml --snapshot --skip=publish --clean
- name: Install kind and create cluster
run: >
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION
}}/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind create cluster
curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl wait --for=condition=Ready nodes --all --timeout=300s
kubectl describe node
- name: Load operator image to cluster
run: >
docker tag mirror.gcr.io/aquasec/trivy-operator:${{ github.sha }}-amd64
mirror.gcr.io/aquasec/trivy-operator:e2e
docker save -o trivy-operator.tar mirror.gcr.io/aquasec/trivy-operator:e2e
kind load image-archive trivy-operator.tar
- name: Init E2E tests (Install kuttl & helm)
run: >
mkdir -p ./bin
curl -L https://github.com/kudobuilder/kuttl/releases/download/v0.15.0/kubectl-kuttl_0.15.0_linux_x86_64 -o ./bin/kuttl;
chmod +x ./bin/kuttl;
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: Image scan mode producing vulnerability,misconfig and exposedsecrets
reports tests
run: >
kubectl create namespace e2e-test
./bin/kuttl test --start-kind=false --namespace e2e-test --config tests/e2e/config/image-mode.yaml
./tests/resources-cleanup.sh > /dev/null 2>&1
- name: Files System scan mode producing vulnerability,misconfig and exposedsecrets reports tests
run: |
kubectl create namespace e2e-test
./bin/kuttl test --start-kind=false --namespace e2e-test --config tests/e2e/config/fs-mode.yaml
./tests/resources-cleanup.sh > /dev/null 2>&1
- name: Client/server mode producing vulnerability,misconfig and exposedsecrets
reports tests
run: >
kubectl create namespace e2e-test
./bin/kuttl test --start-kind=false --namespace e2e-test --config tests/e2e/config/client-server.yaml
./tests/resources-cleanup.sh > /dev/null 2>&1
- name: Standalon mode with Sbom scanning
reports tests
run: >
kubectl create namespace e2e-test
./bin/kuttl test --start-kind=false --namespace e2e-test --config tests/e2e/config/sbom-standalone.yaml
./tests/resources-cleanup.sh > /dev/null 2>&1
- name: Client/Server with Sbom scanning
reports tests
run: >
kubectl create namespace e2e-test
./bin/kuttl test --start-kind=false --namespace e2e-test --config tests/e2e/config/client-server-sbom.yaml
./tests/resources-cleanup.sh > /dev/null 2>&1
- name: file system with Sbom scanning
reports tests
run: >
kubectl create namespace e2e-test
./bin/kuttl test --start-kind=false --namespace e2e-test --config tests/e2e/config/fs-sbom.yaml
./tests/resources-cleanup.sh > /dev/null 2>&1
- name: Node scan producing cluster infraassessment report
run: >
kubectl create namespace e2e-test
./bin/kuttl test --start-kind=false --namespace e2e-test --config tests/e2e/config/node-collector.yaml
./tests/resources-cleanup.sh > /dev/null 2>&1
- name: Cluster vulnerabilities report
run: >
./bin/kuttl test --start-kind=false --config tests/e2e/config/cluster-scan.yaml
- name: The job has failed - print the logs
if: ${{ failure() }}
run: >
kubectl logs -n trivy-system deployment/trivy-operator
- name: Delete kind cluster
run: |
kind delete cluster
92 changes: 0 additions & 92 deletions .github/workflows/chart-testing.yaml
Original file line number Diff line number Diff line change
@@ -1,92 +0,0 @@
---
name: Helm
on:
push:
branches:
- main
paths:
- deploy/**
pull_request:
branches:
- main
paths:
- deploy/**
env:
KIND_VERSION: v0.17.0
KIND_IMAGE: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
GO_VERSION: '1.23'
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
chart-testing:
name: Run chart testing
runs-on: ubuntu-22.04
env:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Release snapshot
uses: goreleaser/goreleaser-action@v6
with:
version: v2.4.8
args: release -f=goreleaser-e2e.yaml --snapshot --skip=publish --clean

- name: Install kind and create cluster
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind create cluster
curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl wait --for=condition=Ready nodes --all --timeout=300s
kubectl describe node
- name: Install helm and yq
run: >
curl -fsSL -o get_helm.sh
https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
- name: update appVersion
uses: mikefarah/yq@master
with:
cmd: yq -i '.appVersion = "ct"' ./deploy/helm/Chart.yaml
- name: Load operator image to cluster
run: >
docker tag mirror.gcr.io/aquasec/trivy-operator:${{ github.sha }}-amd64
mirror.gcr.io/aquasec/trivy-operator:ct
docker save -o trivy-operator.tar mirror.gcr.io/aquasec/trivy-operator:ct
kind load image-archive trivy-operator.tar
- name: Set up python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: 3.7
- name: Setup chart-testing
id: lint
uses: helm/[email protected]
- name: Install yamllint
run: pip install yamllint
- name: Run chart-testing
run: ct lint-and-install --validate-maintainers=false --charts deploy/helm
- name: Delete kind cluster
run: |
kind delete cluster
117 changes: 0 additions & 117 deletions .github/workflows/private-registries.yaml
Original file line number Diff line number Diff line change
@@ -1,117 +0,0 @@
---
name: Private Registries E2E
on:
push:
branches:
- main
paths-ignore:
- .github/ISSUE_TEMPLATE/*.md
- "*.md"
- docs/**
- mkdocs.yml
- LICENSE
- NOTICE
pull_request_target:
branches:
- main
paths-ignore:
- .github/ISSUE_TEMPLATE/*.md
- "*.md"
- docs/**
- mkdocs.yml
- LICENSE
- NOTICE
env:
KIND_VERSION: v0.17.0
KIND_IMAGE: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
GO_VERSION: '1.23'
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
private-registry-testing:
name: private registry testing
runs-on: ubuntu-22.04
env:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Release snapshot
uses: goreleaser/goreleaser-action@v6
with:
version: v2.4.8
args: release -f=goreleaser-e2e.yaml --snapshot --skip=publish --clean
- name: Install kind and create cluster
run: >
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION
}}/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind create cluster
curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl wait --for=condition=Ready nodes --all --timeout=300s
kubectl describe node
kubectl create namespace private
kubectl create secret docker-registry artcred \
--docker-server=https://index.docker.io/v1 \
--docker-username=${{ secrets.DOCKERHUB_USER }} \
--docker-password=${{ secrets.DOCKERHUB_TOKEN }} \
[email protected] \
-n private
- name: Load operator image to cluster
run: >
docker tag mirror.gcr.io/aquasec/trivy-operator:${{ github.sha }}-amd64
mirror.gcr.io/aquasec/trivy-operator:e2e
docker save -o trivy-operator.tar mirror.gcr.io/aquasec/trivy-operator:e2e
kind load image-archive trivy-operator.tar
- name: Init E2E tests (Install kuttl & helm)
run: >
mkdir -p ./bin
curl -L https://github.com/kudobuilder/kuttl/releases/download/v0.15.0/kubectl-kuttl_0.15.0_linux_x86_64 -o ./bin/kuttl;
chmod +x ./bin/kuttl;
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: image private registries via pod image pull secret tests
run: >
./bin/kuttl test --start-kind=false --config tests/e2e/config/image-private-registries.yaml
./tests/resources-cleanup-private.sh > /dev/null 2>&1
- name: image private registries via service account image pull secret tests
run: >
./bin/kuttl test --start-kind=false --config tests/e2e/config/image-private-registries-sa.yaml
./tests/resources-cleanup-private.sh > /dev/null 2>&1
- name: Delete kind cluster
run: |
kind delete cluster
Loading

0 comments on commit 4039bc0

Please sign in to comment.