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

[Feature] Add Buildkite build agent #2956

Closed
aidenhaak opened this issue Jan 6, 2022 · 3 comments · Fixed by #2957
Closed

[Feature] Add Buildkite build agent #2956

aidenhaak opened this issue Jan 6, 2022 · 3 comments · Fixed by #2957
Labels
Milestone

Comments

@aidenhaak
Copy link

GitVersion should be able to use Buildkite environment variables to detect the current branch rather than doing some extra checkouts to get out of a detached HEAD state.

Detailed Description

Add a new Buildkite class that extends the BuildAgentBase class. This would allow GitVersion to work more seamlessly when running on a Buildkite agent. Implementation would roughly be:

  • CanApplyToCurrentContext() would check that the $BUILDKITE environment variable is set to true
  • GetCurrentBranch() would return the value that the BUILDKITE_BRANCH environment variable is set to

c.f. Buildkite Environment Variables

Could also be nice to have GitVersion set version info via Buildkite's meta-data - but I'm not sure how good of an idea it is to have GitVersion exec another process...Besides you can always just call it yourself somewhere in your build pipeline like so:

buildkite-agent meta-data set "GitVersion_SemVer" $(gitversion -showvariable SemVer)

Context

By default a Buildkite agent checks out a branch in detached HEAD state. It's possible to work around it via doing this at start of every build:

git checkout $BUILDKITE_BRANCH
git reset HEAD --hard $BUILDKITE_COMMIT

Would be nice for GitVersion to automatically detect the branch name via the built-in $BUILDKITE_BRANCH environment variable.

Possible Implementation

Have a branch ready to PR here: aidenhaak@f9492d6 🙂

@asbjornu
Copy link
Member

asbjornu commented Jan 6, 2022

Pull request welcome! 😃

@aidenhaak
Copy link
Author

Done 👍

@arturcic arturcic added this to the 5.x milestone Jan 13, 2022
@arturcic arturcic modified the milestones: 5.x, 5.8.2 Feb 16, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 5.8.2 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants