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

New Feature: Overview of tag history content #58

Merged
merged 31 commits into from
Dec 8, 2018
Merged

Conversation

lennartblom
Copy link
Contributor

@lennartblom lennartblom commented Dec 1, 2018

Considering the docker registry provides information about the tag history with the following REST endpoint (http://localhost:5000/v2/{imageName}/manifests/{tag}) this feature should display given information.

{
   "schemaVersion": 1,
   "name": "registry",
   "tag": "2.6",
   "architecture": "amd64",
   "fsLayers": [
      {
         "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
      },
      {
         "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
      },
      {
         "blobSum": "sha256:bcd4a541795bb9981999ce8f6e2e1c92e55b0041256153d2458ff35fb9381063"
      },
      {
         "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
      },
      {
         "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
      },
      {
         "blobSum": "sha256:f296fda86f10cfcb81d60d5bcb47a7784a8ec4876d6eac7fabd51f2a7e8694aa"
      },
      {
         "blobSum": "sha256:2261ba058a15e3f21a467b1b02ea206d40cf0632d6b1aeee2ad200b662ed4aff"
      },
      {
         "blobSum": "sha256:ad0eac849f8f2014e20df11d611e4453c94a365a71eb3a90f02d8500391e1787"
      },
      {
         "blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
      },
      {
         "blobSum": "sha256:d6a5679aa3cfc52503fac8e2345790783537564df5af43355ec662d7703aacbf"
      }
   ],
   "history": [
      {
         "v1Compatibility": "{\"architecture\":\"amd64\",\"config\":{\"Hostname\":\"\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"ExposedPorts\":{\"5000/tcp\":{}},\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"/etc/docker/registry/config.yml\"],\"ArgsEscaped\":true,\"Image\":\"sha256:bc0d86131a2db92f18b8413a38da41718748b152024be47a8bc9413fa1d50a95\",\"Volumes\":{\"/var/lib/registry\":{}},\"WorkingDir\":\"\",\"Entrypoint\":[\"/entrypoint.sh\"],\"OnBuild\":[],\"Labels\":null},\"container\":\"1285298c15e4de2bbffc50c626779c0d843f6885b6846d4643ff3a2684a4236f\",\"container_config\":{\"Hostname\":\"1285298c15e4\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"ExposedPorts\":{\"5000/tcp\":{}},\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) \",\"CMD [\\\"/etc/docker/registry/config.yml\\\"]\"],\"ArgsEscaped\":true,\"Image\":\"sha256:bc0d86131a2db92f18b8413a38da41718748b152024be47a8bc9413fa1d50a95\",\"Volumes\":{\"/var/lib/registry\":{}},\"WorkingDir\":\"\",\"Entrypoint\":[\"/entrypoint.sh\"],\"OnBuild\":[],\"Labels\":{}},\"created\":\"2018-09-12T03:24:52.314798985Z\",\"docker_version\":\"17.06.2-ce\",\"id\":\"642c5398c648f7c142d87068b7458cca42168d21c5b7ce8845a42a70c2a540c1\",\"os\":\"linux\",\"parent\":\"5e107ec5042e728968be91af94c91f9f8a1c56d8118052f42411c43e803a14a6\",\"throwaway\":true}"
      },
      {
         "v1Compatibility": "{\"id\":\"5e107ec5042e728968be91af94c91f9f8a1c56d8118052f42411c43e803a14a6\",\"parent\":\"cb05ce4e4668039cced705abefcdcc57d7225d2f47dbcf97e7c73f51878802a6\",\"created\":\"2018-09-12T03:24:52.151039484Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop)  ENTRYPOINT [\\\"/entrypoint.sh\\\"]\"]},\"throwaway\":true}"
      },
      {
         "v1Compatibility": "{\"id\":\"cb05ce4e4668039cced705abefcdcc57d7225d2f47dbcf97e7c73f51878802a6\",\"parent\":\"27ffc1a6320a1a53d033638554ad297046a378676916af16e2a12107ac0074f2\",\"created\":\"2018-09-12T03:24:51.978916686Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) COPY file:7b57f7ab1a8cf85c00768560fffc926543a60c9c9f7a2b172767dcc9a3203394 in /entrypoint.sh \"]}}"
      },
      {
         "v1Compatibility": "{\"id\":\"27ffc1a6320a1a53d033638554ad297046a378676916af16e2a12107ac0074f2\",\"parent\":\"f02430d73118326d4c0b5ae93fa2b4105f53db2c6d658ce5e39ef76f294952cc\",\"created\":\"2018-09-12T03:24:51.700246722Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop)  EXPOSE 5000/tcp\"]},\"throwaway\":true}"
      },
      {
         "v1Compatibility": "{\"id\":\"f02430d73118326d4c0b5ae93fa2b4105f53db2c6d658ce5e39ef76f294952cc\",\"parent\":\"e9ed306c1b7c88854b927edc08563108d3d3fbd6a2e451a93633fa77b49287af\",\"created\":\"2018-09-12T03:24:51.53969035Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop)  VOLUME [/var/lib/registry]\"]},\"throwaway\":true}"
      },
      {
         "v1Compatibility": "{\"id\":\"e9ed306c1b7c88854b927edc08563108d3d3fbd6a2e451a93633fa77b49287af\",\"parent\":\"bb0471001dbd794fb48bb0b0cc3dea5191b10700ffb315f0fe973589950ba238\",\"created\":\"2018-09-12T03:24:51.371267849Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) COPY file:6c4758d509045dc45381fa2df2e7ffcc661afcaa29805c75f8f1976f2b016db8 in /etc/docker/registry/config.yml \"]}}"
      },
      {
         "v1Compatibility": "{\"id\":\"bb0471001dbd794fb48bb0b0cc3dea5191b10700ffb315f0fe973589950ba238\",\"parent\":\"690063f4933c5c9b4dd64c27191f0dd4e1d529998b5390e19d05639decdb1048\",\"created\":\"2018-09-12T03:24:51.107431062Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) COPY file:b99d4fe47ad1addf0e8f244236e05177f3bfe9eb3ddd59f08b67b2612d77c621 in /bin/registry \"]}}"
      },
      {
         "v1Compatibility": "{\"id\":\"690063f4933c5c9b4dd64c27191f0dd4e1d529998b5390e19d05639decdb1048\",\"parent\":\"b7993f8ae5c59ae4ac100850dc59eb3c9a318abb9885501d29e5d0e7d82d8ca4\",\"created\":\"2018-09-12T03:24:50.648009605Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c set -ex     \\u0026\\u0026 apk add --no-cache ca-certificates apache2-utils\"]}}"
      },
      {
         "v1Compatibility": "{\"id\":\"b7993f8ae5c59ae4ac100850dc59eb3c9a318abb9885501d29e5d0e7d82d8ca4\",\"parent\":\"27d83df3618a9b57555411d41f39fad28f2d538ad73817251eae8196a32a8336\",\"created\":\"2018-09-11T22:20:45.6231644Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop)  CMD [\\\"/bin/sh\\\"]\"]},\"throwaway\":true}"
      },
      {
         "v1Compatibility": "{\"id\":\"27d83df3618a9b57555411d41f39fad28f2d538ad73817251eae8196a32a8336\",\"created\":\"2018-09-11T22:20:45.441561959Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) ADD file:4b806a0c031f19a4609ebde02464b2139efebfdf9f5d1bba13cf1c316938530d in / \"]}}"
      }
   ],
   "signatures": [
      {
         "header": {
            "jwk": {
               "crv": "P-256",
               "kid": "CL5I:VY2W:377T:6KA7:JFS7:FBVQ:RUVP:VNHQ:V2LX:J5JJ:475X:NFUD",
               "kty": "EC",
               "x": "GrBvT7mn5JN9vyx8rF5c2pn322d11T50oY7qv2lJeRY",
               "y": "sCXIYZZIzG5ADBOzNdhzW2GO0Awjl_CLz7pynCm8MhE"
            },
            "alg": "ES256"
         },
         "signature": "SZpIyW9pUP70RDO0rd5Cvwc1giPvpBczuwxMbybfi-BBPSFpSf4BkXR0eHRbFrfozl0Avjf9rqSK8asX7LNWlw",
         "protected": "eyJmb3JtYXRMZW5ndGgiOjYyMTEsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAxOC0xMi0wMVQyMDoxMjoyMloifQ"
      }
   ]
}

The following modification to the taglist view were made to access a new page, which list the given registry JSON data.

Modification on the taglist view
screen shot 2018-12-01 at 20 34 56

New overview of v2/{imageName}/manifest/{tag} contents
screen shot 2018-12-01 at 21 11 13

Possible future todos:

  • Displaying of nested config and container_config content
  • Displaying fsLayers section
  • Displaying signatures information

So... what do you think? 😀 I personally believe that information provided by the v2 REST API are worth to be displayed. Thus, it might be a good idea to think about!

I look forward to your constructive feedback and hope my indentation was properly configured!

All the best from Germany,
Lennart Blom

P.S: Don't be too strict with my JavaScript. I am a passionate Java backend engineer and unfortunately can't look back on much experience in the frontend area at the moment.

@Joxit Joxit self-assigned this Dec 2, 2018
@Joxit Joxit self-requested a review December 2, 2018 16:06
@Joxit
Copy link
Owner

Joxit commented Dec 2, 2018

Hey!

Thank you for your contribution ! 👍

This is a good job, well done 😉

For the v2 API, you can use the object registryUI.DockerImage and add some trigger in getBlobs function.
This is a sample output of blob http://127.0.0.1:5000/v2/{image}/blobs/sha256:{id}

{
  "architecture": "amd64",
  "config": {
    "Hostname": "",
    "Domainname": "",
    "User": "",
    "AttachStdin": false,
    "AttachStdout": false,
    "AttachStderr": false,
    "Tty": false,
    "OpenStdin": false,
    "StdinOnce": false,
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    ],
    "Cmd": [
      "/bin/sh"
    ],
    "ArgsEscaped": true,
    "Image": "sha256:adc791c55308c575fb7c2103801fa03d46ad1c9b9e7942afd47fcf5968d78bc0",
    "Volumes": null,
    "WorkingDir": "",
    "Entrypoint": null,
    "OnBuild": null,
    "Labels": null
  },
  "container": "046231b489fcba3dc42e6424d476762ecc5140a075fefc2c03eace14f143ad58",
  "container_config": {
    "Hostname": "046231b489fc",
    "Domainname": "",
    "User": "",
    "AttachStdin": false,
    "AttachStdout": false,
    "AttachStderr": false,
    "Tty": false,
    "OpenStdin": false,
    "StdinOnce": false,
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    ],
    "Cmd": [
      "/bin/sh",
      "-c",
      "#(nop) ",
      "CMD [\"/bin/sh\"]"
    ],
    "ArgsEscaped": true,
    "Image": "sha256:adc791c55308c575fb7c2103801fa03d46ad1c9b9e7942afd47fcf5968d78bc0",
    "Volumes": null,
    "WorkingDir": "",
    "Entrypoint": null,
    "OnBuild": null,
    "Labels": {}
  },
  "created": "2018-01-09T21:11:19.25867595Z",
  "docker_version": "17.06.2-ce",
  "history": [
    {
      "created": "2018-01-09T21:11:19.026384377Z",
      "created_by": "/bin/sh -c #(nop) ADD file:85ed2ac9d10c6f076a01f29e72b653675994c6fcfb90f0e6b88368c0262893fa in / "
    },
    {
      "created": "2018-01-09T21:11:19.25867595Z",
      "created_by": "/bin/sh -c #(nop)  CMD [\"/bin/sh\"]",
      "empty_layer": true
    }
  ],
  "os": "linux",
  "rootfs": {
    "type": "layers",
    "diff_ids": [
      "sha256:c9e8b5c053a2dda62373bc57fa8cb634230a92ba5f02d2baf5d35b932d04a878"
    ]
  }
}

If you want to retrieve an image blob, you need to use your manifest endpoint with this header Accept:application/vnd.docker.distribution.manifest.v2+json, the blob is in config.digest.
You are right, there is less information in v2 endpoint... 😕

Hahaha, yes, your indentation is well configured 😉

All the best from France

PS: Don't worry, I'm also a backend engineer/DevOPS and not a frontend expert 😉
Riotjs is not the most famous frontend library, but I like it.

src/style.css Show resolved Hide resolved
src/tags/app.tag Outdated Show resolved Hide resolved
src/tags/tag-history-button.tag Outdated Show resolved Hide resolved
src/tags/tag-history.tag Outdated Show resolved Hide resolved
@lennartblom
Copy link
Contributor Author

Hey there! I edited all your change-requests... ✅

The mentioned possible features about fsLayers section and signatures information I would like to put in another pull-requests. Maybe wait for some feedback if it's really worth the effort! :)

@Joxit
Copy link
Owner

Joxit commented Dec 2, 2018

I don't know if fsLayers are interesting here, need to think about it.

The href="#" was troubling the view that the history appeared just for
a few milliseconds... the button with given onclick event does work now.
Copy link
Owner

@Joxit Joxit left a comment

Choose a reason for hiding this comment

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

Last changes I think 😄

src/tags/tag-history.tag Outdated Show resolved Hide resolved
src/tags/tag-history.tag Outdated Show resolved Hide resolved
src/tags/tag-history.tag Show resolved Hide resolved
src/tags/tag-history.tag Outdated Show resolved Hide resolved
src/tags/tag-history.tag Outdated Show resolved Hide resolved
src/tags/tag-history.tag Outdated Show resolved Hide resolved
@lennartblom
Copy link
Contributor Author

Thank you for your code-change requests... good stuff! I think I can manage to implement them untill the upcoming weekend! 👍

@lennartblom
Copy link
Contributor Author

lennartblom commented Dec 6, 2018

Hi Joxit!
I optimised my work. Thanks for your input...

The GUI looks pretty good with your idea of using the following structure:

  • Headline material-card

  • History-Elements n-times material-card

screen shot 2018-12-06 at 21 57 29

And your code improvement suggestion made me do a nice switch-case for the content modification method.

Looks way better with this I think!

function modifySpecificAttributeTypes(attribute, value) {
  switch (attribute) {
    case "created":
      return new Date(value).toLocaleString();
    case "container_config":
    case "config":
      return "";
  }
  return value;
}

What do you think?! 😎

@Joxit Joxit merged commit e89a011 into Joxit:master Dec 8, 2018
@Joxit
Copy link
Owner

Joxit commented Dec 8, 2018

Yeah! That's really nice job! I like this new GUI for history 😄
All is good for me now :) I will release the new version tomorrow.

@lennartblom
Copy link
Contributor Author

Sweet! Nice to hear that! 😍
Really enjoyed working on it and improving it with your brilliant feedback! 🍾 🎉

@Joxit
Copy link
Owner

Joxit commented Dec 9, 2018

I am happy to have helped you in your frontend skills 😄.

I've changed the docker image in a6b6c15, the old one was too detailed.
And I removed _ characters in headers.

image

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.

None yet

2 participants