From c901934b5e5ee6c7219b4c16f1c4a96b80bf39f9 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 11 Oct 2023 08:49:02 +0200 Subject: [PATCH] Add CI setup --- .github/workflows/build_docker.yml | 23 ++++++++++++++ .github/workflows/ci.yaml | 51 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/build_docker.yml create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml new file mode 100644 index 000000000..5ba7fdb5b --- /dev/null +++ b/.github/workflows/build_docker.yml @@ -0,0 +1,23 @@ +name: Build and publish a 🛢️ container + +on: + push: + paths-ignore: + - '.github/**' + branches: + - 'main' + tags: + - '*' + +jobs: + build-and-push-container: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: voxpupuli/gha-build-and-publish-a-container@v2 + with: + registry_password: ${{ secrets.GITHUB_TOKEN }} + build_arch: linux/amd64,linux/arm64 + buildfile: puppetserver/Dockerfile diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..e6d380f26 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,51 @@ +--- + +on: + pull_request: {} + push: + branches: + - main + +name: CI + +jobs: + build_docker_image: + name: 'Built test Docker image' + runs-on: ubuntu-latest + defaults: + run: + working-directory: 'puppetserver' + permissions: + actions: read + contents: read + security-events: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + context: puppetdb + tags: 'ci/puppdb:${{ github.sha }}' + push: false + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + image-ref: 'ci/puppdb:${{ github.sha }}' + format: 'sarif' + output: 'trivy-results.sarif' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif' + + tests: + needs: + - build_docker_image + runs-on: ubuntu-latest + name: Test suite + steps: + - run: echo Test suite completed