twoliter icon indicating copy to clipboard operation
twoliter copied to clipboard

buildsys: add CI/CD hack, fix mtime for external files

Open bcressey opened this issue 1 year ago • 0 comments

Issue number: N/A

Description of changes: Two buildsys changes, one potentially controversial, one hopefully not.

The first is the BUILDSYS_CICD_HACK variable - naming suggestions wanted! - to allow cargo to recreate crates without actually running expensive package builds. It's a hack because it assumes the build directory is fully populated; if it's not, then bad things will happen the next time a package is rebuilt.

The second fixes an edge case related to external files or bundled Go modules; these can end up being tracked by cargo for changes, so we need to ensure that their modification time is no later than the start of the build. Cargo.toml is already tracked for changes and is a useful sentinel for this purpose.

Testing done: Tested in https://github.com/bottlerocket-os/bottlerocket-core-kit/pull/67. With both changes, I was able to reuse cached package builds, touch the files modified by a pull request, and observe that only the affected packages were rebuilt.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

bcressey avatar Aug 13 '24 22:08 bcressey