-
Notifications
You must be signed in to change notification settings - Fork 15
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 proper trunk flow #675
base: main
Are you sure you want to change the base?
Conversation
PR is still in progress and not ready for review yet |
Hi @kitallis, PR is ready for review. Please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Initial comments, before I review the code. I tested it out and there's a few functional issues:
- As soon as we start the release with Trunk, we should trigger the release for the
HEAD
of the working branch and not wait for a commit to show up before starting. The flow for when a commit lands and needs to be applied through the queue is correct, but should only happen forHEAD+N
commits - The workflow runs are not being correctly found in trunk mode, they only seem to be found when the tag is used instead of the release branch. I tested this. The culprit is here. Perhaps we should only look for it via the commit SHA? We'll have to test this for Bitbucket and GitLab as well (I haven't done so yet).
- We should disable all automations at the end. This flow breaks currently when you reach the end of the release. The
FinalizeRelease
should early return perhaps. - We should not show this message in the finale phase and instead say something like the following in that card:
Since we're doing a trunk-based branching strategy, there's no end-of-release housekeeping required on Tramline's end. We'll just refresh the DevOps reports and charts for you after the release is complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are a lot of structural issues with this, which I've called out. I haven't proceeded beyond this structural review, since this needs to change first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: not sure I understand the point of this, why can't we reuse ProcessCommits
? It's the exact same code with a small difference of: no "rest" commits and skipping immediate application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to keep it seperate as the handled different scenarios. The file has since been discarded and ProcessCommits is being reused
app/jobs/create_version_tag_job.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: this is entirely dead code.
app/models/train.rb
Outdated
before_create :set_release_branch, if: -> { branching_strategy == "trunk" } | ||
before_create :set_build_queue_values, if: -> { branching_strategy == "trunk" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before_create :set_release_branch, if: -> { branching_strategy == "trunk" } | |
before_create :set_build_queue_values, if: -> { branching_strategy == "trunk" } | |
before_create :set_release_branch, if: :trunk? | |
before_create :set_build_queue_values, if: :trunk? |
app/libs/triggers/trunk.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: this is entirely dead code.
app/models/release_platform_run.rb
Outdated
@@ -286,7 +286,7 @@ def update_last_commit!(commit) | |||
end | |||
|
|||
def bump_version! | |||
return unless version_bump_required? | |||
return unless version_bump_required? || train.trunk? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return unless version_bump_required? || train.trunk? | |
return if train.trunk? | |
return unless version_bump_required? |
Better to not chain conditionals with unless
if release_platform_run.release.release_platform_runs.all? { |run| run.internal_releases.exists?(commit: commit) } && | ||
release_platform_run.train.trunk? | ||
|
||
tag_name = "v#{release_platform_run.release_version}" | ||
release_platform_run.train.create_tag!(tag_name, commit.commit_hash) | ||
|
||
release_platform_run.release.release_platform_runs.each do |run| | ||
run.update!(tag_name: tag_name) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: I think this creation & updating of tag should happen during the application of the commit, not here. This is about creating internal releases and its details. The tagging is about the commit, not about the builds.
if release_platform_run.release.release_platform_runs.all? { |run| run.beta_releases.exists?(commit: commit) } && | ||
release_platform_run.train.trunk? | ||
|
||
tag_name = "v#{release_platform_run.release_version}" | ||
release_platform_run.train.create_tag!(tag_name, commit.commit_hash) | ||
|
||
release_platform_run.release.release_platform_runs.each do |run| | ||
run.update!(tag_name: tag_name) | ||
ReleasePlatformRuns::TriggerWorkflowJob.perform_later(run.id, commit.id) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: the same issue applies here, as internal releases, but I'm also not certain what the need of triggering workflow job is here? The workflow run is normally triggered here anyway.
Could you help me understand the reasoning behind this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wrong approach was used when this was implemented. This has now been changed and it no longer handles the logic for creating and updating tags
Thank you for the review. We will work on the changes and get back to you. |
Hi @kitallis, we have updated the PR to fix the functional and structural issues you mentioned above. Please review the PR. Thanks |
The flow has been changes to achieve this.
This could not be achieved since the GitHub API requires the branch name or tag as mentioned here
This was attended to.
This was fixed |
- store tag_name on commits, show tags for commits - move pre-release and post-release lpgic to trunk handlers - create post-release vcs release from last existing tag
Closes #548
Add trunk branching strategy
Loom
https://www.loom.com/share/7390db10eb874dca8a29f30ec92a0c34?sid=bf1a52d2-af90-4b28-9a4e-bde5609b5b5b