Skip to content

Adds CodeBuild support for builds that are not initiated via a webhook #2468

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

Merged
merged 3 commits into from
Nov 30, 2020

Conversation

carcer
Copy link
Contributor

@carcer carcer commented Nov 28, 2020

The current CodeBuild support only supports retrieving the branch when a build has been initiated via a webhook, mainly GitHub. There are other use cases when a this environment variable will not be populated, and branch name is available via the CODEBUILD_SOURCE_VERSION variable. This PR updates the CodeBuild agent to also check this environment variable.

This does result in a difference from the other build agents, as this involves 2 possible environment variables.

Description

Updates the CodeBuild agent to check the CODEBUILD_SOURCE_VERSION if the value from CODEBUILD_WEBHOOK_BASE_REF is null or empty. Overloads the base class so it no longer uses the EnvironmentVariable property, as there are 2 variables to be checked. Throws an exception if the property is accessed

Motivation and Context

We want to use GItVersion within CodeBuild from builds initiated from Jenkins that are initiated via webhook

How Has This Been Tested?

Added additional unit tests and confirmed they pass

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Sorry, something went wrong.

@carcer carcer requested a review from asbjornu November 29, 2020 22:00

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@asbjornu asbjornu added this to the 5.5.2 milestone Nov 30, 2020
@asbjornu asbjornu merged commit a886921 into GitTools:master Nov 30, 2020
@asbjornu
Copy link
Member

Thanks for your contributions, @carcer! 🙏

@github-actions
Copy link

🎉 This issue has been resolved in version 5.6.0 🎉
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants