seqeralabs / wave-cli

Command line tool for Wave containers provisioning service
https://seqera.io/wave
Apache License 2.0
13 stars 3 forks source link

Inspect option does not render layer URI #66

Closed pditommaso closed 6 months ago

pditommaso commented 6 months ago

The --inspect option should include the URI of each container layer in the rendered response, however it looks like the it's working only for YAML and not for the JSON format.

For example

» wave  -i ubuntu --inspect -o yaml 
container:
  config:
    architecture: amd64
    config:
      attachStderr: false
      attachStdin: false
      attachStdout: false
      cmd:
      - /bin/bash
      domainName: null
      entrypoint: []
      env:
      - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      hostName: null
      image: sha256:2d6aba5b416f4e6f32e4a251566b93269dad188c03f609fe73cf00e69ae616ea
      tty: false
      user: null
      workingDir: null
    container: 4329d013a36a05ea91cd3564d99c1f06eac0a753e4155730e274f7a87aa8bb4e
    created: '2024-04-29T16:38:03.122210017Z'
    rootfs:
      diff_ids:
      - sha256:80098e3d304cd7858ad97b310cd16083fbe6fab2968be7a988fc6894cb85dc25
      type: layers
  digest: sha256:3f85b7caad41a95462cf5b787d8a04604c8262cdcdf9a472b8c52ef83375fe15
  hostName: https://registry-1.docker.io
  imageName: library/ubuntu
  manifest:
    annotations: null
    config:
      annotations: null
      digest: sha256:bf3dc08bfed031182827888bb15977e316ad797ee2ccb63b4c7a57fdfe7eb31d
      mediaType: application/vnd.oci.image.config.v1+json
      size: 2297
    layers:
    - annotations: null
      digest: sha256:49b384cc7b4aa0dfd16ff7817ad0ea04f1d0a8072e62114efcd99119f8ceb9ed
      mediaType: application/vnd.oci.image.layer.v1.tar+gzip
      size: 28867545
      uri: https://registry-1.docker.io/v2/library/ubuntu/blobs/sha256:49b384cc7b4aa0dfd16ff7817ad0ea04f1d0a8072e62114efcd99119f8ceb9ed
    mediaType: application/vnd.oci.image.manifest.v1+json
    schemaVersion: 2
  reference: latest
  registry: docker.io

Instead

» wave  -i ubuntu --inspect | jq
{
  "container": {
    "config": {
      "architecture": "amd64",
      "config": {
        "attachStderr": false,
        "attachStdin": false,
        "attachStdout": false,
        "cmd": [
          "/bin/bash"
        ],
        "entrypoint": [],
        "env": [
          "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "image": "sha256:2d6aba5b416f4e6f32e4a251566b93269dad188c03f609fe73cf00e69ae616ea",
        "tty": false
      },
      "container": "4329d013a36a05ea91cd3564d99c1f06eac0a753e4155730e274f7a87aa8bb4e",
      "created": "2024-04-29T16:38:03.122210017Z",
      "rootfs": {
        "diff_ids": [
          "sha256:80098e3d304cd7858ad97b310cd16083fbe6fab2968be7a988fc6894cb85dc25"
        ],
        "type": "layers"
      }
    },
    "digest": "sha256:3f85b7caad41a95462cf5b787d8a04604c8262cdcdf9a472b8c52ef83375fe15",
    "hostName": "https://registry-1.docker.io",
    "imageName": "library/ubuntu",
    "manifest": {
      "config": {
        "digest": "sha256:bf3dc08bfed031182827888bb15977e316ad797ee2ccb63b4c7a57fdfe7eb31d",
        "mediaType": "application/vnd.oci.image.config.v1+json",
        "size": 2297
      },
      "layers": [
        {
          "digest": "sha256:49b384cc7b4aa0dfd16ff7817ad0ea04f1d0a8072e62114efcd99119f8ceb9ed",
          "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
          "size": 28867545
        }
      ],
      "mediaType": "application/vnd.oci.image.manifest.v1+json",
      "schemaVersion": 2
    },
    "reference": "latest",
    "registry": "docker.io"
  }
}
pditommaso commented 6 months ago

It looks like a problem in the rendering of the json

https://github.com/seqeralabs/wavelit/blob/f7823d7bd49d79079e165b85d0c272897a9e47ec/app/src/main/java/io/seqera/wave/cli/json/JsonHelper.java#L57-L60