Skip to content

CI feature: Reproducible build #8701

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

Merged
merged 19 commits into from
Jan 28, 2019

Conversation

eksperimental
Copy link
Contributor

@eksperimental eksperimental commented Jan 25, 2019

/cc @bmwiedemann

Main issue: #8689
Related PR: #8694

@eksperimental
Copy link
Contributor Author

eksperimental commented Jan 25, 2019

I'm uploading it to see if it works with Travis.

It did locally with this Bash script
https://gist.github.com/eksperimental/d44698b69066958d7bd3554e60566342

UPDATE: it worked in the first go!

Looking forward to hearing your comments

@eksperimental eksperimental changed the title Reproducible build CI feature: Reproducible build Jan 25, 2019
@josevalim
Copy link
Member

@eksperimental I like this a lot. I would just propose to run those changes at the end of the suite, this way we don't need to remove the trailing ebin_reproducible directories and we don't block the test results on this. However, in order to do that, we would need to run make compile after we remove .git the first time around too (which I also think is a good thing to test).

@fertapric
Copy link
Member

Would it make sense to move this into a script so you can run it locally?

@josevalim
Copy link
Member

@fertapric I want to do that but currently there is no good placement for it as travis does not allow us to move the .travis.yml around. They do have an open issue and my plan is to move such scripts as well as the .yml files to a CI directory. We just need to wait a big longer.

@bmwiedemann
Copy link
Contributor

The travis.yml is already running shell commands like make compile, so you can add + call a path/to/new/script

@josevalim
Copy link
Member

We wanted to avoid adding assorted scripts to the repository but I believe the answer is that we can simply add this to the makefile for now. :D

@josevalim
Copy link
Member

josevalim commented Jan 25, 2019

@eksperimental another suggestion, that came up on #8702, is for us to have a specific entry in the test matrix that checks for reproducible long-term builds. In this matrix entry we would:

  1. Do the diff check you perform in this commit right now
  2. Use libfaketime to change the time and run the tests "in the future"

This way we keep those concerns isolated in the CI instead of running them on every OTP version. We can use the latest OTP version on this build.

@eksperimental eksperimental force-pushed the reproducible_build branch 4 times, most recently from 4a4b35f to 7881cfa Compare January 25, 2019 18:05
@eksperimental
Copy link
Contributor Author

Do we want to run tests in the future, or to compile as well?

@eksperimental
Copy link
Contributor Author

I ran faketime ... make test and also compiled it with faketime and withouth faketime, and I get like "9 doctests, 520 tests, 71 failures" when run locally.

It doesn't work. So I would skip it for now.
You can see it the Travis result.
https://travis-ci.org/elixir-lang/elixir/jobs/484525540

@eksperimental
Copy link
Contributor Author

@josevalim can you have a look at this and tell me what would be the cause of the error
https://travis-ci.org/elixir-lang/elixir/jobs/484534189#L755
could it be because we are not running make clear ?

@eksperimental
Copy link
Contributor Author

eksperimental commented Jan 26, 2019

Alright, I 'm done with all the requests. Please have a look.

The new command is make check_reproducible
I wasn't really happy with the idea that we had to pass SOURCE_DATE_EPOCH so I came up with a solution.
We could even run make test check_reproducible and it will work.

Makefile Outdated
$(Q) mv lib/iex/ebin/* lib/iex/ebin_reproducible/
$(Q) mv lib/logger/ebin/* lib/logger/ebin_reproducible/
$(Q) mv lib/mix/ebin/* lib/mix/ebin_reproducible/
SOURCE_DATE_EPOCH="$(call SOURCE_DATE_EPOCH)" $(MAKE) compile
Copy link
Member

Choose a reason for hiding this comment

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

do you want to do a call SOURCE_DATE_EPOCH? If you export above, it is enough, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cannot make it work on Travis.
I had pushed a commit right before you mention this, exporting it.
if it works, i will see If I can avoid passing the variable explicitely

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, i saw the new commit, I think you have to remove the call here for the export to work. I just think though... :D not sure!

@josevalim
Copy link
Member

@josevalim can you have a look at this and tell me what would be the cause of the error
https://travis-ci.org/elixir-lang/elixir/jobs/484534189#L755
could it be because we are not running make clear ?

I am not sure why. If I had to guess, it changed the time for the VM but not for the filesystem operations.

@josevalim
Copy link
Member

@eksperimental I pushed a commit where we can compute the epoch correctly but make is failing for some reason.

@eksperimental
Copy link
Contributor Author

eksperimental commented Jan 26, 2019

@josevalim I'm running ubuntu, but a later version than the one in CI, and this is working differently. exporting variables work locally, maybe it is the GNUMake version that Travis is running.

The problem with your solution is that we need to determine SOURCE_DATE_EPOCH before moving the files from ebin to ebin_reproducible, and then use this value again when compiling the last time.

As I'm writing this the new implementation seems to have worked. So, have a look please

@eksperimental
Copy link
Contributor Author

This is ready to be merged!

@josevalim
Copy link
Member

Two minor comments and we should be good to go!

@eksperimental
Copy link
Contributor Author

Two minor comments and we should be good to go!

done!

@josevalim josevalim merged commit 3d5b341 into elixir-lang:master Jan 28, 2019
@josevalim
Copy link
Member

Amazing, thank you! ❤️ 💚 💙 💛 💜

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

Successfully merging this pull request may close these issues.

4 participants