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

refactor release process to use ko to build the images #1008

Merged
merged 2 commits into from
Nov 9, 2021

Conversation

cpanato
Copy link
Member

@cpanato cpanato commented Nov 7, 2021

Summary

  • add more platforms when building the binaries
  • use ko to build/push the container images

Ticket Link

n/a

Release Note

 refactor release process to use ko to build the images

@cpanato cpanato force-pushed the release-ko branch 7 times, most recently from 08eafb4 to 494758e Compare November 7, 2021 16:21
@cpanato
Copy link
Member Author

cpanato commented Nov 7, 2021

using this change
rehearsal release: https://github.com/cpanato/cosign/releases/tag/v99.999.00-ko

images:

  • gcr.io/cpanato-general/cosign:v99.999.00-ko
  • gcr.io/cpanato-general/cosigned:v99.999.00-ko
  • gcr.io/cpanato-general/sget:v99.999.00-ko

manifest

$ crane manifest gcr.io/cpanato-general/cosign:v99.999.00-ko | jq .
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 1079,
      "digest": "sha256:7d79c85423a9a8fee1d234928b0b5055e2e6f8506632c89254bfa9914bf8e9da",
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 1079,
      "digest": "sha256:b2488b0ffd4a74b44c6c7947d971f0b28f0659b80db5ba46cdf465a26d71a3dd",
      "platform": {
        "architecture": "arm",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 1079,
      "digest": "sha256:ff0d0eee17ef9e732f267f295e31541d25be645bb7e379be24534a74726c8350",
      "platform": {
        "architecture": "arm64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 1079,
      "digest": "sha256:6980255de9178617844f3e3b82140f6a69f38fc04d223237a05e9063f84cb549",
      "platform": {
        "architecture": "ppc64le",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 1079,
      "digest": "sha256:3392a254f17fb3846ea454dffe04b6b16044aa0e8d869eda5e49108ac1ff9f1c",
      "platform": {
        "architecture": "s390x",
        "os": "linux"
      }
    }
  ]
}

cosign version:

$ docker run gcr.io/cpanato-general/cosign:v99.999.00-ko version
Unable to find image 'gcr.io/cpanato-general/cosign:v99.999.00-ko' locally
v99.999.00-ko: Pulling from cpanato-general/cosign
e8614d09b7be: Already exists
c6f4d1a13b69: Already exists
601401253d0a: Already exists
250c06f7c38e: Already exists
cb7a34949835: Pull complete
Digest: sha256:2c6befdb93e10a051c228178b2a8911060958862f2e4d57597eefc04f5acb6e7
Status: Downloaded newer image for gcr.io/cpanato-general/cosign:v99.999.00-ko
GitVersion:    v99.999.00-ko
GitCommit:     494758efeb750839eb73d759bd4459fc96219573
GitTreeState:  clean
BuildDate:     '2021-11-07T16:21:36Z'
GoVersion:     go1.17.3
Compiler:      gc
Platform:      linux/amd64

@cpanato cpanato changed the title WIP refactor release process to use ko to build the images refactor release process to use ko to build the images Nov 7, 2021
@cpanato cpanato marked this pull request as ready for review November 7, 2021 16:49
@cpanato cpanato force-pushed the release-ko branch 3 times, most recently from d1ebcd5 to 638a9c8 Compare November 7, 2021 17:16
Makefile Outdated
# We can't pass more than one LDFLAG via GOFLAGS, you can't have spaces in there.
KO_DOCKER_REPO=${KO_PREFIX}/cosign CGO_ENABLED=0 GOFLAGS="-ldflags=-X=$(PKG).gitCommit=$(GIT_HASH)" ko publish --bare \
LDFLAGS="$(LDFLAGS)" GIT_HASH=$(GIT_HASH) GIT_VERSION=$(GIT_VERSION) \
KO_DOCKER_REPO=${KO_PREFIX}/cosign ko publish --bare \
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you don't want KO_DOCKER_REPO=${KO_PREFIX} ko publish --base in these? This will have the same effect as you have now without having to set KO_DOCKER_REPO separately each time.

Copy link
Member Author

Choose a reason for hiding this comment

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

--base does not exist i just found --base-import-paths but the issue is the cosigned image name we build the build path is cmd/cosign/webhook so the image will be called webhook instead of cosigned but then I guess we can use the current approach for this

Copy link
Member Author

Choose a reason for hiding this comment

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

did some changes based on your feedback @imjasonh , can you please take another look?

thanks so much for your time to review this pull request

Signed-off-by: Carlos Panato <ctadeu@gmail.com>
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
@dlorenc dlorenc merged commit 82c9cee into sigstore:main Nov 9, 2021
@github-actions github-actions bot added this to the v1.4.0 milestone Nov 9, 2021
@cpanato cpanato deleted the release-ko branch November 9, 2021 09:22
- -tags
- "{{ .Env.GIT_VERSION }}"
ldflags:
- -extldflags "-static"
Copy link
Member

Choose a reason for hiding this comment

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

can't we add them to the LDFLAGS environment variable as the ossf/scorecard project did? @cpanato

Copy link
Member Author

Choose a reason for hiding this comment

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

we can, but here define that as well, not sure what is the best

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Awesome. We should be able to delete the Dockerfiles too (didn't spot it here on a quick scan).

@mattmoor
Copy link
Member

mattmoor commented Nov 9, 2021

I now see the linked PR (and they are gone at HEAD)! Awesome.

dlorenc added a commit to dlorenc/cosign that referenced this pull request Nov 10, 2021
…action.

This got dropped in sigstore#1008 and has been failing since.

Signed-off-by: Dan Lorenc <lorenc.d@gmail.com>
developer-guy pushed a commit that referenced this pull request Nov 10, 2021
…action. (#1022)

This got dropped in #1008 and has been failing since.

Signed-off-by: Dan Lorenc <lorenc.d@gmail.com>
@cpanato cpanato modified the milestones: v1.4.0, v1.3.1 Nov 11, 2021
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.

7 participants