-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 stage action namespace to resource_aws_codepipeline #11910
Conversation
@bflad Could this get some attention? It's been waiting a long time and seems to have a lot of support. |
Hi @jacobisaliveandwell 👋 There are some inflight changes to the After that's been merged, we can take a look at this one. Thanks. |
@suchpuppet would you be able to resolve conflicts please? Now that #12549 has been merged this can proceed. Thanks for making the change, btw. It's needed like air. |
This comment has been minimized.
This comment has been minimized.
@ilyalukyanov Sorry for the delay. Been busy. Conflicts have been resolved. Thanks for getting attention on this change as well. |
t.Skip("Environment variable GITHUB_TOKEN is not set") | ||
} | ||
|
||
var p1, p2 codepipeline.PipelineDeclaration |
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.
Lint is failing because p2 is declared but never used
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.
Thanks. I'll remove that.
resource.TestMatchResourceAttr(resourceName, "arn", | ||
regexp.MustCompile(fmt.Sprintf("^arn:aws:codepipeline:[^:]+:[0-9]{12}:test-pipeline-%s", name))), |
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.
can you change this to use testAccMatchResourceAttrRegionalARN
instead?
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.
Updated
aws/resource_aws_codepipeline.go
Outdated
@@ -434,6 +442,10 @@ func flattenAwsCodePipelineStageActions(actions []*codepipeline.ActionDeclaratio | |||
values["region"] = *action.Region | |||
} | |||
|
|||
if action.Namespace != nil { | |||
values["namespace"] = *action.Namespace |
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.
can you change this to values["namespace"] = aws.StringValue(action.Namespace)
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.
Updated
Config: testAccAWSCodePipelineConfigWithNamespace(name), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckAWSCodePipelineExists(resourceName, &p1), | ||
resource.testAccMatchResourceAttrRegionalARN(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:aws:codepipeline:[^:]+:[0-9]{12}:test-pipeline-%s", name))), |
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.
To fix the linting/tests in Travis, I believe you need to remove the resource.
prefix and add a third argument with the value of "codepipeline"
here:
testAccMatchResourceAttrRegionalARN(resourceName, "arn", "codepipeline", regexp.MustCompile(fmt.Sprintf("^arn:aws:codepipeline:[^:]+:[0-9]{12}:test-pipeline-%s", name))),
@bflad It looks like this can move forward now that #12549 is merged. I'm not sure what the right etiquette is for moving someone else's PR (@suchpuppet) forward but I'm available to help however I can. |
FWIW, I've filed a PR for @suchpuppet 's fork: suchpuppet#1 ...using my fix for the Travis lint/test stages: nl-brett-stime@b6dfbb9 |
Fixes testAccMatchResourceAttrRegionalARN
…ipelineWithNamespace
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.
Thanks so much for this, @suchpuppet 🚀
Output from acceptance testing:
--- PASS: TestResourceAWSCodePipelineExpandArtifactStoresValidation (0.00s)
--- PASS: TestAccAWSCodePipelineWithNamespace (28.70s)
--- PASS: TestAccAWSCodePipeline_deployWithServiceRole (32.42s)
--- PASS: TestAccAWSCodePipelineWebhook_basic (38.44s)
--- PASS: TestAccAWSCodePipelineWebhook_UpdateAuthenticationConfiguration_SecretToken (38.75s)
--- PASS: TestAccAWSCodePipeline_emptyArtifacts (41.79s)
--- PASS: TestAccAWSCodePipeline_multiregion_basic (45.82s)
--- PASS: TestAccAWSCodePipelineWebhook_unauthenticated (48.52s)
--- PASS: TestAccAWSCodePipelineWebhook_ipAuth (52.47s)
--- PASS: TestAccAWSCodePipelineWebhook_tags (52.76s)
--- PASS: TestAccAWSCodePipeline_basic (57.69s)
--- PASS: TestAccAWSCodePipeline_tags (60.91s)
--- PASS: TestAccAWSCodePipeline_multiregion_Update (66.88s)
--- PASS: TestAccAWSCodePipeline_multiregion_ConvertSingleRegion (69.45s)
This has been released in version 2.59.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Closes #11418
Release note for CHANGELOG:
Output from acceptance testing:
The ability to use namespace in build actions is necessary to be able to do things like use the Github provider and reference the BranchName from the source stage. I ran into this when trying to use a Lambda to dynamically create pipelines similar to what is shown here: https://github.com/nicolai86/awesome-codepipeline-ci
When using the GitHub source provider, it wasn't possible to do that because I was not able to use namespaced variables from the source stage in the build stage without the updates in this pull request. When testing the updates in the pull request out, the pipeline was successfully created with the proper variable namespace and my build stage was able to use them.