-
Notifications
You must be signed in to change notification settings - Fork 12
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
Support per branch builds and previous build comparison #117
Comments
Hello @dbason, cool, thank you for the feedback. It's great to hear that baur is also useful for you. :-) Could you elaborate on why you want to rebuild an application and rerun it through CI if the code did not change?
How do you find the last build in the branch? Do you also store the branch in the database with the past builds? |
Sure, the simplest answer is that it's a tradeoff we have accepted for simplicity. Our deployment process is triggered by a successful build so fundamentally we want to trigger that process whenever the code has changed from the previous deploy. Our major use of baur is to calculate which components need to be built in a mono repo. From there we actually pass off Jenkins to do the builds as we have a number of pipeline steps with integrations for things like static code analysis and security scanning, so unfortunately baur doesn't have access to the full build metadata. We also stamp the code with a semver that includes the git commit hash at build time, this is for auditing purposes, so we do want to produce a new build with the correct commit hash on it. Also because we only keep a limited number of builds in artifactory we can't guarantee that the old build artifact will still be available.
Yeah we have two optional command line flags, one for the branch to store the build against and compare against, and one to compare against if there are no previous builds for a branch. We store the branch as an additional column in the database. The column is filled in with a default if you choose not to use that functionality so it won't affect the existing use. The initial changes we have made were against 0.16.0. I'm just working through the refactor from 0.17.x now so once I've done that you can take a look at the code changes if you like. |
@dbason ok, thanks for the explanation and the PR. |
We welcome your contribution and discussed it internally and were not entirely sure if we understand the motivation behind the proposal correctly. The following is a summary of my understanding of how you are using baur. In you git repository for each application an So you are using baur to compare changes between branches on application level to figure out what changed via ( thanks and have a nice weekend! Update: To be able to compare the build status with the base branch. You have to do a |
So we do use baur build, but the build command just touches a file. From there the jenkins job checks the existence of those files and if they exist kicks off the build pipeline for that app.
When a pull request is opened we want to build the apps that the pull request has changed. We stamp these with a test version and they get deployed out to a test environment. When the pull request gets merged to master we want to build anything that has changed from the last build against master branch, and these get stamped with an rc version and deployed out to a CI environment, and then out to production environments. I hope that clarifies things |
Yes, I think we got it now. Thanks! We would like to propose another idea for a feature that should solve your
To rebuild all apps that changed in master after a merge you could run: baur build --additional-input-str=master To rebuild all apps in a branch that changed compared to master you could run: baur build --additional-input-str=feature-x --lookup-additional-input-str-fallback=master We could also support setting the parameters via environment variables. @dbason What do you think about the idea? Would it work for you usecase? |
Yeah I think that's a good idea, and it should fit our use case. Would you be happy to keep the option in the app configuration to only compare against the last build? |
@dbason cool :-) I think it does not align well with the main goal of baur to avoid unnecessary rebuilds. |
We could add a command to diff the inputs of an application, then it is simple to script the functionality to rebuild if the last build differs easily, like:
The |
Sure that would also work for us. That;s basically what the attribute is doing any way. The primary use case for this is for if some code has been reverted. We want to build it to trigger the deployment process, and we can't pull the information about the previously build artifacts (and we can't guarantee they still exist). |
@fho would you like me to modify my PR to reflect these changes? |
@dbason I created 2 issues for the discussed changes:
I'll close this issue and you PR for now. It would be great if you can help with the implementation and create PRs for those. We should do the implementation in separate PRs per issue against the master branch. As you noted the baur version in the master branch is different then the last release. Builds are replaced with more generic Task definitions, the database schema will be very different. thanks for your help! |
Hi,
First off I would just like to say thanks for this project, we've found it really useful. We currently have a fork that we are using for our specific use case, and are wondering if you would accept a PR to support this. Our use case is as follows:
We currently use Jenkins, Artifactory, and Spinnaker to support a CI/CD work flow. Every time the code changes (even if it is reverting previous change) we want to produce a new artifact that we can then pass through our CD pipelines. The versioning uses semver with the short commit hash as metadata. To support this we have introduced a config option in to baur to just look at the last build when comparing the digests.
We also use the CI pipeline to build and deploy pull requests, and we would like these to be tracked separately to the mainline build. This means that we trigger a build when the PR gets merged to master as the digests are tracked separately
The text was updated successfully, but these errors were encountered: