Record container image information


#1

Hello,

I delayed this one a little and did the recording for machine information first because I hit a little unexpected bump. The idea here is that we want to record information about the image used to create the container for cleanbuild and persistent container builds. However, the problem was that the information about the image is not available inside the container.

Stephan confirmed that the solution was to save the information in the host in an environment variable or file, and send it to the container. So, here it is:

@tyhicks @ratliff in that PR, we are recording the following:

image-info: {fingerprint: 61d54418874f2f84e24ddd6934b3bb759ca76cbc49820da7d34f8b5b778e4816,
  architecture: x86_64, created_at: '2017-10-11T00:00:00Z'}

$ lxc image list shows a lot more things, but you can get all of them with the fingerprint. I added architecture because it seemed handy to me, and Stephan recommended the creation date because the images can be deleted after a while.

Here is the full list of details. Please let me know if you find something else that would be useful to add:

$ lxc image list ubuntu:xenial/amd64 --format=json
[{"auto_update":false,"properties":{"architecture":"amd64","description":"ubuntu 16.04 LTS amd64 (release) (20171011)","label":"release","os":"ubuntu","release":"xenial","serial":"20171011","version":"16.04"},"public":true,"aliases":[{"name":"16.04","description":""},{"name":"16.04/amd64","description":""},{"name":"default","description":""},{"name":"default/amd64","description":""},{"name":"lts","description":""},{"name":"lts/amd64","description":""},{"name":"x","description":""},{"name":"x/amd64","description":""},{"name":"xenial","description":""},{"name":"xenial/amd64","description":""}],"architecture":"x86_64","cached":false,"filename":"ubuntu-16.04-server-cloudimg-amd64-lxd.tar.xz","fingerprint":"61d54418874f2f84e24ddd6934b3bb759ca76cbc49820da7d34f8b5b778e4816","size":163734284,"created_at":"2017-10-11T00:00:00Z","expires_at":"2021-04-21T00:00:00Z","last_used_at":"0001-01-01T00:00:00Z","uploaded_at":"2017-10-11T00:00:00Z"}]