Skip to content

cbscore: make signing optional#30

Open
UweSchwaeke wants to merge 3 commits intoclyso:mainfrom
UweSchwaeke:wip-cbsbuild-make-signing-optional
Open

cbscore: make signing optional#30
UweSchwaeke wants to merge 3 commits intoclyso:mainfrom
UweSchwaeke:wip-cbsbuild-make-signing-optional

Conversation

@UweSchwaeke
Copy link
Collaborator

  • what:
    check if the vault and transit keys are available in the secrets file.
    retrieve user credentials for the registry and transit. if all
    credentials are available, sign the image with cosign. otherwise,
    skip signing.

  • why:
    signing of rpm is already optional depending on the presence of a key.
    now signing of container images is optional too.

@UweSchwaeke UweSchwaeke force-pushed the wip-cbsbuild-make-signing-optional branch from ad92cea to c8ae0ab Compare February 23, 2026 19:39
* what:
  if the return code of the rpm process is 2, check if the failure
  reason is that the package is already installed.

* why:
  when reusing a container, the package might already be present.
  this occurs when a build runner job must be debugged.

Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com>
* what:
  add option --tls-verify to subcommands build and runner build.
  pass the tls-verify flag to skopeo when querying the registry.
  check if the return value from skopeo inspect equals
  "not found" (exit code 2).

* why:
  if the image is pushed to a local container registry with a
  self-signed certificate, skopeo must not verify the certificate
  to avoid errors. current versions of skopeo (1.20.0) return exit
  code 2 if an image is not found.

Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com>
* what:
  check if the vault and transit key is available in the secrets file.
  retrieve user credentials for the registry and transit. if all
  credentials are available, sign the image with cosign; otherwise,
  skip signing.

* why:
  run cbsbuild locally for testing, the image signing step must be
  skipped if keys are missing.
  see clyso#24

Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com>
@UweSchwaeke UweSchwaeke force-pushed the wip-cbsbuild-make-signing-optional branch from c8ae0ab to 5cb13ef Compare March 9, 2026 08:09
@jecluis
Copy link
Contributor

jecluis commented Mar 12, 2026

This PR seems to depend on #29 .

raise SkopeoError()

logger.info(f"signed image '{dst}': {out}")
if can_sign(dst_registry, dst, secrets, transit):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be simpler to do something like

if not can_sign(...):
  logger.info("can't sign, sorry, 🤷 ")
  return

[the code inside that block]

Alternatively, have an else branch with the log message, because otherwise we may not be signing the image and it's not clear why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants