Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): improvements to gha workflows #13

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

sgammon
Copy link
Owner

@sgammon sgammon commented Mar 8, 2024

Part 4 of PR testing.

Summary

Applies updates to GHA CI, and refactors into Reusable Workflows. Hardens supply chain security for Guava both in CI and release.

Enclosed features

Changelog

  • chore(ci): apply hardening to ci jobs
  • chore: apply 'Harden Runner' auditing to all ci tasks
  • chore: apply persist-credentials: false to checkout tasks
  • chore: publish dependency graph and add dependency review check
  • chore: add codeql scan job (temp)
  • chore: bump actions/checkout4.1.1
  • chore: bump actions/dependency-review-action4.1.3
  • chore(ci): refactor into reusable workflows
  • chore: move ci jobs to workflow_call trigger
  • chore: add entrypoint jobs for PR and Push events
  • chore: cleanup permissions and dispatch checks/tests
  • chore(ci): switch to enforced hardening mode
  • chore: gather and apply network endpoints for each job
  • chore: move to block mode for egress-policy in step-security/harden-runner
  • feat(ci): slsa provenance support
  • feat: add slsa support to build workflow
  • chore: split test into build and test workflows
  • chore: use new workflows (build/test) from push/pr triggers
  • chore(build): parameterize deploy repositories
  • chore: add sigstore plugin to build
  • chore: add --strict-checksums flag to mvnw calls in ci

Action updates

Bumps actions/checkout from 3.6.0 to 4.1.1.

Bumps actions/dependency-review-action from 2.5.1 to 4.1.3.

@sgammon sgammon added the enhancement New feature or request label Mar 8, 2024
@sgammon sgammon self-assigned this Mar 8, 2024
@sgammon sgammon force-pushed the chore/ci-security branch 18 times, most recently from e3e2cd9 to 0403cf7 Compare March 12, 2024 01:02
- chore: apply 'Harden Runner' auditing to all ci tasks
- chore: apply `persist-credentials: false` to checkout tasks
- chore: publish dependency graph and add dependency review check
- chore: add codeql scan job (temp)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3.6.0...b4ffde6)

Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 2.5.1 to 4.1.3.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](actions/dependency-review-action@0efb1d1...9129d7d)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: actions/dependency-review-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: StepSecurity Bot <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@sgammon sgammon force-pushed the chore/ci-security branch from 0403cf7 to 5bde323 Compare March 12, 2024 21:23
sgammon added 8 commits March 12, 2024 15:58
This change refactors the main CI workflow into two new workflows, `on.pr.yml` and
`on.push.yml`, which each call into the exiting CI job as a reusable workflow.

This has the nice benefit of putting all tests, checks, builds, etc., on one screen
during development on GitHub, allows customization of the PR vs. push flow, and yet
keeps behavior fully consistent between the two.

- chore: move ci jobs to `workflow_call` trigger
- chore: add entrypoint jobs for PR and Push events
- chore: cleanup permissions and dispatch checks/tests

Signed-off-by: Sam Gammon <[email protected]>
This changeset switches the StepSecurity hardening action to enforced mode, where
previously it was running in `audit` mode. Now, audit logs have been gathered and
it is time to seal off the list of accessible network endpoints for a given job.

- chore: gather and apply network endpoints for each job
- chore: move to `block` mode for `egress-policy` in `step-security/harden-runner`

Signed-off-by: Sam Gammon <[email protected]>
This changeset adds SLSA 3+ provenance support to the workflow. The main CI run has now been
split into two: `ci.build.yml`, which only builds the library and is provenance-capable, and
`ci.test.yml`, which is the previous CI logic.

The regular build logic is applied only on push, and can be applied on PRs too, with publish
of provenance material turned off. The test suite is invoked from PRs.

The workflows have been split into build/test phases to avoid publishing provenance data and
GitHub artifacts for build matrix outputs. JARs are uniform across OS targets, so there is no
need to gather and publish for more than Ubuntu.

- feat: add slsa support to build workflow
- chore: split `test` into `build` and `test` workflows
- chore: use new workflows (build/test) from push/pr triggers

Signed-off-by: Sam Gammon <[email protected]>
Fails the build if any downloaded dependencies fail their checksum
verification.

- chore: add `--strict-checksums` flag to `mvnw` calls in ci
- chore: don't rebuild javadoc during tests in ci
- chore: don't run with gpg enabled in ci

Signed-off-by: Sam Gammon <[email protected]>
Adds two build parameters
- `publishing.repository.snapshots`: Snapshot repo to deploy to
- `publishing.repository.releases`: Releases repo to deploy to

Both default to their current values, Sonatype. This small inert
change allows a fork to easily publish to a different repository
without resorting to a code change.

Signed-off-by: Sam Gammon <[email protected]>
This changeset adds the Maven Sigstore plugin for use during
publishing to Sonatype and other public repositories.

- chore: add sigstore plugin to build

Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
@sgammon sgammon force-pushed the chore/ci-security branch 2 times, most recently from 73794d5 to c5846e1 Compare March 13, 2024 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants