r/devops • • Oct 14 '26

Discussion Is Trunk Based Development possible if an integration test takes too long to run?

I'm proposing my team move from long-lived dev/stg/prd branches to trunk-based development, with PRs straight to main.

I'm fairly new to this, so forgive me if I'm missing something obvious.

The sticking point is testing before merge.

Our current integration test runs the entire DAG end-to-end. This is fine as a single check before merging our test branch (which will contain all commits from developers over the sprint) to main. But it's slow and costly if it were to run as part of every PR. Today we run it manually, check the outputs, then merge.

I am wondering if it’s bad practice to leave this integration test until the end of the sprint. As in, developers merge to main (with some automated checks running as part of each PR before merge), and then when are team want to deploy the sprint changes, first run a single integration test before creating a new release tag In GitHub.

This does mean that main can’t be considered prod ready at all times.

Edit: we’d be using release tags, so for rollbacks we’d rollback to last stable tag. For hotfixes, we would cut from last release, the merge changes to main and create a new release with target set to hotfix branch.

13 Upvotes

55 comments sorted by

View all comments

3

u/taleodor Oct 14 '26

Main being not prod-ready at all times is fine as long as you keep track of what exactly is prod-ready - like mapping specific commits to releases. If you have that, you're able to cut a release branch at any point from that state.

1

u/Data-Panda Oct 14 '26

We will use release tags, which I think covers it? Once a release tag is created, we’ll have an automation that updates our release config (in Dataform) with this latest tag. 

Although I haven’t come up with a hotfix approach yet 

1

u/Crimzx Oct 14 '26

Why would a hotfix be any different?

1

u/Data-Panda Oct 14 '26

I mentioned in an edit on my post what we’d do for a hotfix. 

Concern was that I wanted to create a release with just that hotfix (ignore all other commits that have been added to main since the last release). I think my suggestion in my post edit covers this

1

u/Crimzx Oct 14 '26 edited Oct 14 '26

You can also cherry pick the commit into main which may be cleaner.
So create a branch from the release tag. Put hotfix there. Tag a release from that branch with the hotfix, then cherry pick the hotfix commit back to main.

Maybe you already meant this and it's just semantics though.

I know your question was about tests but just wanted to back ya up that you're thinking about it right.

1

u/Data-Panda Oct 14 '26

Thanks - yes I think that's the same thing. I guess I'm not sure if there's a difference between "merging the hotfix branch into main" and "cherry picking it back to main". I think it's the same thing here?

1

u/Crimzx Oct 14 '26 edited Oct 14 '26

Cherry pick keeps the main line linear where as a merge adds a merge commit, so it just keeps the git history a bit cleaner.
So like if you have version 1.1.0 on main and you are currently running 1.0.0 and 1.1.0 isn't released yet you probably have a version file or something like that. You create the hotfix branch from 1.0 tag, add your 1.0.1 and bump the version in the file.
If you merge this back you now have a merge conflict on the version file to resolve.
Instead you can just cherrypick the hotfix change commit back to main and main stays at 1.1 just now has the 1.0.1 hotfix in it, and your 1.0.1 branch is able to be released as 1.0.1 until 1.1 is released with the hotfix in it as well.

Ultimately though it's a team preference. I've worked places that didn't care about git history and places that REALLY cared about it.