6 ms·
Truly immutable builds
- paulddraper 9y agoFYI, the typical phrase here is "hermetic" (sealed, air-tight). Several build systems stress this aspect, include Google's Bazel, in beta.
- saosebastiao 9y agoJust out of curiosity as I've never personally experienced any bugs of the sort, but what is an example of a really nasty bug that someone has experienced that this sort of thing prevents?
- viraptor 9y agoAsterisk discovered licensing issues with their sound files at some point. Instead of updating old packages with .1 at the end of the version, they replaced existing ones in the repo. That caused failures in build systems which verified checksums and suddenly-different builds on systems which didn't.
- joshribakoff 9y agoInherited project running in production, sources in git did not build. Project depended on packages which were present when it was built, but never added to package.json. Code in production was minified. Had to track down a ton of missing npm dependencies. Another example is someone depends on a library, then that library's author deletes it. This is why it may be worth committing your dependency's sources, despite "best practices" dictating otherwise. When someone needs to add a feature 10yrs from now and they only have an incomplete package.json & a copy of minified code, they're in for a world of hell. I even had to recover a project which built non deterministically. Sometimes it would build, sometimes it would error. Running the build several times, it would eventually succeed. The project's author had written their build system against an unstable version of Webpack & Typescript, before they were popular (both of which are now perfectly stable).
- taneq 9y ago> This is why it may be worth committing your dependency's sources, despite "best practices" dictating otherwise. Maybe I'm not a hip young web developer but I've always considered "best practice" to be keeping the currently-in-use version of all of your product's dependencies in a repo (either your main one or a separate 'dependencies' repo). If you update the dependency, you test against the new version and check it in if successful. The idea of letting your build process depend on a third-party library that's downloaded ad-hoc (and may or may not be trustworthy) is terrifying.
- viraptor 9y ago> This is why it may be worth committing your dependency's sources, despite "best practices" dictating otherwise I think you may have misunderstood the best practice here. That best practice is you shouldn't just copy the dep code into your repo. The maintenance/release best practice however is that you should always have a copy of all your dependencies available locally and permanently store them. They're two completely separate rules.
- joshribakoff 9y agoSo are you saying you store them, but not in your version control? What do you mean, like backups of production? What about when production only contains minified / compiled artifacts from the build? Where should I be storing my dependencies? Got any articles to share that elaborate? Or links to open source projects on GitHub that employ the "best practice"? Everyone seems to be just committing bower.json package.json composer.json etc.. & calling it a day.
- viraptor 9y agoBasically don't rely on the external sources. Keep your own repository with the packages you need. Whether that's controlled with git, backups, prepared S3 bucket or other ways is less relevant. The reason stuffing the dependencies with the normal source is bad is you have a huge repo after a while, where most of the size comes from old dep versions you're unlikely to ever use. (But have to clone anyway)
- jonhohle 9y agoMissing: all of the other software on the host (including maven) and the OS itself.
- pmontra 9y agoYes, maybe it doesn't apply to Java but I've been unable to setup projects on a new machine because library versions changed, external programs became hard to build themselves, some sw is impossible to find anymore (I remember a customer with a prehistoric MySQL, we had to find the oldest available bug compatible version and hope - they had no tests), etc. A Vagrantfile or a Dockerfile are not enough. You need the actual images.
- rtpg 9y agoOr in your docker file you specify versions of things to install, check in repos to use, etc etc. It's versions all the way down
- ris 9y agoYou're assuming that all those repos are still around 5 years later.
- rtpg 9y agoDefinitely true. Not sure I am a fan of having every git repo having a copy of everything over and over and over, for "ecological" reasons... But it's probably the best way to endure that your builds will work.
- manyxcxi 9y agoThey are if you mirror the Docker registry. We use Sonatype Nexus and get the added benefit of having our own private Docker, NPM, Maven, etc. repositories on top of automatically caching dependencies we use. So now we don’t have to worry about them disappearing AND we don’t have to leave the network to get them... assuming we don’t screw up our server.
- xchaotic 9y agoI'm not too convinced by this trend of hiding complexity - in this case we should expose the complexity and KISS instead? What good is an immutable/hermetic build going to do if it's broken and you don't know here or how?
- jermo 9y agoI believe "reproducible build" is a more appropriate term. Unfortunately its quite difficult to get a fully reproducible build with Maven as the post points out. Even if you manage to replicate the build environment and settings, Maven produced binaries will be slightly different on each run. File timestamps are saved in jar files so they change on every build.
- gumby 9y ago"Truly immutable" story: at Cygnus we had a phone switch company (DSC) as a customer. They paid us a LOT of money to support a frozen version of the tools (gcc etc). When they found a compiler bug and asked for a fix they would then diff the binaries and use the debugging data to make sure that every delta in the binary was solely a result of the lines of code in the bug fix. They were so hard core about immutability: they had an old code base (Z800? I can no longer remember) that they didn't want to migrate away from even though the hardware was no longer available, so they build an emulator and ran the old code on that on their newer, PPC-based hardware. Newer code ran natively on the PPC). Their concern: they had SLAs with their customers (not SAAS customers, customers who bought the hardware) of no more than two minutes of downtime per decade. Never heard of DSC? Yes, famously their hardware brought part of AT&T's network down for 10 hours or so in the late 90s or early 00s. That was the end of DSC.