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

Propagate SOURCE_DATE_EPOCH from the client env #1482

Merged

Conversation

AkihiroSuda
Copy link
Collaborator

@tonistiigi
Copy link
Member

Could we do it also on bake level so the bake --print would show that these arguments get passed.

build/build.go Outdated
@@ -579,6 +579,13 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
}
}

// Propagate SOURCE_DATE_EPOCH from the client env
if v, ok := os.LookupEnv("SOURCE_DATE_EPOCH"); ok {
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be ok && v != "" as SOURCE_DATE_EPOCH= could be a common way to reset the behavior.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To support SOURCE_DATE_EPOCH=, the condition cannot contain v != "" IIUC

Copy link
Member

Choose a reason for hiding this comment

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

wdym? I'm thinking of the case where environment has SOURCE_DATE_EPOCH defined but the user doesn't want to forward it to the buildkit(user wants buildkit to just use the current time). What should they set?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When the Dockerfile already has ARG SOURCE_DATE_EPOCH=<non empty value>, I'd expect export SOURCE_DATE_EPOCH= to set the build arg to an empty string.

Copy link
Member

Choose a reason for hiding this comment

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

Dockerfile defining SOURCE_DATE_EPOCH is only one possibility. The user might just want to control the timestamps in the config metadata and not the RUN commands.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@AkihiroSuda AkihiroSuda force-pushed the auto-propagate-source-date-epoch branch from 5bd49ef to e1ae109 Compare December 21, 2022 01:17
@AkihiroSuda
Copy link
Collaborator Author

Could we do it also on bake level so the bake --print would show that these arguments get passed.

updated

@AkihiroSuda AkihiroSuda marked this pull request as draft December 21, 2022 01:27
@AkihiroSuda AkihiroSuda force-pushed the auto-propagate-source-date-epoch branch from e1ae109 to 58d644f Compare December 21, 2022 01:41
@AkihiroSuda AkihiroSuda marked this pull request as ready for review December 21, 2022 01:42
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda AkihiroSuda force-pushed the auto-propagate-source-date-epoch branch from 58d644f to 0e6f5a1 Compare December 23, 2022 16:32
@AkihiroSuda
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants