开发者

Saving built binaries into a SCM

开发者 https://www.devze.com 2023-03-26 18:38 出处:网络
No doubt about saving src code into SCM, but what about the generated 开发者_JAVA技巧builds ? Instead having them into a file system, would be a good practice to save them into a SCM considering that

No doubt about saving src code into SCM, but what about the generated 开发者_JAVA技巧builds ? Instead having them into a file system, would be a good practice to save them into a SCM considering that you have many customers with diff versions and within reach ?


You should not store generated binaries in version control. They should be the output of compiling and bundling the source code in your repository using the build scripts in your repository. If your builds are not reproducible for some reason, go fix the cause. Don't abuse version control by applying it to artifacts that don't evolve.

Note that this is all with reference to your binaries. If you have external dependencies, it is sometimes reasonable to keep them under version control, as they are inputs to your build process. This would be things like third-party libraries or toolchain components.

If you just need a backup of what you've shipped to customers, drop complete images or archives in the same backed-up file system that you keep your repository on. There's nothing special about keeping them in a VCS's extra layer of packaging on top of the file system. If anything, that's less reliable, as there's one more point of possible corruption. In either case, if you care about the integrity of those archived builds, you should take cryptoographic hashes of them when they ship, and record those alongside the archives, so that you can verify them later. If you're being really paranoid, sign the checksum file with a private key that's not kept on that file server.


Of course you won't be able to view diffs of the binaries, but any kind of file can be put into version control.

I've never had a problem with binaries in SVN, but if you aren't careful, in some other SCMs (Git, possibly others) they may become corrupted.

If you're using SVN, another thing to consider is that anytime you upload a new version of the binary, the amount of space used by your repo will grow by as much as the size of the binary. This happens because it doesn't really make sense to diff binaries, so every successive copy has to be stored whole. So if server secondary storage space is an issue, or your binaries are large, you may want to consider an alternative solution.

So... are you using SVN? :)


It's not recommended to save generated artifacts into SCM.

Don't know what kind of program you're developing, for Java project, the good practice is using Maven to build and storing artifacts into Maven Repository. Please read this article for more about Maven Repository and why not put binaries into SCM.

0

精彩评论

暂无评论...
验证码 换一张
取 消