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

/cnb/lifecycle/creator with SOURCE_DATE_EPOCH env var not working #943

Closed
uqix opened this issue Oct 26, 2022 · 6 comments
Closed

/cnb/lifecycle/creator with SOURCE_DATE_EPOCH env var not working #943

uqix opened this issue Oct 26, 2022 · 6 comments
Labels
status/triage type/bug Something isn't working

Comments

@uqix
Copy link

uqix commented Oct 26, 2022

Summary

According to the spec here https://github.com/buildpacks/spec/blob/main/platform.md#exporter, I try to pass SOURCE_DATE_EPOCH env var to /cnb/lifecycle/creator:

SOURCE_DATE_EPOCH=$(date -d $CI_COMMIT_TIMESTAMP +%s) /cnb/lifecycle/creator \
  -app=$module_dir \
  -cache-image=$cache_image \
  -skip-restore=$skip_restore \
  -run-image=$run_image \
  $extra_creator_flags \
  $image

but the creation date of the resulting image is still 01/01/1980.


Reproduction

Steps
  1. SOURCE_DATE_EPOCH=... /cnb/lifecycle/creator ...
Current behavior

Image creation date = 01/01/1980

Expected

Image creation date = <SOURCE_DATE_EPOCH>


Context

lifecycle version

paketobuildpacks/builder:0.3.45-base

https://github.com/paketo-buildpacks/base-builder/releases/tag/v0.3.45

Lifecycle:
  Version: 0.14.1
  Buildpack APIs:
    Deprecated: (none)
    Supported: 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8
  Platform APIs:
    Deprecated: (none)
    Supported: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9
platform version(s)

0.9

anything else?
@uqix uqix added status/triage type/bug Something isn't working labels Oct 26, 2022
@jjbustamante
Copy link
Member

jjbustamante commented Oct 26, 2022

@uqix Did you try setting the environment variable CNB_PLATFORM_API to 0.9?

The reason I ask is that is the only missing thing I noticed in the code to decide to use the SOURCE_DATE_EPOCH value

@uqix
Copy link
Author

uqix commented Oct 27, 2022

@jjbustamante Following your tips fixed the image creation date issue, but the build output files' timestamps are still zero:

image

@sambhav
Copy link
Member

sambhav commented Oct 27, 2022

@uqix that is expected. The SOURCE_DATE_EPOCH only applies to the OCI config/metadata files.

@uqix
Copy link
Author

uqix commented Oct 27, 2022

@samj1912 thanks, so any tip for this issue?

@natalieparellano
Copy link
Member

In theory we could in the future allow buildpacks to set metadata on a per-layer basis to have the lifecycle omit zeroing the timestamps for particular layers. But this would require an RFC...

@uqix
Copy link
Author

uqix commented Oct 31, 2022

I see, I misunderstood the SOURCE_DATE_EPOCH at the very first, close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/triage type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants