From 70df8fb88bd6b4db8d53a12731181ecb9f71efb0 Mon Sep 17 00:00:00 2001 From: Cyril Lay Date: Fri, 10 Jan 2025 10:08:26 +0100 Subject: [PATCH 1/2] Add codeQL analysis in CI/CD --- .github/workflows/build_and_deploy.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 99382782..e6172469 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -6,8 +6,32 @@ on: - main jobs: + analyze: + name: CodeQL Analysis + runs-on: ubuntu-latest + permissions: + security-events: write + actions: read + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: python + queries: security-and-quality + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:python" + build-and-push: name: Build and push from ${{ github.ref_name }}/${{ github.sha }} + needs: analyze runs-on: ubuntu-latest env: APP_IMAGE_NAME: ghcr.io/${{ github.repository }}/app From f8d03f7cd25ece34e6edee1f0df03681bec50246 Mon Sep 17 00:00:00 2001 From: Cyril Lay Date: Fri, 10 Jan 2025 10:44:03 +0100 Subject: [PATCH 2/2] Make the analysis happen for every PR against main --- .github/workflows/build_and_deploy.yml | 24 ------------------- .github/workflows/codeql_analysis.yml | 33 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/codeql_analysis.yml diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index e6172469..99382782 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -6,32 +6,8 @@ on: - main jobs: - analyze: - name: CodeQL Analysis - runs-on: ubuntu-latest - permissions: - security-events: write - actions: read - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: python - queries: security-and-quality - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:python" - build-and-push: name: Build and push from ${{ github.ref_name }}/${{ github.sha }} - needs: analyze runs-on: ubuntu-latest env: APP_IMAGE_NAME: ghcr.io/${{ github.repository }}/app diff --git a/.github/workflows/codeql_analysis.yml b/.github/workflows/codeql_analysis.yml new file mode 100644 index 00000000..968482cd --- /dev/null +++ b/.github/workflows/codeql_analysis.yml @@ -0,0 +1,33 @@ +name: CodeQL Analysis + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + analyze: + name: CodeQL Analysis + runs-on: ubuntu-latest + permissions: + security-events: write + actions: read + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: python + queries: security-and-quality + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:python" \ No newline at end of file