Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

container_pull: return the resolved digest to bazel and support overriding platform #544

Merged
merged 4 commits into from
Dec 5, 2018

Conversation

ixdy
Copy link
Contributor

@ixdy ixdy commented Oct 13, 2018

This potentially fixes #543.

It's roughly modeled after the fix for git_repository in bazelbuild/bazel@b42734f.

It depends on google/containerregistry#113 (and a corresponding update of that dependency in rules_docker), so this should not be merged as-is.

@ixdy ixdy force-pushed the bazel-sync-digest branch 3 times, most recently from fb19de9 to 258022a Compare October 13, 2018 00:13
container/pull.bzl Outdated Show resolved Hide resolved
@nlopezgi
Copy link
Contributor

Thanks for sending this PR. It looks good overall. Lets get the change in containerregistry submitted and then return to this.

@ixdy ixdy force-pushed the bazel-sync-digest branch 3 times, most recently from 65c926b to c490b27 Compare October 15, 2018 20:24
@fejta
Copy link

fejta commented Oct 26, 2018

testing 1 2 3

@fejta
Copy link

fejta commented Oct 26, 2018

gubernator confirmed - https://k8s-gubernator.appspot.com/pr/ixdy

@fejta
Copy link

fejta commented Oct 26, 2018

/assign @erain

@fejta
Copy link

fejta commented Oct 26, 2018

/unassign @erain
Prow commands confirmed!

@ixdy
Copy link
Contributor Author

ixdy commented Nov 13, 2018

google/containerregistry update now included. this should be good to go.

Copy link
Contributor

@nlopezgi nlopezgi left a comment

Choose a reason for hiding this comment

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

Hi @ixdy ,
thanks again for sending this PR.
Let's try to add a test for it:

  • add a new container_pull target in the WORKSPACE for a multi-platform image (and pick something other than linux / amd64?)
  • add a container_test to https://github.com/bazelbuild/rules_docker/blob/master/tests/docker/BUILD that uses the image you just pulled. Test can have a metadata test and checl some property of the container that you would expect only be present for the given platform/os, (or you could use a file check that verifies the digest, if that is expected to be different for different platform/os)

Testing the resolved digest:

Please let me know if you have questions about how to add these tests.

@nlopezgi
Copy link
Contributor

hi @ixdy , do you think you can try to set up tests for this PR?

@ixdy
Copy link
Contributor Author

ixdy commented Nov 29, 2018

Yeah, I was starting to work on tests, then ran into google/containerregistry#128, and then I got busy with some other project work. I hope to get back to this by the end of the week, though we'll need a new containerregistry release, too.

@ixdy
Copy link
Contributor Author

ixdy commented Nov 29, 2018

er, wrong issue, I meant google/containerregistry#127.

@ixdy
Copy link
Contributor Author

ixdy commented Nov 29, 2018

(though google/containerregistry#128 means that windows images aren't supported currently)

@nlopezgi
Copy link
Contributor

right, forgot about google/containerregistry#127, sgtm, if you need any help with extra reviews for containerregistry changes let me know. And bummer about google/containerregistry#128, but imo its not a priority to get windows working. (I'm not in a hurry to see this in either, just wanted to check up on status, so take your time)

@ixdy
Copy link
Contributor Author

ixdy commented Dec 5, 2018

I've updated to containerregistry v0.0.34 and added some tests on multi-platform images. I'm still working on testing the resolved digest.

@ixdy
Copy link
Contributor Author

ixdy commented Dec 5, 2018

(I also still need to update the README)

@ixdy ixdy force-pushed the bazel-sync-digest branch 2 times, most recently from 907cd11 to e79e94f Compare December 5, 2018 04:33
Copy link
Contributor Author

@ixdy ixdy left a comment

Choose a reason for hiding this comment

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

I added some partial testing around the digests by checking that the digest file written by puller.par matches expectations. I'm not sure if there's a good way to test the return value of the container_pull rule itself.

I've also updated the README, so I think this is now ready for another review pass.

"os_features": attr.string_list(),
"architecture": attr.string(default = "amd64"),
"cpu_variant": attr.string(),
"platform_features": attr.string_list(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not particularly happy about the name of this attribute, but features is a reserved attribute.

The docker manifest list spec refers to this as CPU features, but the OCI image index spec just says it's a reserved field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't found any images that actually use features yet.

Copy link
Contributor

@nlopezgi nlopezgi left a comment

Choose a reason for hiding this comment

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

thanks for adding tests! I dont have any strong feelings about using platform_features (i.e., ifs fine by me). Couple of minor comments about sha's in container pull.

WORKSPACE Show resolved Hide resolved
WORKSPACE Show resolved Hide resolved
WORKSPACE Show resolved Hide resolved
WORKSPACE Show resolved Hide resolved
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ixdy, nlopezgi
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approvers:

If they are not already assigned, you can assign the PR to them by writing /assign in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

container_pull implementation should return the digest
7 participants