From a367792b09988a41287831e4950bf8966578b2ef Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 13:53:00 +0200 Subject: [PATCH 01/21] feat: Add permissions description to add-milestone-to-pull-requests workflow --- .github/workflows/add-milestone-to-pull-requests.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/add-milestone-to-pull-requests.yaml b/.github/workflows/add-milestone-to-pull-requests.yaml index 382bdc69a0e..8fc02d252f1 100644 --- a/.github/workflows/add-milestone-to-pull-requests.yaml +++ b/.github/workflows/add-milestone-to-pull-requests.yaml @@ -5,11 +5,12 @@ on: branches: - master - release/v* - jobs: add_milestone_to_merged: - if: github.event.pull_request.merged && github.event.pull_request.milestone == null name: Add milestone to merged pull requests + permissions: + issues: write # Required to update the milestone of a pull request + if: github.event.pull_request.merged && github.event.pull_request.milestone == null runs-on: ubuntu-latest steps: - name: Add milestone to merged pull requests From efc47068283b303f06c30a55b910a67af43060a2 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 13:53:25 +0200 Subject: [PATCH 02/21] feat: Add permissions description to add-release-to-cloudfoundry workflow --- .github/workflows/add-release-to-cloudfoundry.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/add-release-to-cloudfoundry.yaml b/.github/workflows/add-release-to-cloudfoundry.yaml index bd8a6e099e0..eedfe1dbd8a 100644 --- a/.github/workflows/add-release-to-cloudfoundry.yaml +++ b/.github/workflows/add-release-to-cloudfoundry.yaml @@ -5,6 +5,8 @@ on: - released jobs: update-releases: + permissions: + contents: write # Required to commit and push changes to the repository runs-on: ubuntu-latest steps: - name: Checkout "cloudfoundry" branch From 950805ce2e76c91baa1cd2eb6f06be11c9321272 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 13:54:07 +0200 Subject: [PATCH 03/21] =?UTF-8?q?feat:=E2=80=AFUpdate=20and=20pin=20action?= =?UTF-8?q?s=20version=20of=20ci-static-analysis=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-static-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-static-analysis.yml b/.github/workflows/ci-static-analysis.yml index f0e86449fbb..9fab8fd12a5 100644 --- a/.github/workflows/ci-static-analysis.yml +++ b/.github/workflows/ci-static-analysis.yml @@ -11,10 +11,10 @@ jobs: name: Datadog Static Analyzer steps: - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 - name: Check code meets quality standards id: datadog-static-analysis - uses: DataDog/datadog-static-analyzer-github-action@v1 + uses: DataDog/datadog-static-analyzer-github-action@c74aff158c8cc1c3e285660713bcaa5f9c6d696e # v1 with: dd_app_key: ${{ secrets.DD_APP_KEY }} dd_api_key: ${{ secrets.DD_API_KEY }} From c02f8289ccefc60778c0293104428df91fcfa152 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 14:00:32 +0200 Subject: [PATCH 04/21] =?UTF-8?q?feat:=E2=80=AFRename=20ci-static-analysis?= =?UTF-8?q?=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/README.md | 4 ++-- ...s.yml => analyze-changes-with-datadog-static-analyzer.yml} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{ci-static-analysis.yml => analyze-changes-with-datadog-static-analyzer.yml} (93%) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index da73173118b..54dfd37e458 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -76,9 +76,9 @@ _Recovery:_ Check at the milestone for the related issues and update them manual ## Code Quality and Security -### ci-static-analysis [πŸ”—](ci-static-analysis.yml) +### analyze-changes-with-datadog-static-analyzer [πŸ”—](analyze-changes-with-datadog-static-analyzer.yml) -_Trigger:_ When pushing commits to `master` or any pull request to `master`. +_Trigger:_ When pushing commits to `master` or any pull request targeting `master`. _Actions:_ Run [DataDog Static Analysis](https://docs.datadoghq.com/static_analysis/) and upload result to DataDog Code Analysis. diff --git a/.github/workflows/ci-static-analysis.yml b/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml similarity index 93% rename from .github/workflows/ci-static-analysis.yml rename to .github/workflows/analyze-changes-with-datadog-static-analyzer.yml index 9fab8fd12a5..10769773237 100644 --- a/.github/workflows/ci-static-analysis.yml +++ b/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml @@ -1,4 +1,4 @@ -name: "DataDog CI Static Analysis" +name: "Analyze changes with DataDog Static Analyser" on: push: branches: [ master ] From f6ad7731493fdef8b8d4b30d3a45f5e77ea5cead Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 14:07:07 +0200 Subject: [PATCH 05/21] =?UTF-8?q?feat:=E2=80=AFMake=20sure=20submodules=20?= =?UTF-8?q?are=20checkout=20before=20analysis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../analyze-changes-with-datadog-static-analyzer.yml | 2 ++ .github/workflows/codeql-analysis.yml | 4 +++- .github/workflows/trivy-analysis.yml | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml b/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml index 10769773237..f4886676b4f 100644 --- a/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml +++ b/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 + with: + submodules: 'recursive' - name: Check code meets quality standards id: datadog-static-analysis uses: DataDog/datadog-static-analyzer-github-action@c74aff158c8cc1c3e285660713bcaa5f9c6d696e # v1 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dcfc2df8f60..996001d3913 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,7 +20,9 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 + with: + submodules: 'recursive' # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/trivy-analysis.yml b/.github/workflows/trivy-analysis.yml index c14ccd9b607..0f23120de80 100644 --- a/.github/workflows/trivy-analysis.yml +++ b/.github/workflows/trivy-analysis.yml @@ -21,7 +21,9 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0 + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 + with: + submodules: 'recursive' - name: Remove old artifacts run: | From 2704b23975d525f238d37d9f734b02e6133fa4a1 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 14:32:37 +0200 Subject: [PATCH 06/21] =?UTF-8?q?feat:=E2=80=AFUpgrade=20codeql-analysis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove to analize-changes-with-github-codeql Remove sarif upload as workflow run artifact Upgrade GitHub actions and datadog-ci CLI --- .github/workflows/README.md | 12 ++-- .../analyze-changes-with-github-codeql.yml | 45 +++++++++++++++ .github/workflows/codeql-analysis.yml | 56 ------------------- 3 files changed, 51 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/analyze-changes-with-github-codeql.yml delete mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 54dfd37e458..81dfd4e0f7a 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -82,17 +82,17 @@ _Trigger:_ When pushing commits to `master` or any pull request targeting `maste _Actions:_ Run [DataDog Static Analysis](https://docs.datadoghq.com/static_analysis/) and upload result to DataDog Code Analysis. -### comment-on-submodule-update [πŸ”—](comment-on-submodule-update.yaml) +### analyze-changes-with-github-codeql [πŸ”—](analyze-changes-with-github-codeql.yml) -_Trigger:_ When creating a PR commits to `master` or a `release/*` branch with a Git Submodule update. +_Trigger:_ When pushing commits to `master`. -_Action:_ Notify the PR author through comments that about the Git Submodule update. +_Action:_ Run GitHub CodeQL action, upload result to GitHub security tab and DataDog Code Analysis. -### codeql-analysis [πŸ”—](codeql-analysis.yml) +### comment-on-submodule-update [πŸ”—](comment-on-submodule-update.yaml) -_Trigger:_ When pushing commits to `master`. +_Trigger:_ When creating a PR commits to `master` or a `release/*` branch with a Git Submodule update. -_Action:_ Run GitHub CodeQL action, upload result to GitHub security tab and DataDog Code Analysis. +_Action:_ Notify the PR author through comments that about the Git Submodule update. ### update-gradle-dependencies [πŸ”—](trivy-analysis.yml) diff --git a/.github/workflows/analyze-changes-with-github-codeql.yml b/.github/workflows/analyze-changes-with-github-codeql.yml new file mode 100644 index 00000000000..1ca9b127c41 --- /dev/null +++ b/.github/workflows/analyze-changes-with-github-codeql.yml @@ -0,0 +1,45 @@ +name: "Analyze changes with GitHub CodeQL" + +on: + push: + branches: [ master ] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write # Required to upload the results to the Security tab + + steps: + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 + with: + submodules: 'recursive' + - name: Initialize CodeQL + uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + with: + languages: 'java' + build-mode: 'manual' + - name: Build dd-trace-java for creating the CodeQL database + run: | + JAVA_HOME=$JAVA_HOME_8_X64 \ + JAVA_8_HOME=$JAVA_HOME_8_X64 \ + JAVA_11_HOME=$JAVA_HOME_11_X64 \ + JAVA_17_HOME=$JAVA_HOME_17_X64 \ + JAVA_21_HOME=$JAVA_HOME_21_X64 \ + ./gradlew clean :dd-java-agent:shadowJar \ + --build-cache --parallel --stacktrace --no-daemon --max-workers=8 + - name: Perform CodeQL Analysis and upload results to GitHub Security tab + uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + + - name: Upload results to Datadog CI Static Analysis + run: | + wget --no-verbose https://github.com/DataDog/datadog-ci/releases/download/v2.42.0/datadog-ci_linux-x64 -O datadog-ci + chmod +x datadog-ci + ./datadog-ci sarif upload /home/runner/work/dd-trace-java/results/java.sarif --service dd-trace-java --env ci + env: + DD_API_KEY: ${{ secrets.DD_API_KEY }} + DD_SITE: datad0g.com diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 996001d3913..00000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ master ] - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'java' ] - - steps: - - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 - with: - submodules: 'recursive' - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@1a927e9307bc11970b2c679922ebc4d03a5bd980 # 1.0.31 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - - name: Build dd-trace-java for creating the CodeQL database - run: JAVA_HOME=$JAVA_HOME_8_X64 JAVA_8_HOME=$JAVA_HOME_8_X64 JAVA_11_HOME=$JAVA_HOME_11_X64 JAVA_17_HOME=$JAVA_HOME_17_X64 JAVA_21_HOME=$JAVA_HOME_21_X64 ./gradlew clean :dd-java-agent:shadowJar --build-cache --parallel --stacktrace --no-daemon --max-workers=8 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@1a927e9307bc11970b2c679922ebc4d03a5bd980 # 1.0.31 - - - name: upload_artifact - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # 2.3.1 - with: - name: CodeQL Analysis Sarif - path: /home/runner/work/dd-trace-java/results/java.sarif - - - name: upload to DD CI Static Analysis - run: | - wget --no-verbose https://github.com/DataDog/datadog-ci/releases/download/v2.27.0/datadog-ci_linux-x64 -O datadog-ci - chmod +x datadog-ci - ./datadog-ci sarif upload /home/runner/work/dd-trace-java/results/java.sarif --service dd-trace-java --env ci - env: - DD_API_KEY: ${{ secrets.DD_API_KEY }} - DD_SITE: datad0g.com From b27de05e91b505efe3311300a807bd646ebdd410 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 15:04:42 +0200 Subject: [PATCH 07/21] =?UTF-8?q?feat:=E2=80=AFMerge=20all=20code=20scanne?= =?UTF-8?q?rs=20into=20a=20single=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/README.md | 21 +-- ...e-changes-with-datadog-static-analyzer.yml | 27 ---- .../analyze-changes-with-github-codeql.yml | 45 ------- .github/workflows/analyze-changes.yml | 123 ++++++++++++++++++ .github/workflows/trivy-analysis.yml | 61 --------- 5 files changed, 129 insertions(+), 148 deletions(-) delete mode 100644 .github/workflows/analyze-changes-with-datadog-static-analyzer.yml delete mode 100644 .github/workflows/analyze-changes-with-github-codeql.yml create mode 100644 .github/workflows/analyze-changes.yml delete mode 100644 .github/workflows/trivy-analysis.yml diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 81dfd4e0f7a..97274f8afd0 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -76,17 +76,14 @@ _Recovery:_ Check at the milestone for the related issues and update them manual ## Code Quality and Security -### analyze-changes-with-datadog-static-analyzer [πŸ”—](analyze-changes-with-datadog-static-analyzer.yml) +### analyze-changes [πŸ”—](analyze-changes-with-github-codeql.yml) _Trigger:_ When pushing commits to `master` or any pull request targeting `master`. -_Actions:_ Run [DataDog Static Analysis](https://docs.datadoghq.com/static_analysis/) and upload result to DataDog Code Analysis. - -### analyze-changes-with-github-codeql [πŸ”—](analyze-changes-with-github-codeql.yml) - -_Trigger:_ When pushing commits to `master`. - -_Action:_ Run GitHub CodeQL action, upload result to GitHub security tab and DataDog Code Analysis. +_Action:_ +* Run [DataDog Static Analysis](https://docs.datadoghq.com/static_analysis/) and upload result to DataDog Code Analysis, +* Run [GitHub CodeQL](https://codeql.github.com/) action, upload result to GitHub security tab and DataDog Code Analysis -- do not apply to pull request, only when pushing to `master`, +* Run [Trivy security scanner](https://github.com/aquasecurity/trivy) on built artifacts and upload result to GitHub security tab. ### comment-on-submodule-update [πŸ”—](comment-on-submodule-update.yaml) @@ -94,7 +91,7 @@ _Trigger:_ When creating a PR commits to `master` or a `release/*` branch with a _Action:_ Notify the PR author through comments that about the Git Submodule update. -### update-gradle-dependencies [πŸ”—](trivy-analysis.yml) +### update-gradle-dependencies [πŸ”—](update-gradle-dependencies.yml) _Trigger:_ Every week or manually. @@ -102,12 +99,6 @@ _Action:_ Create a PR updating the Grade dependencies and their locking files. _Recovery:_ Manually trigger the action again. -### trivy-analysis [πŸ”—](trivy-analysis.yml) - -_Trigger:_ When pushing commits to `master` or any pull request to `master`. - -_Action:_ Run Trivy security scanner on built artifacts and upload result to GitHub security tab. - ### gradle-wrapper-validation [πŸ”—](gradle-wrapper-validation.yaml.disabled) **DISABLED** - GitHub provides a way to disable actions rather than changing their extensions. diff --git a/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml b/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml deleted file mode 100644 index f4886676b4f..00000000000 --- a/.github/workflows/analyze-changes-with-datadog-static-analyzer.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: "Analyze changes with DataDog Static Analyser" -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] -jobs: - check-quality: - runs-on: ubuntu-latest - name: Datadog Static Analyzer - steps: - - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 - with: - submodules: 'recursive' - - name: Check code meets quality standards - id: datadog-static-analysis - uses: DataDog/datadog-static-analyzer-github-action@c74aff158c8cc1c3e285660713bcaa5f9c6d696e # v1 - with: - dd_app_key: ${{ secrets.DD_APP_KEY }} - dd_api_key: ${{ secrets.DD_API_KEY }} - dd_site: datad0g.com - dd_service: "dd-trace-java" - dd_env: "ci" - cpu_count: 2 - enable_performance_statistics: false diff --git a/.github/workflows/analyze-changes-with-github-codeql.yml b/.github/workflows/analyze-changes-with-github-codeql.yml deleted file mode 100644 index 1ca9b127c41..00000000000 --- a/.github/workflows/analyze-changes-with-github-codeql.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: "Analyze changes with GitHub CodeQL" - -on: - push: - branches: [ master ] - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write # Required to upload the results to the Security tab - - steps: - - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 - with: - submodules: 'recursive' - - name: Initialize CodeQL - uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 - with: - languages: 'java' - build-mode: 'manual' - - name: Build dd-trace-java for creating the CodeQL database - run: | - JAVA_HOME=$JAVA_HOME_8_X64 \ - JAVA_8_HOME=$JAVA_HOME_8_X64 \ - JAVA_11_HOME=$JAVA_HOME_11_X64 \ - JAVA_17_HOME=$JAVA_HOME_17_X64 \ - JAVA_21_HOME=$JAVA_HOME_21_X64 \ - ./gradlew clean :dd-java-agent:shadowJar \ - --build-cache --parallel --stacktrace --no-daemon --max-workers=8 - - name: Perform CodeQL Analysis and upload results to GitHub Security tab - uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 - - - name: Upload results to Datadog CI Static Analysis - run: | - wget --no-verbose https://github.com/DataDog/datadog-ci/releases/download/v2.42.0/datadog-ci_linux-x64 -O datadog-ci - chmod +x datadog-ci - ./datadog-ci sarif upload /home/runner/work/dd-trace-java/results/java.sarif --service dd-trace-java --env ci - env: - DD_API_KEY: ${{ secrets.DD_API_KEY }} - DD_SITE: datad0g.com diff --git a/.github/workflows/analyze-changes.yml b/.github/workflows/analyze-changes.yml new file mode 100644 index 00000000000..2acd8ea5ed0 --- /dev/null +++ b/.github/workflows/analyze-changes.yml @@ -0,0 +1,123 @@ +name: Analyze changes + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + +jobs: + datadog-static-analyzer: + name: Analyze changes with DataDog Static Analyzer + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 + with: + submodules: 'recursive' + - name: Check code meets quality standards + id: datadog-static-analysis + uses: DataDog/datadog-static-analyzer-github-action@c74aff158c8cc1c3e285660713bcaa5f9c6d696e # v1 + with: + dd_app_key: ${{ secrets.DD_APP_KEY }} + dd_api_key: ${{ secrets.DD_API_KEY }} + dd_site: datad0g.com + dd_service: "dd-trace-java" + dd_env: "ci" + cpu_count: 2 + enable_performance_statistics: false + + codeql: + name: Analyze changes with GitHub CodeQL + # Don’t run on PR, only when pushing to master + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write # Required to upload the results to the Security tab + + steps: + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 + with: + submodules: 'recursive' + - name: Initialize CodeQL + uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + with: + languages: 'java' + build-mode: 'manual' + - name: Build dd-trace-java for creating the CodeQL database + run: | + JAVA_HOME=$JAVA_HOME_8_X64 \ + JAVA_8_HOME=$JAVA_HOME_8_X64 \ + JAVA_11_HOME=$JAVA_HOME_11_X64 \ + JAVA_17_HOME=$JAVA_HOME_17_X64 \ + JAVA_21_HOME=$JAVA_HOME_21_X64 \ + ./gradlew clean :dd-java-agent:shadowJar \ + --build-cache --parallel --stacktrace --no-daemon --max-workers=8 + - name: Perform CodeQL Analysis and upload results to GitHub Security tab + uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + + - name: Upload results to Datadog CI Static Analysis + run: | + wget --no-verbose https://github.com/DataDog/datadog-ci/releases/download/v2.42.0/datadog-ci_linux-x64 -O datadog-ci + chmod +x datadog-ci + ./datadog-ci sarif upload /home/runner/work/dd-trace-java/results/java.sarif --service dd-trace-java --env ci + env: + DD_API_KEY: ${{ secrets.DD_API_KEY }} + DD_SITE: datad0g.com + + trivy: + name: Analyze changes with GitHub CodeQL + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write # Required to upload the results to the Security tab + + steps: + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 + with: + submodules: 'recursive' + + - name: Remove old artifacts + run: | + MVN_LOCAL_REPO=$(./mvnw help:evaluate -Dexpression=settings.localRepository -q -DforceStdout) + echo "MVN_LOCAL_REPO=${MVN_LOCAL_REPO}" >> "$GITHUB_ENV" + rm -rf "${MVN_LOCAL_REPO}/com/datadoghq" + + - name: Build and publish artifacts locally + run: | + GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2G -Xms2G'" \ + JAVA_HOME=$JAVA_HOME_8_X64 \ + JAVA_8_HOME=$JAVA_HOME_8_X64 \ + JAVA_11_HOME=$JAVA_HOME_11_X64 \ + JAVA_17_HOME=$JAVA_HOME_17_X64 \ + JAVA_21_HOME=$JAVA_HOME_21_X64 \ + ./gradlew clean publishToMavenLocal \ + --build-cache --parallel --stacktrace --no-daemon --max-workers=4 + + - name: Copy published artifacts + run: | + mkdir -p ./workspace/.trivy + cp -RP "${MVN_LOCAL_REPO}/com/datadoghq" ./workspace/.trivy/ + ls -laR "./workspace/.trivy" + + - name: Run Trivy security scanner + uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # v0.24.0 + with: + scan-type: rootfs + scan-ref: './workspace/.trivy/' + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL,HIGH' + limit-severities-for-sarif: true + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + if: always() + with: + sarif_file: 'trivy-results.sarif' diff --git a/.github/workflows/trivy-analysis.yml b/.github/workflows/trivy-analysis.yml deleted file mode 100644 index 0f23120de80..00000000000 --- a/.github/workflows/trivy-analysis.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: "Trivy Security Analysis" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - -permissions: - contents: read - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 - with: - submodules: 'recursive' - - - name: Remove old artifacts - run: | - MVN_LOCAL_REPO=$(./mvnw help:evaluate -Dexpression=settings.localRepository -q -DforceStdout) - echo "MVN_LOCAL_REPO=${MVN_LOCAL_REPO}" >> "$GITHUB_ENV" - rm -rf "${MVN_LOCAL_REPO}/com/datadoghq" - - - name: Build and publish artifacts locally - run: | - GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2G -Xms2G'" JAVA_HOME=$JAVA_HOME_8_X64 JAVA_8_HOME=$JAVA_HOME_8_X64 JAVA_11_HOME=$JAVA_HOME_11_X64 JAVA_17_HOME=$JAVA_HOME_17_X64 JAVA_21_HOME=$JAVA_HOME_21_X64 ./gradlew clean publishToMavenLocal --build-cache --parallel --stacktrace --no-daemon --max-workers=4 - - - name: Copy published artifacts - run: | - mkdir -p ./workspace/.trivy - cp -RP "${MVN_LOCAL_REPO}/com/datadoghq" ./workspace/.trivy/ - - - name: List copied artifacts - run: | - ls -laR "./workspace/.trivy" - - - name: Run Trivy security scanner - uses: aquasecurity/trivy-action@41f05d9ecffa2ed3f1580af306000f734b733e54 # v0.11.2 - with: - scan-type: rootfs - scan-ref: './workspace/.trivy/' - format: 'sarif' - output: 'trivy-results.sarif' - severity: 'CRITICAL,HIGH' - limit-severities-for-sarif: true - - - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@00e563ead9f72a8461b24876bee2d0c2e8bd2ee8 # 2.15 - if: always() - with: - sarif_file: 'trivy-results.sarif' From aa6724fd61036e8bffb4c0b6ced6cc543e30ba3a Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 15:06:54 +0200 Subject: [PATCH 08/21] =?UTF-8?q?feat:=E2=80=AFAdd=20permissions=20descrip?= =?UTF-8?q?tion=20for=20comment-on-submodule-update=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/comment-on-submodule-update.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/comment-on-submodule-update.yaml b/.github/workflows/comment-on-submodule-update.yaml index df60b2044b0..251f0da3e3e 100644 --- a/.github/workflows/comment-on-submodule-update.yaml +++ b/.github/workflows/comment-on-submodule-update.yaml @@ -10,6 +10,8 @@ on: jobs: comment_on_submodule_update: + permissions: + issues: write # Required to create a comment on the pull request runs-on: ubuntu-latest steps: From 38c2356c803d83899824c66245bba97fdb9363a9 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 15:11:54 +0200 Subject: [PATCH 09/21] =?UTF-8?q?feat:=E2=80=AFUpdate=20create-next-milest?= =?UTF-8?q?one-workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update GitHub actions version Add permissions description --- .github/workflows/create-next-milestone.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-next-milestone.yaml b/.github/workflows/create-next-milestone.yaml index 564d38e6e16..b444de77698 100644 --- a/.github/workflows/create-next-milestone.yaml +++ b/.github/workflows/create-next-milestone.yaml @@ -5,15 +5,17 @@ on: jobs: create_next_milestone: + permissions: + issues: write # Required to create a milestone runs-on: ubuntu-latest steps: - name: Get next minor version id: semvers - uses: WyriHaximus/github-action-next-semvers@33d116a4c239252582a60a1ba8dbba63ad493ffd # 1.1.0 + uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # 1.2.1 with: version: ${{ github.event.milestone.title }} - name: Create next milestone - uses: WyriHaximus/github-action-create-milestone@b86699ba7511fa3b61154ac8675d86b01938fc16 # 1.0.0 + uses: WyriHaximus/github-action-create-milestone@bb0276ee386c630b476fa3ca788457bf3daa7c2e # 1.1.1 with: title: ${{ steps.semvers.outputs.minor }} env: From 085cdc9655807541511c71f38d2cb2ebad6ccd7a Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 15:18:32 +0200 Subject: [PATCH 10/21] =?UTF-8?q?feat:=E2=80=AFAdd=20permissions=20descrip?= =?UTF-8?q?tion=20for=20draft-release-notes-on-tag=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/draft-release-notes-on-tag.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/draft-release-notes-on-tag.yaml b/.github/workflows/draft-release-notes-on-tag.yaml index 7b08eb63dce..a557b14c78e 100644 --- a/.github/workflows/draft-release-notes-on-tag.yaml +++ b/.github/workflows/draft-release-notes-on-tag.yaml @@ -6,6 +6,8 @@ on: jobs: draft_release_notes: name: Draft release notes + permissions: + contents: write # Required to create a release if: (github.event.ref_type == 'tag' && github.event.master_branch == 'master') || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: From 6880d89c524eccba571f8d02c9990d25172abbbe Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Thu, 29 Aug 2024 15:42:02 +0200 Subject: [PATCH 11/21] feat: Upload trivy results to Datadog --- .github/workflows/analyze-changes.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/analyze-changes.yml b/.github/workflows/analyze-changes.yml index 2acd8ea5ed0..6bc9778501c 100644 --- a/.github/workflows/analyze-changes.yml +++ b/.github/workflows/analyze-changes.yml @@ -121,3 +121,12 @@ jobs: if: always() with: sarif_file: 'trivy-results.sarif' + + - name: Upload results to Datadog CI Static Analysis + run: | + wget --no-verbose https://github.com/DataDog/datadog-ci/releases/download/v2.42.0/datadog-ci_linux-x64 -O datadog-ci + chmod +x datadog-ci + ./datadog-ci sarif upload trivy-results.sarif --service dd-trace-java --env ci + env: + DD_API_KEY: ${{ secrets.DD_API_KEY }} + DD_SITE: datad0g.com From ad0569eedafaf01a5abd66d272f2a993becb892b Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 08:26:44 +0200 Subject: [PATCH 12/21] feat: Upgradle lib-injection-prune-registry Rename to prune-github-container-registry Remove dd-lib-java-init-test-app cleanup as it is no more used --- .github/workflows/README.md | 18 ++++--- .../lib-injection-prune-registry.yaml | 48 ------------------- .../prune-github-container-registry.yaml | 27 +++++++++++ 3 files changed, 35 insertions(+), 58 deletions(-) delete mode 100644 .github/workflows/lib-injection-prune-registry.yaml create mode 100644 .github/workflows/prune-github-container-registry.yaml diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 97274f8afd0..da867659f20 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -74,6 +74,14 @@ _Action:_ _Recovery:_ Check at the milestone for the related issues and update them manually. +### prune-github-container-registry [πŸ”—](prune-github-container-registry.yaml) + +_Trigger:_ Every week or manually. + +_Action:_ Clean up old lib-injection OCI images from GitHub Container Registry. + +_Recovery:_ Manually trigger the action again. + ## Code Quality and Security ### analyze-changes [πŸ”—](analyze-changes-with-github-codeql.yml) @@ -104,13 +112,3 @@ _Recovery:_ Manually trigger the action again. **DISABLED** - GitHub provides a way to disable actions rather than changing their extensions. _Comment:_ To delete? - -## Lib Injection - -### lib-injection-prune-registry [πŸ”—](lib-injection-prune-registry.yaml) - -_Trigger:_ Every week or manually. - -_Action:_ Clean up old lib-injection Docker images from GHCR. - -_Recovery:_ Manually trigger the action again. diff --git a/.github/workflows/lib-injection-prune-registry.yaml b/.github/workflows/lib-injection-prune-registry.yaml deleted file mode 100644 index 72bc5d70a2b..00000000000 --- a/.github/workflows/lib-injection-prune-registry.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: Prune Lib Injection images -on: - schedule: - - cron: '15 3 * * *' - workflow_dispatch: - -jobs: - prune-init-images: - name: Prune dd-lib-java-init docker images - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Prune registry - uses: vlaurin/action-ghcr-prune@0a539594d122b915e71c59733a5b115bfaaf5d52 #v0.5.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - organization: Datadog - container: dd-trace-java/dd-lib-java-init - keep-younger-than: 7 # days - keep-last: 10 - keep-tags: | - latest_snapshot - prune-tags-regexes: | - ^[a-z0-9]{40}$ - prune-untagged: true - - prune-init-test-app-images: - name: Prune dd-lib-java-init-test-app docker images - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Prune registry - uses: vlaurin/action-ghcr-prune@0a539594d122b915e71c59733a5b115bfaaf5d52 #v0.5.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - organization: Datadog - container: dd-trace-java/dd-lib-java-init-test-app - keep-younger-than: 15 # days - keep-last: 5 - keep-tags: | - latest_snapshot - prune-tags-regexes: | - ^[a-z0-9]{40}$ - prune-untagged: true diff --git a/.github/workflows/prune-github-container-registry.yaml b/.github/workflows/prune-github-container-registry.yaml new file mode 100644 index 00000000000..a515d64f6a1 --- /dev/null +++ b/.github/workflows/prune-github-container-registry.yaml @@ -0,0 +1,27 @@ +name: Prune GitHub Container Registry +on: + schedule: + - cron: '15 3 * * *' + workflow_dispatch: + +jobs: + prune-init-images: + name: Prune dd-lib-java-init OCI images + runs-on: ubuntu-latest + permissions: + contents: read + packages: write # Required to delete images + steps: + - name: Prune registry + uses: vlaurin/action-ghcr-prune@0cf7d39f88546edd31965acba78cdcb0be14d641 #v0.6.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + organization: Datadog + container: dd-trace-java/dd-lib-java-init + keep-younger-than: 7 # days + keep-last: 10 + keep-tags: | + latest_snapshot + prune-tags-regexes: | + ^[a-z0-9]{40}$ + prune-untagged: true From 35f210d1ea3533a1e5a411d07e04b8d6d60161b5 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 08:30:08 +0200 Subject: [PATCH 13/21] feat: Add permissions descriptiof of update-download-releases workflow --- .github/workflows/update-download-releases.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-download-releases.yaml b/.github/workflows/update-download-releases.yaml index fbef50dd87a..cf9b2a11cb9 100644 --- a/.github/workflows/update-download-releases.yaml +++ b/.github/workflows/update-download-releases.yaml @@ -6,6 +6,8 @@ on: workflow_dispatch: jobs: update-releases: + permissions: + contents: write # Required to update releases content runs-on: ubuntu-latest steps: - name: Update download releases From 9590a7a8b15780367bc69c5acc92010d4f275823 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 08:32:38 +0200 Subject: [PATCH 14/21] feat: Update GitHub actions version --- .github/workflows/comment-on-submodule-update.yaml | 2 +- .github/workflows/draft-release-notes-on-tag.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/comment-on-submodule-update.yaml b/.github/workflows/comment-on-submodule-update.yaml index 251f0da3e3e..4983bf27dbe 100644 --- a/.github/workflows/comment-on-submodule-update.yaml +++ b/.github/workflows/comment-on-submodule-update.yaml @@ -16,7 +16,7 @@ jobs: steps: - name: Post comment on submodule update - uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # 6.3.3 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 7.0.1 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | diff --git a/.github/workflows/draft-release-notes-on-tag.yaml b/.github/workflows/draft-release-notes-on-tag.yaml index a557b14c78e..a0fe798be5f 100644 --- a/.github/workflows/draft-release-notes-on-tag.yaml +++ b/.github/workflows/draft-release-notes-on-tag.yaml @@ -13,7 +13,7 @@ jobs: steps: - name: Get milestone title id: milestoneTitle - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # 6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 7.0.1 with: result-encoding: string script: | From f6c64f53073e47778d8f60f30d31b4f518528703 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 08:34:47 +0200 Subject: [PATCH 15/21] chore: Clean up update-gradle-description permissions description --- .github/workflows/update-gradle-dependencies.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-gradle-dependencies.yaml b/.github/workflows/update-gradle-dependencies.yaml index 8e149c2e1e5..b0ec1bf6cc3 100644 --- a/.github/workflows/update-gradle-dependencies.yaml +++ b/.github/workflows/update-gradle-dependencies.yaml @@ -9,10 +9,8 @@ jobs: runs-on: ubuntu-latest name: Update Gradle dependencies permissions: - # Commit and push changes to a new branch - contents: write - # Create a pull request - pull-requests: write + contents: write # Required to commit and push changes to a new branch + pull-requests: write # Required to create a pull request steps: - name: Checkout repository uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # 4.1.6 From 2bc2b6a44e52ef41b2f42fa865a91535cc23eb6d Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 08:50:11 +0200 Subject: [PATCH 16/21] feat: Add permissions description of update-issues-on-release workflow --- .github/workflows/update-issues-on-release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-issues-on-release.yaml b/.github/workflows/update-issues-on-release.yaml index 2cf103ee62a..3c223d9056e 100644 --- a/.github/workflows/update-issues-on-release.yaml +++ b/.github/workflows/update-issues-on-release.yaml @@ -10,6 +10,8 @@ on: jobs: update_issues: + permissions: + issues: write # Required to update issues runs-on: ubuntu-latest steps: - name: Get milestone for release From c6fbd989c0cb1c82718b76aef385baba22ab717d Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 08:56:16 +0200 Subject: [PATCH 17/21] chore: Remove gradle-wrapper-validation workflow --- .github/workflows/README.md | 6 ------ .../workflows/gradle-wrapper-validation.yaml.disabled | 11 ----------- 2 files changed, 17 deletions(-) delete mode 100644 .github/workflows/gradle-wrapper-validation.yaml.disabled diff --git a/.github/workflows/README.md b/.github/workflows/README.md index da867659f20..1841c1a0491 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -106,9 +106,3 @@ _Trigger:_ Every week or manually. _Action:_ Create a PR updating the Grade dependencies and their locking files. _Recovery:_ Manually trigger the action again. - -### gradle-wrapper-validation [πŸ”—](gradle-wrapper-validation.yaml.disabled) - -**DISABLED** - GitHub provides a way to disable actions rather than changing their extensions. - -_Comment:_ To delete? diff --git a/.github/workflows/gradle-wrapper-validation.yaml.disabled b/.github/workflows/gradle-wrapper-validation.yaml.disabled deleted file mode 100644 index 52bf278293f..00000000000 --- a/.github/workflows/gradle-wrapper-validation.yaml.disabled +++ /dev/null @@ -1,11 +0,0 @@ -name: "Validate Gradle Wrapper" -on: [push, pull_request] - -jobs: - validation: - name: "Gradle wrapper validation" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4 - # When updating this, you need to ADD the new version to https://github.com/DataDog/dd-trace-java/settings/actions - - uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b # 1.0.4 From 3060028c0b5bd41cfbda45247cfb40a9872cb892 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 09:14:33 +0200 Subject: [PATCH 18/21] chore: Fix typo Fix file extension Fix formatting --- .github/workflows/README.md | 2 +- ...alyze-changes.yml => analyze-changes.yaml} | 0 .../prune-github-container-registry.yaml | 26 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) rename .github/workflows/{analyze-changes.yml => analyze-changes.yaml} (100%) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 1841c1a0491..c1346e3bd75 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -84,7 +84,7 @@ _Recovery:_ Manually trigger the action again. ## Code Quality and Security -### analyze-changes [πŸ”—](analyze-changes-with-github-codeql.yml) +### analyze-changes [πŸ”—](analyze-changes-with-github-codeql.yaml) _Trigger:_ When pushing commits to `master` or any pull request targeting `master`. diff --git a/.github/workflows/analyze-changes.yml b/.github/workflows/analyze-changes.yaml similarity index 100% rename from .github/workflows/analyze-changes.yml rename to .github/workflows/analyze-changes.yaml diff --git a/.github/workflows/prune-github-container-registry.yaml b/.github/workflows/prune-github-container-registry.yaml index a515d64f6a1..ceb56b4e49b 100644 --- a/.github/workflows/prune-github-container-registry.yaml +++ b/.github/workflows/prune-github-container-registry.yaml @@ -12,16 +12,16 @@ jobs: contents: read packages: write # Required to delete images steps: - - name: Prune registry - uses: vlaurin/action-ghcr-prune@0cf7d39f88546edd31965acba78cdcb0be14d641 #v0.6.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - organization: Datadog - container: dd-trace-java/dd-lib-java-init - keep-younger-than: 7 # days - keep-last: 10 - keep-tags: | - latest_snapshot - prune-tags-regexes: | - ^[a-z0-9]{40}$ - prune-untagged: true + - name: Prune registry + uses: vlaurin/action-ghcr-prune@0cf7d39f88546edd31965acba78cdcb0be14d641 #v0.6.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + organization: Datadog + container: dd-trace-java/dd-lib-java-init + keep-younger-than: 7 # days + keep-last: 10 + keep-tags: | + latest_snapshot + prune-tags-regexes: | + ^[a-z0-9]{40}$ + prune-untagged: true From 39c7700b99b541026ef55b0942213024fb83546c Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 09:14:50 +0200 Subject: [PATCH 19/21] feat: Add documentation about allowed actions --- .github/workflows/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index c1346e3bd75..250c1223b1f 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -106,3 +106,14 @@ _Trigger:_ Every week or manually. _Action:_ Create a PR updating the Grade dependencies and their locking files. _Recovery:_ Manually trigger the action again. + + +## Maintenance + +GitHub actions should be part of the [repository allowed actions to run](https://github.com/DataDog/dd-trace-java/settings/actions). +While GitHub owned actions are allowed by default, the other ones must be declared. + +Run the following script to get the list of actions to declare according the state of your working copy: +```bash +find .github/workflows -name "*.yaml" -exec awk '/uses:/{print $2 ","}' {} \; | grep -vE '^(actions|github)/' | sort | uniq +``` \ No newline at end of file From 2e561b69882327ff4ae75b64fb139024310d72d1 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 09:24:04 +0200 Subject: [PATCH 20/21] chore: Fix typo --- .github/workflows/README.md | 2 +- .github/workflows/analyze-changes.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 250c1223b1f..6f87d95f193 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -116,4 +116,4 @@ While GitHub owned actions are allowed by default, the other ones must be declar Run the following script to get the list of actions to declare according the state of your working copy: ```bash find .github/workflows -name "*.yaml" -exec awk '/uses:/{print $2 ","}' {} \; | grep -vE '^(actions|github)/' | sort | uniq -``` \ No newline at end of file +``` diff --git a/.github/workflows/analyze-changes.yaml b/.github/workflows/analyze-changes.yaml index 6bc9778501c..46da39849e3 100644 --- a/.github/workflows/analyze-changes.yaml +++ b/.github/workflows/analyze-changes.yaml @@ -70,7 +70,7 @@ jobs: DD_SITE: datad0g.com trivy: - name: Analyze changes with GitHub CodeQL + name: Analyze changes with Trivy runs-on: ubuntu-latest permissions: actions: read From d7cdda19dee5dfa322a7e6c3792e8d07affe4ab1 Mon Sep 17 00:00:00 2001 From: Bruce Bujon Date: Fri, 30 Aug 2024 09:52:28 +0200 Subject: [PATCH 21/21] feat: Improve and unify build command --- .github/workflows/analyze-changes.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/analyze-changes.yaml b/.github/workflows/analyze-changes.yaml index 46da39849e3..9744a3dbfa6 100644 --- a/.github/workflows/analyze-changes.yaml +++ b/.github/workflows/analyze-changes.yaml @@ -50,13 +50,14 @@ jobs: build-mode: 'manual' - name: Build dd-trace-java for creating the CodeQL database run: | + GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2G -Xms2G'" \ JAVA_HOME=$JAVA_HOME_8_X64 \ JAVA_8_HOME=$JAVA_HOME_8_X64 \ JAVA_11_HOME=$JAVA_HOME_11_X64 \ JAVA_17_HOME=$JAVA_HOME_17_X64 \ JAVA_21_HOME=$JAVA_HOME_21_X64 \ ./gradlew clean :dd-java-agent:shadowJar \ - --build-cache --parallel --stacktrace --no-daemon --max-workers=8 + --build-cache --parallel --stacktrace --no-daemon --max-workers=4 - name: Perform CodeQL Analysis and upload results to GitHub Security tab uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6