Rebuild with latest commit

One of the actions I repeat the most is:
- Make some changes on a branch
- Open a previous build on the same branch, and copy the environment variables I entered last time.
- Make a new build, exactly the same except using the latest commit (HEAD).

It’s exactly the same build, except using HEAD instead of an older commit. Rebuild right now correctly reproduces the build when clicking the Rebuild button, but it would be really good to have another button for “rebuilding” with the latest commit.

Maybe it can appear only if the build commit is no longer HEAD.

Thanks for your time!

Hi @ibrar!

Welcome to the community!
We have passed this onto our product team for their consideration.

Thanks for contributing!
Cheers,

I’ve been wishing for something like this recently as well. We have a view pipelines with a input steps that need a few different things entered and selected.

It’s a minor irritation but it it would be nice not to have to repeat the same steps over and over when we just want to pick to the latest commit and re-use everything else exactly as before.

Curious if there’s an update on this? Of if there’s a workaround solution to enable this sort of behavior?

Is there any work around or plugins

Hey folks!

In case you didn’t see it, now when you click on the Rebuild button you have new options:

image

Hi Paula!

This is a nice feature. Its not useful to me, because I still have to copy the custom environment variables I entered in this build.

Any way to add this? So we can rebuild this branch… but with the env vars I used in this build (otherwise its not really a rebuild… its just another build).

Thank you!

Hello, @ibrar! Welcome back to the Community!

What you are trying to do should be possible. Can you please send an URL to the build where you’re seeing an issue to support@buildkite.com?
Best!

Karen

There is a way you can simulate this in a convenient way. Add code in a command step like this:

buildkite-agent annotate '<a href="..." target="_blank">Initiate rebuild with latest</a>' --context ctx-rebuild

For the href embed a URL which will launch a New Build with environment variables pre-populated. The link should look a similar to this:

https://buildkite.com/your-org/your-pipeline#new?message=Rebuild%20with%20latest&branch=master&commit=HEAD&env=NAME_1%3DVALUE_1%0ANAME_2%3DVALUE_2%0A

Getting the escaping right is fiddly, but then it works quite well…

Hey @bretta

Welcome to the Buildkite Community Forums!

Thanks for sharing that trick with the annotations!

Cheers!

Tom