TeamCity : control branch under test via a configuration parameter#8629
Merged
Conversation
Collaborator
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 3 files changed, 16 insertions(+), 2 deletions(-)) |
SarahFrench
marked this pull request as ready for review
August 11, 2023 20:50
Contributor
Author
|
For anyone to also wanting to manually test this PR:
|
melinath
approved these changes
Aug 11, 2023
melinath
left a comment
Member
There was a problem hiding this comment.
Thanks for the thorough explanation of this PR! LGTM.
Contributor
Author
|
I'll get this merged later today, as it requires a bunch of manual changes in TeamCity to accompany the code change. Thank you for the speedy review! |
SamGerber
pushed a commit
to SamGerber/magic-modules
that referenced
this pull request
Aug 14, 2023
…oogleCloudPlatform#8629) * Add `BRANCH_NAME` parameter to projects. This will be used by the manually-configured VCS root * Update comment above where `BRANCH_NAME` is set
Contributor
Author
|
This is now working in the generic nightly test projects but isn't available in the 5.0.0 testing projects yet |
DanielRieske
pushed a commit
to DanielRieske/magic-modules
that referenced
this pull request
Aug 15, 2023
…oogleCloudPlatform#8629) * Add `BRANCH_NAME` parameter to projects. This will be used by the manually-configured VCS root * Update comment above where `BRANCH_NAME` is set
nevzheng
pushed a commit
to nevzheng/magic-modules
that referenced
this pull request
Aug 16, 2023
…oogleCloudPlatform#8629) * Add `BRANCH_NAME` parameter to projects. This will be used by the manually-configured VCS root * Update comment above where `BRANCH_NAME` is set
rainshen49
pushed a commit
to rainshen49/magic-modules
that referenced
this pull request
Aug 21, 2023
…oogleCloudPlatform#8629) * Add `BRANCH_NAME` parameter to projects. This will be used by the manually-configured VCS root * Update comment above where `BRANCH_NAME` is set
joelkattapuram
pushed a commit
to joelkattapuram/magic-modules
that referenced
this pull request
Sep 20, 2023
…oogleCloudPlatform#8629) * Add `BRANCH_NAME` parameter to projects. This will be used by the manually-configured VCS root * Update comment above where `BRANCH_NAME` is set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In TeamCity we sometimes need to manually trigger ad-hoc, custom builds.
These use cases for this feature:
Currently our new projects do not allow this to happen, and instead there is a singular default branch per project. The nightly tests default to
main, the 5.0.0 test projects default to the feature branch` but this cannot be altered by users for one-off builds.In the old TC projects, this feature was previously possible because there was a configuration parameter called
BRANCH_NAME. The VCS root connection between TeamCity and GitHub was set to use this BRANCH_NAME value when setting the default branch, see%BRANCH_NAME%below:Approaches
Abandoned approach : inheritance from parent projects, no Kotlin DSL code changes
The
BRANCH_NAMEparameter could be inherited by projects controlled by the Kotlin DSL code from a parent project that's manually managed. This would allow the 100% code configured projects to access a BRANCH_NAME value without updating the config code in.teamcity/.However because the default branch isn't the same for all projects we would need to create new parent projects every time a project is made that shouldn't default to using
mainbranch. This mixture of manual and code-controlled projects could get confusing quickly, and would require documentation for HashiCorp members to maintain the projects.Chosen approach : update the Kotlin DSL to set a
BRANCH_NAMEparameter on the project it provisionsThis PR uses the
branchcontext parameter (a value people can edit within a Kotlin DSL-controlled project without issue) to set the BRANCH_NAME configuration parameter. The manually created VCS root will be set to use%BRANCH_NAME%as the default branch.In the code, if the
branchcontext parameter is unset it defaults torefs/heads/main. This means that users will only need to supplybranchvalues when making a project that must default to a branch other than main.Manual testing
This project in TeamCity cloud is set up to use the
teamcity-sarah-test-20230811branch in the downstream GA provider repo, which contains the changes this PR proposes.Manual setup in my test TeamCity project
VCS root

Context parameter

branchThose two manually create things result in the parameter being set (and then inherited by all build configurations inside)

Note: the fact it says overridden (and matches the value above instead of being refs/heads/main) shows the code worked
Triggering a custom build that tests a different branch than the default branch
Normally, all builds in that project will use
refs/heads/teamcity-sarah-test-20230811for all builds, as it's the default branch.I created a branch called
teamcity-test-add-random-testthat adds a new testTestAccSarah_please_work_pls(yep, really) to acctest package in the GA provider repository.I then navigated to the acctest package's build configuration in my test project and triggered a new run of the build with customised parameters so that the build would use my branch above, and only look for the new test I added:
and the test was both successfully found and passed :)
Here is the link to that customised build.
Release Note Template for Downstream PRs (will be copied)