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

Update distroless dependencies #1655

Closed
wants to merge 3 commits into from

Conversation

dhalperi
Copy link
Contributor

@dhalperi dhalperi commented Oct 19, 2020

It's been over a year since they were updated. For Java at least, many security updates in that time.

I had to manually skip static and debian9 in the update_deps.sh script, as they
failed on https://gcr.io/v2/distroless/static/manifests/debug

{
  errors: [
    {
      code: "MANIFEST_UNKNOWN",
      message: "Failed to fetch "debug" from request "/v2/distroless/static/manifests/debug"."
    }
  ]
}

This change is Reviewable

It's been over a year since they were updated. For Java at least, many security updates in that time.

I had to manually skip static and debian9 in the update_deps.sh script, as they
failed on https://gcr.io/v2/distroless/static/manifests/debug

    {
      errors: [
        {
          code: "MANIFEST_UNKNOWN",
          message: "Failed to fetch "debug" from request "/v2/distroless/static/manifests/debug"."
        }
      ]
    }
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dhalperi
To complete the pull request process, please assign smukherj1 after the PR has been reviewed.
You can assign the PR to them by writing /assign @smukherj1 in a comment when ready.

The full list of commands accepted by this bot can be found 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

@dhalperi
Copy link
Contributor Author

Hmm. this changes ~the exact same files as #480, yet the tests fail. Not yet able to figure out why.

@dhalperi
Copy link
Contributor Author

@smukherj1 @alex1545 - GitHub seems to have assigned you as reviewers. Any suggestions?

# "gcr.io/distroless/python3:latest" circa 2019-10-11 13:46 -0400
"latest": "sha256:de110a5eb0edb950dc4653ae0288f530b8c2af77e44d9bebab117ed0b74d5426",
# "gcr.io/distroless/python3:debug" circa 2020-10-19 11:55 -0700
"debug": "sha256:1d992aa6631cacd44746d5d2915b21ad93869cfb2519f90bd516a244b528b6fe",
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like one of these is problematic. Try manually reverting the changes in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. I reran the script completely and it now is reporting errors for both python and go containers :).The errors is non-deterministic, based on which CI step you look at -- which means it may also have messed up any others, but Bazel is reporting the first error.

Locally, I also get errors for cc_image:

ERROR: /Users/dan/rules_docker/tests/container/rust/BUILD:20:11: //tests/container/rust:rust_image depends on @cc_image_base//image:image in repository @cc_image_base which failed to fetch. no such package '@cc_image_base//image': SHA256 of the image specified does not match SHA256 of the pulled image. Expected sha256:ac75dbf0b249e5e3758134458d447bfd6a85d74c262ecb7cd88df68a3f53c6e3, but pulled image with sha256:c4014bdecaede16f767f8cfc496f968736bc08632bf54a37c004820e85cd8209. It is possible that you have a pin to a manifest list which points to another image, if so, change the pin to point at the actual Docker image

Do you know what the pin it's talking about refers to?

Copy link
Contributor Author

@dhalperi dhalperi Oct 30, 2020

Choose a reason for hiding this comment

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

Playing around:

$ ~/go/bin/crane digest gcr.io/distroless/cc:latest 
2020/10/30 13:17:44 No matching credentials were found, falling back on anonymous
sha256:ac75dbf0b249e5e3758134458d447bfd6a85d74c262ecb7cd88df68a3f53c6e3

$ ~/go/bin/crane manifest gcr.io/distroless/cc:latest 
2020/10/30 13:15:34 No matching credentials were found, falling back on anonymous
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 947,
         "digest": "sha256:c4014bdecaede16f767f8cfc496f968736bc08632bf54a37c004820e85cd8209",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 947,
         "digest": "sha256:ec7bfcbba262708761909c65c9d26358a1785b849bf32507fa785ddaed77e9bd",
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      }
   ]
}%

So I can see where both the shas in the error are coming from.

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 guessing that google/go-containerregistry#625 is related.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, and duh, I have confirmed that the sha256sum of the manifest is the string returned by crane digest:

$  ~/go/bin/crane manifest gcr.io/distroless/cc:latest | sha256sum 
2020/10/30 13:44:37 No matching credentials were found, falling back on anonymous
ac75dbf0b249e5e3758134458d447bfd6a85d74c262ecb7cd88df68a3f53c6e3  -

This is error-prone: relies on me copying the right
latest into the right sha, the right debug into the right sha.
@dhalperi dhalperi closed this Oct 30, 2020
@dhalperi
Copy link
Contributor Author

Figured out how to fix update_deps, will send another PR.

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

Successfully merging this pull request may close these issues.

3 participants