Skip to content

Reset ci with sbom and cosign - #2490

Open
SamYuan1990 wants to merge 1 commit into
sustainable-computing-io:mainfrom
SamYuan1990:resetCIwithSBOMandcosign
Open

SamYuan1990 wants to merge 1 commit into
sustainable-computing-io:mainfrom
SamYuan1990:resetCIwithSBOMandcosign

Conversation

@SamYuan1990

@SamYuan1990 SamYuan1990 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

related with #2235

Comment thread .github/workflows/push.yaml Fixed
@SamYuan1990
SamYuan1990 force-pushed the resetCIwithSBOMandcosign branch 3 times, most recently from 6362d4f to 2a8805a Compare July 9, 2026 06:30
@github-actions github-actions Bot added the ci Changes to the CI pipeline label Jul 9, 2026
@SamYuan1990
SamYuan1990 force-pushed the resetCIwithSBOMandcosign branch 3 times, most recently from 894f65c to e5d1588 Compare July 9, 2026 06:45
@SamYuan1990

Copy link
Copy Markdown
Collaborator Author

@sunya-ch and @nikimanoledaki
do we really need cosign for helm and binary? ref https://docs.sigstore.dev/quickstart/quickstart-ci/

@SamYuan1990
SamYuan1990 force-pushed the resetCIwithSBOMandcosign branch from e5d1588 to ef9f608 Compare July 9, 2026 06:55
@SamYuan1990

SamYuan1990 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

related with #2235

@SamYuan1990
SamYuan1990 force-pushed the resetCIwithSBOMandcosign branch from ef9f608 to d20b82b Compare July 9, 2026 07:09

@nikimanoledaki nikimanoledaki left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @SamYuan1990. There are three main issues:

  1. Please reorder the steps so that it's: build, make push, SBOM, cosign sign. Cosign can only sign a digest that exists after a push. Right now it fails.
  2. Add --yes to all five cosign calls.
  3. Remove oci:// from CHART_REF. Only keep it for helm push - cosign needs a bare registry/repo:tag.

Comment thread .github/workflows/push.yaml Outdated
on: # yamllint disable-line rule:truthy
on:
schedule:
- cron: 0 6 * * * # 每天早上6点(UTC)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- cron: 0 6 * * * # 每天早上6点(UTC
- cron: 0 6 * * * # daily at 6:00 UTC

Comment thread .github/build-image/action.yml Outdated
shell: bash
run: |
IMAGE="${{ inputs.image_base }}/kepler:${{ inputs.version }}"
cosign attach sbom --sbom image-kepler-${{ inputs.version }}.spdx.json "${IMAGE}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cosign attach sbom has been deprecated. Please use the newer equivalent:

cosign attest --predicate sbom.spdx.json --type spdxjson <image>

@SamYuan1990

Copy link
Copy Markdown
Collaborator Author

Thanks @SamYuan1990. There are three main issues:

  1. Please reorder the steps so that it's: build, make push, SBOM, cosign sign. Cosign can only sign a digest that exists after a push. Right now it fails.
  2. Add --yes to all five cosign calls.
  3. Remove oci:// from CHART_REF. Only keep it for helm push - cosign needs a bare registry/repo:tag.

hi @nikimanoledaki ,

For "reorder the steps", in my point of view:
build, meta(like openSSF, in our case SBOM/SLAS...., cosign), push(binary and openSSF)

As "pipeline as code", having a reusable workflow for both release, pr build and daily build as implementation level. We can "test" steps for release in daily changes.
The different between release and pr are parameters and push to register or not, as secret values as container hub login, we have to test those in a release, as trigger level.

Hence, at implementation level, reusable workflow build image, build binary, build helm will have their own response for build(asset) and meta(as openSSF asset), receive parameters for build tag.(such like version)

at invoker/trigger level, the workflow, push(means code merge to default branch), release(means a release tag), .... represent the reason as event trigger, owns value(as build tag, version) to implementation level, and response for push or not.

For cosign, I will change to https://docs.sigstore.dev/quickstart/quickstart-ci/ , and have some comments in code. The code will be built on github action as sigstore/cosign-installer and official documents, makes easy for people/agent to understand and maintain.

WDYT?

@nikimanoledaki

Copy link
Copy Markdown
Collaborator

Thanks @SamYuan1990, I agree with creating a reusable workflow if it works for every scenario, and I also agree with using sigstore/cosign-installer which makes it easier for maintainers 👍

@nikimanoledaki

nikimanoledaki commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

The docs say that signing the artifact should happen after pushing to the artifact registry: https://docs.sigstore.dev/quickstart/quickstart-ci/#signing-and-verifying-a-container-image

@SamYuan1990
SamYuan1990 marked this pull request as draft July 10, 2026 09:20
@SamYuan1990
SamYuan1990 force-pushed the resetCIwithSBOMandcosign branch 3 times, most recently from 58534e1 to addd7b1 Compare July 10, 2026 11:30
Signed-off-by: oe1019 <yy19902439@126.com>
@SamYuan1990
SamYuan1990 force-pushed the resetCIwithSBOMandcosign branch from addd7b1 to 972d8ec Compare July 10, 2026 11:40
@SamYuan1990
SamYuan1990 marked this pull request as ready for review July 10, 2026 11:44
@SamYuan1990

Copy link
Copy Markdown
Collaborator Author

The docs say that signing the artifact should happen after pushing to the artifact registry: https://docs.sigstore.dev/quickstart/quickstart-ci/#signing-and-verifying-a-container-image

I suppose it's about what are we going to "release"/provide.
before the rewrite, we use docker/build-push-action, but during rewrite it changes to make files.( I don't see any benefits on makefile).
So far, I suppose we just cosign for container's sbom.

Another founding as we can't test cosign unless this been merged, as it's require a write permission on GHA token.

Comment on lines +45 to +48
# Image push is intentionally left to the caller workflow.
# The caller is expected to:
# 1. Log into the container registry (e.g. docker login)
# 2. Push the image and optionally attach the signed SBOM or the bundle.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: cleanup extra comments

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I want to keep the comments, we can discuss on the format.

The reason I want to keep those comments as I hope either coding agent or people can know on how to use this action.yaml.

Any suggestions?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to place it in either CLAUDE.md/AGENTS.md or maybe in our ci docs https://github.com/sustainable-computing-io/kepler/tree/main/docs/developer

@vprashar2929 vprashar2929 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SamYuan1990 Couple of things that look broken with this PR:

  1. Release never actually signs. The composites default to false. Release never sets sign: true So the sign steps don't run.
  2. Aren't we uploading the wrong signature files? 🤔 Cosign is writing .sigstore.json bundles but the release artifact globs still look for the old .cert AFAIU they won't match so signature won't show up on the GH releases.
  3. We stopped publishing images on main. The existing workflow built and pushed to Quay via publish-image The new workflow only builds it doesn't push. Can you elaborate on why this change was done?
  4. We used to helm push to oci://... Now we only package and attach the chart to GH release. Why this was done? Please elaborate more
  5. The existing workflow on main also runs tests/codecov and scorecard. With your changes they won't run on the push to main. Can you please revert it or elaborate why the change was done?

Also putting id-token: write at the top of the workflow that runs on PRs is broader than we need. Safer pattern would be default to readonly at top level and elevate the access only on the jobs that actually sign!

Smaller nits:

  1. Cosign install is done repeatedly. This could live inside the composite actions so callers stay thin.
  2. Prefer docker/login-action over echo $TOKEN | docker login

@vprashar2929

Copy link
Copy Markdown
Collaborator

@SamYuan1990 Have you tested this on your fork?

name: helm-artifacts
retention-days: 1
path: |
helm-releases/*.tgz

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vprashar2929 , I suppose helm publish process is not changed in this PR.

@SamYuan1990

Copy link
Copy Markdown
Collaborator Author

@SamYuan1990 Couple of things that look broken with this PR:

  1. Release never actually signs. The composites default to false. Release never sets sign: true So the sign steps don't run.
  2. Aren't we uploading the wrong signature files? 🤔 Cosign is writing .sigstore.json bundles but the release artifact globs still look for the old .cert AFAIU they won't match so signature won't show up on the GH releases.
  3. We stopped publishing images on main. The existing workflow built and pushed to Quay via publish-image The new workflow only builds it doesn't push. Can you elaborate on why this change was done?
  4. We used to helm push to oci://... Now we only package and attach the chart to GH release. Why this was done? Please elaborate more
  5. The existing workflow on main also runs tests/codecov and scorecard. With your changes they won't run on the push to main. Can you please revert it or elaborate why the change was done?

Also putting id-token: write at the top of the workflow that runs on PRs is broader than we need. Safer pattern would be default to readonly at top level and elevate the access only on the jobs that actually sign!

Smaller nits:

  1. Cosign install is done repeatedly. This could live inside the composite actions so callers stay thin.
  2. Prefer docker/login-action over echo $TOKEN | docker login

hi @vprashar2929,

I will check item 1 and item 2. For item 1 the sign is set to false as default as pr can't get id-token: write as permission limits.

For item 3, I will leave to @nikimanoledaki , as I don't know how our build process going to be, before rebuild, we have latest build and pre merge build. ref https://github.com/SamYuan1990/kepler/blob/main/.github/workflows/push.yml#L14, https://github.com/SamYuan1990/kepler/blob/main/.github/workflows/image.yml#L9

For item 4, as I checked in pr diff, seems out of this PR's scope.

For item 5, I will add tests/codecov and scorecard back.

My own fork is before rewrite, I will find a way to test on my own fork, but as we have condition in CI as if: github.repository_owner == 'sustainable-computing-io', I suppose I can't test release.

For nits and code changes, I will check and update after we got agreement on item 1,2,3.

As a summary:

Todo list:

  • fix nits on duplicated Cosign if any.
  • use docker/login-action instead of echo $TOKEN | docker login.
  • check id-token: write
  • add tests/codecov and scorecard back.
  • testing on my fork for push event.(if possible?)

Out of scope:

  • helm push to oci://...

BTW, I hope coding agent can help us on CI changes.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 60 days with no activity.

@github-actions github-actions Bot added the stale Stale state - issue will be closed in 7 days label Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Changes to the CI pipeline stale Stale state - issue will be closed in 7 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants