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

write history as part of layer meta data. #875

Closed
4 tasks done
loosebazooka opened this issue Aug 23, 2018 · 2 comments
Closed
4 tasks done

write history as part of layer meta data. #875

loosebazooka opened this issue Aug 23, 2018 · 2 comments
Assignees
Milestone

Comments

@loosebazooka
Copy link
Member

loosebazooka commented Aug 23, 2018

History might be necessary for some tools to work.

  • add history fields to manifest object
  • passthrough original history
  • write jib layer history
  • allow custom "created_by" field

expected format:

{
  "author": "Jib",
  "created": "1970-01-01T00:00:00Z", # or useCurrentTimeStamp
  "created_by": "jib" # or jib-gradle-plugin jib-maven-plugin (tool identifier)
}
@mattmoor
Copy link

$ crane config gcr.io/distroless/java/jetty@sha256:4bec71e275183f6306ea1bfe490dcf54732fcc7e37c137129ad30ed9dc62b99d | python -mjson.tool
{
    "architecture": "amd64",
    "author": "Bazel",
    "config": {
        "Cmd": [
            "/jetty/start.jar"
        ],
        "Entrypoint": [
            "/usr/bin/java",
            "-jar"
        ],
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/busybox",
            "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt"
        ],
        "ExposedPorts": {
            "8080/tcp": {}
        },
        "WorkingDir": "/jetty"
    },
    "created": "1970-01-01T00:00:00Z",
    "history": [
        {
            "author": "Bazel",
            "created": "1970-01-01T00:00:00Z",
            "created_by": "bazel build ..."
        },
        {
            "author": "Bazel",
            "created": "1970-01-01T00:00:00Z",
            "created_by": "bazel build ..."
        },
        {
            "author": "Bazel",
            "created": "1970-01-01T00:00:00Z",
            "created_by": "bazel build ..."
        },
        {
            "author": "Bazel",
            "created": "1970-01-01T00:00:00Z",
            "created_by": "bazel build ..."
        },
        {
            "author": "Bazel",
            "created": "1970-01-01T00:00:00Z",
            "created_by": "bazel build ..."
        }
    ],
    "os": "linux",
    "rootfs": {
        "diff_ids": [
            "sha256:c09300da45505100cbbad5ae5cd8f80389ed86a162e60f6fa211828ff3f80268",
            "sha256:6f1db24e440882e47a86c6cbad091e98fda9e57cbbcb0ff8e34b46e6a435b20a",
            "sha256:6189abe095d53c1c9f2bfc8f50128ee876b9a5d10f9eda1564e5f5357d6ffe61",
            "sha256:60a2d5e902b42d2ecece89489c92e17b417b93ec672c347a115f086b88e2e403",
            "sha256:08ab7965197fe6957bf795e2d6ee4d58d8402e02dc6771e814ab57a5597b707c"
        ],
        "type": "layers"
    }
}

Note that you can add history entries for empty layers (e.g. USER foo), but must add "empty_layer": true IIRC. The length of this list w/o empty_layers must match the diff_ids length and the length of layers in the manifest.

@coollog
Copy link
Contributor

coollog commented Aug 23, 2018

For created_by, perhaps we should use the tool identifier like we pass for the user agent, so it could be jib-maven-plugin, jib-gradle-plugin, jib-sbt-plugin, or jib for no identifier set.

For created (the time), it should probably respect the useCurrentTimestamp flag.

@coollog coollog modified the milestones: v0.9.11, v0.10.0 Aug 23, 2018
@coollog coollog modified the milestones: v0.10.0, v0.9.10 Sep 27, 2018
ccwienk added a commit to gardener/cc-utils that referenced this issue May 10, 2021
Kaniko will in some cases create cfg-blobs where the amount of entries
in the `history` attr is smaller than the amount of fs-layer-blobs.

This leads to artifactory rejecting the manifest with an error message
like so:

```
{"errors":[{"code":"MANIFEST_INVALID","message":"manifest
invalid","detail":{"description":"Circuit Breaker Threshold Reached,
Breaking Operation. see log output for manifest details."}}]}
```

There are some bugs reports to be found on that behaviour, e.g.:

GoogleContainerTools/jib#875

As a workaround, cp the last history-entry in case the amount of layers
exceeds the history-entries to prevent this behaviour from happening.
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

No branches or pull requests

4 participants