Skip to content

TeamCity: Add ability to save test log artifacts to all build configurations#8690

Merged
SarahFrench merged 7 commits into
mainfrom
teamcity-add-artifacts
Aug 29, 2023
Merged

TeamCity: Add ability to save test log artifacts to all build configurations#8690
SarahFrench merged 7 commits into
mainfrom
teamcity-add-artifacts

Conversation

@SarahFrench

@SarahFrench SarahFrench commented Aug 17, 2023

Copy link
Copy Markdown
Contributor

This PR adds the ability to make log artefacts (see here for example in old projects) to the new TC projects.

Here's a place I manually tested the code changes in this PR and got log artifacts created per test : https://hashicorp.teamcity.com/buildConfiguration/TerraformProviders_Google_SarahManualTestingProject_GOOGLE_PACKAGE_BILLING/17306?buildTab=artifacts


If this PR is for Terraform, I acknowledge that I have:

Release Note Template for Downstream PRs (will be copied)


@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 2 files changed, 4 insertions(+))
Terraform Beta: Diff ( 2 files changed, 4 insertions(+))

@SarahFrench

SarahFrench commented Aug 17, 2023

Copy link
Copy Markdown
Contributor Author

TODO:

  • Add TF_LOG_PATH_MASK ENV variable
  • Ensure that the TF_LOG_PATH_MASK value, and value I included in the first commit on this PR are still correct for the new projects

Also, need to check other ENVs that may be missing from the new projects - e.g. TF_LOG, TF_OS

@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 16 insertions(+))
Terraform Beta: Diff ( 3 files changed, 16 insertions(+))

2 similar comments
@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 16 insertions(+))
Terraform Beta: Diff ( 3 files changed, 16 insertions(+))

@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 16 insertions(+))
Terraform Beta: Diff ( 3 files changed, 16 insertions(+))

@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 17 insertions(+))
Terraform Beta: Diff ( 3 files changed, 17 insertions(+))

@SarahFrench SarahFrench force-pushed the teamcity-add-artifacts branch from 6732556 to 800bd35 Compare August 24, 2023 18:05
@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 17 insertions(+))
Terraform Beta: Diff ( 3 files changed, 17 insertions(+))


// Set where logs are sent
text("PROVIDER_NAME", providerName)
text("env.TF_LOG_PATH_MASK", "%system.teamcity.build.checkoutDir%/debug-%PROVIDER_NAME%-%env.BUILD_NUMBER%-%s.log")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found info about this ENV here:

Environment variable with path containing the string %s, which is
replaced with the test name, to save separate Terraform logs during
acceptance testing. This value sets TF_LOG_PATH in a safe manner when
executing Terraform CLI commands, which would otherwise be ignored since
it could interfere with how the underlying execution is performed.

@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 4 files changed, 17 insertions(+), 5 deletions(-))
Terraform Beta: Diff ( 3 files changed, 17 insertions(+))

@SarahFrench SarahFrench marked this pull request as ready for review August 24, 2023 19:01
@SarahFrench SarahFrench requested a review from shuyama1 August 24, 2023 19:01
@SarahFrench

Copy link
Copy Markdown
Contributor Author

This build reflects the latest commit that changes the file's extension to .txt, allowing us to open the file in our browsers instead of it downloading automatically: https://hashicorp.teamcity.com/buildConfiguration/TerraformProviders_Google_SarahManualTestingProject_GOOGLE_PACKAGE_BILLING/17701?buildTab=artifacts

@SarahFrench SarahFrench changed the title TeamCity: Add artifact rules to all build configurations TeamCity: Add ability to save test log artifacts to all build configurations Aug 25, 2023
@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 17 insertions(+))
Terraform Beta: Diff ( 3 files changed, 17 insertions(+))

@shuyama1 shuyama1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Not sure if saving the debug log as a text file will have limitation on log length, but I think it's good for now

@SarahFrench

Copy link
Copy Markdown
Contributor Author

Not sure if saving the debug log as a text file will have limitation on log length

Me neither, but I don't think I have the ability to influence if TeamCity opens the file in-browser or makes it download by any other means. If problems do occur I'll revert the files to saving as .log files and they'll need to be downloaded.

@SarahFrench SarahFrench merged commit 630cb71 into main Aug 29, 2023
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Aug 29, 2023
…rations (GoogleCloudPlatform#8690)

* Add `artifactRules` to all build configurations

* Set logging ENVs on builds via `TerraformLoggingParameters`

* Fix copy+paste error in function signature

* Remove space in parameter name

* Add `PROVIDER_NAME`

* Fix logging-related parameters to be environment varaibles, not configuration parameters

* Change log files to use .txt extension, so they open in browser without downloading
@SarahFrench SarahFrench deleted the teamcity-add-artifacts branch September 11, 2023 11:45
RileyHYZ pushed a commit to RileyHYZ/magic-modules that referenced this pull request Sep 15, 2023
…rations (GoogleCloudPlatform#8690)

* Add `artifactRules` to all build configurations

* Set logging ENVs on builds via `TerraformLoggingParameters`

* Fix copy+paste error in function signature

* Remove space in parameter name

* Add `PROVIDER_NAME`

* Fix logging-related parameters to be environment varaibles, not configuration parameters

* Change log files to use .txt extension, so they open in browser without downloading
joelkattapuram pushed a commit to joelkattapuram/magic-modules that referenced this pull request Sep 20, 2023
…rations (GoogleCloudPlatform#8690)

* Add `artifactRules` to all build configurations

* Set logging ENVs on builds via `TerraformLoggingParameters`

* Fix copy+paste error in function signature

* Remove space in parameter name

* Add `PROVIDER_NAME`

* Fix logging-related parameters to be environment varaibles, not configuration parameters

* Change log files to use .txt extension, so they open in browser without downloading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants