diff --git a/.changeset/major-lilies-hunt.md b/.changeset/major-lilies-hunt.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/major-lilies-hunt.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/qa-gate.yml b/.github/workflows/qa-gate.yml index 7562cf70b5..9ef5b74385 100644 --- a/.github/workflows/qa-gate.yml +++ b/.github/workflows/qa-gate.yml @@ -161,6 +161,37 @@ jobs: base-ref: origin/${{ env.BASE_BRANCH }} target-branch: ${{ env.BASE_BRANCH }} + # Before the push: an SBOM that cannot be generated blocks the merge. + # Not "--lockfile-only": reading the installed packages adds their licenses to the SBOM. + # 1.6, not pnpm's 1.7 default: 1.6 is the spec version our Dependency-Track ingests. + - name: Generate SBOM + id: sbom + run: | + COMMIT=$(git rev-parse HEAD) + VERSION=$(jq -r .version packages/ckeditor5-common/package.json) + + pnpm sbom \ + --sbom-format cyclonedx \ + --sbom-spec-version 1.6 \ + --sbom-type application \ + --out build/sbom/ckeditor-plugins-workspace.cdx.json + + # Read by the nightly Dependency-Track upload, see DEVELOPMENT.md. + jq -n --arg branch "$BASE_BRANCH" --arg commit "$COMMIT" --arg version "$VERSION" \ + '{branch: $branch, commit: $commit, version: $version}' \ + > build/sbom/metadata.json + + echo "commit=$COMMIT" >> "$GITHUB_OUTPUT" + + # Named after the pushed commit, so the nightly upload finds the SBOM of a branch head. + - name: Upload SBOM + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: sbom-${{ steps.sbom.outputs.commit }} + path: build/sbom + if-no-files-found: error + retention-days: 90 + - name: Push to base branch env: PR_NUMBER: ${{ needs.check-queue.outputs.pr-number }} diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 0d6e58a32f..62a122115e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -96,6 +96,31 @@ introduced. Releases of the old release process (up to `28.1.1`) and the legacy branches `maintenance/23.0`, `24.0` and `25.0` are not supported by this workflow. Major 28 becomes maintainable with its first release made with Changesets. +## SBOM + +Before the QA gate pushes to `main` or a maintenance branch, it generates a +CycloneDX SBOM (spec version 1.6) of the whole workspace with `pnpm sbom`. An SBOM +that cannot be generated blocks the merge. The QA gate stores it together with a +`metadata.json` (branch, commit, version) as the artifact `sbom-`, +named after the pushed commit and kept for 90 days. + +A nightly job on an internal Jenkins of CoreMedia uploads the SBOM of each branch +head to Dependency-Track as the project `ckeditor-plugins-workspace`, version +`main` or `maintenance-`, below the parent project `Ckeditor Plugins`. +Each upload replaces the previous one of that version, and it arrives up to a day +after the merge. The job is defined in the internal repository +`CoreMedia/ci-jobs`. + +This is a temporary solution. Other CoreMedia workspaces upload their SBOM from +GitHub Actions through a shared workflow, but this repository is public: it can +neither use that private workflow nor reach Dependency-Track, which is only +available internally. + +A new maintenance branch has no SBOM until its first merged pull request, because +its first commit is pushed by _Create Maintenance Branch_ and not by the QA gate; +the nightly job only logs a warning for it. A maintenance branch created from a +release without the SBOM step needs this step cherry-picked into its QA gate. + ## Update Process All dependency versions are maintained centrally in the `catalog` of