Code Monkey home page Code Monkey logo

Comments (6)

imjasonh avatar imjasonh commented on June 8, 2024

docker/cli#3778 addresses this issue in the Docker CLI, so that images reporting as built before 2000 aren't shown as X years ago, but instead N/A.

When that change is released (assuming December), we should stop bumping the created-at date every day, basically resurrecting chainguard-images/actions#30.

from images.

patflynn avatar patflynn commented on June 8, 2024

Just reading https://www.chainguard.dev/unchained/conquer-your-build-horizon-with-chainguard-enforce-in-2023 I suggest we just use last commit date for our CG images. Could we just do this now?

from images.

imjasonh avatar imjasonh commented on June 8, 2024

Just reading https://www.chainguard.dev/unchained/conquer-your-build-horizon-with-chainguard-enforce-in-2023 I suggest we just use last commit date for our CG images. Could we just do this now?

I thought about this a bit more, and I don't think we can. Or we can, but it might become misleading.

There are roughly two sources of "changes" to an image we build:

  1. the apko.yaml file in the source repo
  2. the packages in the apk repo

Setting SOURCE_DATE_EPOCH=$(git show -s --format=%at HEAD) would make the image's created-at date based only on source updates, basically (1).

The problem is that even if you don't change your apko.yaml in GitHub, requesting a package like packages: ['busybox'] in the config might install busybox-1.34.1-r0 today, but could install busybox-1.35.4-r5 tomorrow. The config contents hasn't changed, but the image contents might have. We'd be ignoring (2). An image could be "created at" a time before one of its packages even existed.

The root of this issue is that, if the source contents haven't changed, and the packages haven't changed, then the timestamp shouldn't change either. This is what we're getting wrong today: identical config+packages still bumps the created-at time, because we always set it to "now".

We could also tie (1) to (2), and always explicitly request packages by exact version (packages: ['busybox-1.34.1.-r0']), but that would get really tedious and brittle and noisy. Nobody wants to live like this.

So ideally we should come up with some way to grab the installed packages' created-at times, and set the image's created-at time to max(commit-time, package-update-times...). I'm not sure the best way to do that today.

edit to add: I think this logic seems sufficiently complex and in need of testing that we should write it in Go instead of Bash. This might be better behavior to bake into apko (possibly as the default?) than to hack together just for our images.

from images.

imjasonh avatar imjasonh commented on June 8, 2024

There's a third source of change: the apko version used to build the image. Luckily we have this in apko's version info.

Also worth considering, now that we build images from the monorepo we need to ignore changes to other files. For (1), instead of "date of last commit" it should be "date of last commit affecting the build config"

Definitely sounds like something apko should be responsible for.

from images.

kaniini avatar kaniini commented on June 8, 2024

keep in mind that SOURCE_DATE_EPOCH needs to be respected regardless, because SBOM data gets embedded in apks

from images.

tuananh avatar tuananh commented on June 8, 2024

The problem is that even if you don't change your apko.yaml in GitHub, requesting a package like packages: ['busybox'] in the config might install busybox-1.34.1-r0 today, but could install busybox-1.35.4-r5 tomorrow.

Would this (chainguard-dev/apko#185) solve that problem?

from images.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.