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
Add Git tags support #549
Add Git tags support #549
Conversation
c238c0b
to
e108cd9
Compare
e108cd9
to
074c706
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, but we should add a number of tests for this
e75a1fb
to
ac02684
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great addition of tests, just one more change needed to use ConflictsWith
to keep consistent with the API
0a4a33a
to
e209606
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! I think there are some test failures tho
Is |
3c74d85
to
c9c5f88
Compare
@omarismail @hashimoon Do you think it would be best to land this after the beta flag is removed and the feature is GA? |
73363f0
to
5903494
Compare
75a1f96
to
d55c76c
Compare
@@ -95,6 +95,12 @@ func resourceTfeWorkspaceResourceV0() *schema.Resource { | |||
Type: schema.TypeString, | |||
Required: true, | |||
}, | |||
|
|||
"tags_regex": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
learning: What do we actually migrate here? I would argue that v0 of workspace didn't have tags_regex
. I might be wrong about the purpose of migrations in the tfe provider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I don't think we need this. This is called from here and its about state migration. We don't have tags_regex for in state, so no need to migrate anything.
}, | ||
}, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add another test where we start a new config without tags_regex
, then add it, then delete it
@@ -124,6 +124,7 @@ The `vcs_repo` block supports: | |||
cloning the VCS repository. Defaults to `false`. | |||
* `oauth_token_id` - (Required) The VCS Connection (OAuth Connection + Token) to use. | |||
This ID can be obtained from a `tfe_oauth_client` resource. | |||
* `tags_regex` - (Optional) A regular expression used to trigger a Workspace run for matching Git tags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add that this conflicts with trigger_patterns
and trigger_prefixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple comments regarding:
- Adding another test
- removing the migration
- updating docs
tfe/resource_tfe_workspace_test.go
Outdated
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { | ||
testAccPreCheck(t) | ||
if GITHUB_TOKEN == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is third time these checks are repeated in this file, IMHO it warrants method extraction
d55c76c
to
93b745a
Compare
Updating go-tfe package with pr fixes the current broken test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
I re-ran the tests in SSH so I could extract the GITHUB_WORKSPACE config and cancelling it caused the CI failure. I will straighten it out! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well!
I had some trouble removing the entire vcs_repo config. This did not seem to delete the ingress trigger from the workspace, so tags_regex continues to trigger conflicts with trigger_prefixes etc. I think this problem is not specific to git_tags and probably is a separate provider bug.
Description
Adding support to Git Tags
Testing plan
Use resource like the following:
local.identifier
External links
Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.
Output from acceptance tests
Please run applicable acceptance tests locally and include the output here. See TESTS.md to learn how to run acceptance tests.
If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.