Skip to content
\n

which is working link https://gitlab.com/metacontroller/test-sem-rel/-/packages/23684709 - however it still publish on release page, is it expected ? While reading https://goreleaser.com/scm/gitlab/#generic-package-registry I was under impression it would do that instead of using gitlab release page ?

\n

Second question, I enabled docker_sign with ko -

\n
docker_signs:\n  - cmd: cosign\n    args:\n      - \"sign\"\n      - \"--upload=false\"\n      - \"${artifact}\"\n      - \"--yes\" # needed on cosign 2.0.0+\n    artifacts: all
\n

using gitlab job id_tokens - (https://docs.gitlab.com/ee/ci/yaml/signing_examples.html#sign-or-verify-container-images-and-build-artifacts-by-using-cosign) - which works pretty neat, however while I was following docs - https://goreleaser.com/customization/docker_sign/ - (copy from docs)

\n
# Command line arguments for the command\n    #\n    # Default: [\"sign\", \"--key=cosign.key\", \"${artifact}@${digest}\", \"--yes\"]\n    # Templates: allowed\n    args:\n    - \"sign\"\n    - \"--key=cosign.key\"\n    - \"--upload=false\"\n    - \"${artifact}\"\n    - \"--yes\" # needed on cosign 2.0.0+
\n

it implies that \"${artifact}@${digest}\" is image_name:image_digest, however when I tried that, it errored :

\n
release failed after 1m23s               error=signing docker images: failed to publish artifacts: sign: cosign failed: exit status 1: Generating ephemeral keys...\nRetrieving signed certificate...\nSuccessfully verified SCT...\nError: signing [registry.gitlab.com/metacontroller/test-sem-rel/commanda@sha256:6ce2e017d73bf84905fc341660fdafe5531725d97012174884780d5eb63009f7@sha256:6ce2e017d73bf84905fc341660fdafe5531725d97012174884780d5eb63009f7]: parsing reference: could not parse reference: registry.gitlab.com/metacontroller/test-sem-rel/commanda@sha256:6ce2e017d73bf84905fc341660fdafe5531725d97012174884780d5eb63009f7@sha256:6ce2e017d73bf84905fc341660fdafe5531725d97012174884780d5eb63009f7
\n

when I switched to just use ${artifact}- https://gitlab.com/metacontroller/test-sem-rel/-/blob/main/.goreleaser.yaml?ref_type=heads#L196

\n

it started to work and resolve image+digest -

\n
 signing docker images\n      • signing                                      cmd=cosign artifact=registry.gitlab.com/metacontroller/test-sem-rel/commanda@sha256:bb41d1f8de551eeac77137a2d5e49667a01e83f8e5fff14a27e4fc477fcc400c\n      • signing                                      cmd=cosign artifact=registry.gitlab.com/metacontroller/test-sem-rel/commandb@sha256:72fc7c39bbb11b60a5ca2236d85224a954083ef0bca170d213c244fa9c7c70d1\n      • signing                                      cmd=cosign artifact=registry.gitlab.com/metacontroller/test-sem-rel/commanda@sha256:0914fb54cd8beb2b1d998a9df39efbe0ec25097be5fbc721e0565667dd74354c\n      • signing                                      cmd=cosign artifact=registry.gitlab.com/metacontroller/test-sem-rel/commandb@sha256:28e56bba2081ba2032bdf2798719bc646f74421c5108a8d6bf1295ea38b77b16\n      • took: 5s\n    • scm releases
\n

so it seems artifact already contain digest ?

\n

Last thing, I created repo with example golang flow (with two binaries, each with binaries/packages/signing packages/docker images with two flavours, signed) - https://gitlab.com/metacontroller/test-sem-rel which is actually pretty good visualization of end 2 end flow using goreleaser, if you think is it valuable I could refactor it and move/donate/make it a pr to https://gitlab.com/goreleaser/example, what do you think ?

","upvoteCount":2,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

ah, yeah, that is a bad example indeed, will fix it

\n

about the repo, if you wanna transfer it to the goreleaser org, I would be more than happy to accept it.

\n

we have a bunch of different examples in the github org, but only that single, simple one, in gitlab

","upvoteCount":1,"url":"https://github.com/orgs/goreleaser/discussions/4702#discussioncomment-8804243"}}}

Signing artifacts and gitlab package registry #4702

Answered by caarlos0
grzesuav asked this question in Q&A
Discussion options

You must be logged in to vote

ah, yeah, that is a bad example indeed, will fix it

about the repo, if you wanna transfer it to the goreleaser org, I would be more than happy to accept it.

we have a bunch of different examples in the github org, but only that single, simple one, in gitlab

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@grzesuav
Comment options

@caarlos0
Comment options

@grzesuav
Comment options

@grzesuav
Comment options

@caarlos0
Comment options

Answer selected by caarlos0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants