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

Make build date reproducible #229

Merged
merged 1 commit into from Sep 30, 2022

Conversation

jelly
Copy link
Contributor

@jelly jelly commented Sep 27, 2022

To make aardvark-dns bit by bit reproducible the embedded build date needs to adhere to the SOURCE_DATE_EPOCH standard. So a rebuilder can set SOURCE_DATE_EPOCH to the build binary's build date and reproduce the binary succesfully.

https://reproducible-builds.org/docs/source-date-epoch/

Signed-off-by: Jelle van der Waa jelle@archlinux.org


Our reproducible test output before this change: https://reproducible.archlinux.org/api/v0/builds/343291/diffoscope

@flouthoc
Copy link
Collaborator

@jelly Could you please run cargo fmt

To make aardvark-dns bit by bit reproducible the embedded build date
needs to adhere to the SOURCE_DATE_EPOCH standard. So a rebuilder can
set SOURCE_DATE_EPOCH to the build binary's build date and reproduce the
binary succesfully.

https://reproducible-builds.org/docs/source-date-epoch/

Signed-off-by: Jelle van der Waa <jelle@archlinux.org>
@jelly
Copy link
Contributor Author

jelly commented Sep 27, 2022

@jelly Could you please run cargo fmt

Woops, sorry!

let now = Utc::now();
let now = match env::var("SOURCE_DATE_EPOCH") {
Ok(val) => {
let naive = NaiveDateTime::from_timestamp(val.parse::<i64>().unwrap(), 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: The unwrap here will cause build to exit with error so maybe error can be handled here, but since this is only used while performing build so this is looks fine and not worth a repush.

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 unwrap is fine in the build file, I mean what do we want to do with the error anyway.

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

Thanks @jelly , PR LGTM just one non-blocking ( not worth a repush ) nit.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 27, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, jelly

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Luap99
Copy link
Member

Luap99 commented Sep 30, 2022

/lgtm

@Luap99
Copy link
Member

Luap99 commented Sep 30, 2022

@jelly Can you open the same patch against netavark please?

@openshift-merge-robot openshift-merge-robot merged commit 7fa6aa1 into containers:main Sep 30, 2022
16 checks passed
@jelly jelly deleted the reproducible-timestamp branch October 5, 2022 06:54
@jelly
Copy link
Contributor Author

jelly commented Oct 5, 2022

@jelly Can you open the same patch against netavark please?

Sure!

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

4 participants