Skip to content
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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Support proper trunk flow #675

wants to merge 14 commits into from

Conversation

gitstart-app[bot]
Copy link
Contributor

@gitstart-app gitstart-app bot commented Nov 12, 2024

@gitstart-tramline
Copy link

PR is still in progress and not ready for review yet

@gitstart-tramline
Copy link

Hi @kitallis, PR is ready for review. Please review.

Copy link
Member

@kitallis kitallis left a 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:

  1. 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 for HEAD+N commits
  2. 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).
  3. 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. Screenshot 2024-12-03 at 10 04 45 PM
  4. 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.
Screenshot 2024-12-03 at 9 34 12 PM

Copy link
Member

@kitallis kitallis left a 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.

Copy link
Member

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.

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

Copy link
Member

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.

Comment on lines 110 to 111
before_create :set_release_branch, if: -> { branching_strategy == "trunk" }
before_create :set_build_queue_values, if: -> { branching_strategy == "trunk" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Copy link
Member

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.

@@ -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?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return unless version_bump_required? || train.trunk?
return if train.trunk?
return unless version_bump_required?

Better to not chain conditionals with unless

Comment on lines 5 to 14
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
Copy link
Member

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.

Comment on lines 5 to 15
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
Copy link
Member

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?

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

@gitstart-tramline
Copy link

Thank you for the review. We will work on the changes and get back to you.

@gitstart-tramline
Copy link

Hi @kitallis, we have updated the PR to fix the functional and structural issues you mentioned above.
https://www.loom.com/share/380b57a1a5a943459cc0405c071c7bc0

Please review the PR. Thanks

@gitstart-tramline
Copy link

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 for HEAD+N commits

The flow has been changes to achieve this.

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).

This could not be achieved since the GitHub API requires the branch name or tag as mentioned here

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.

This was attended to.

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.

This was fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support proper trunk flow
3 participants