terraform-docs-samples icon indicating copy to clipboard operation
terraform-docs-samples copied to clipboard

ci: refine PR tests to exclude unchanged complex examples

Open glasnt opened this issue 1 year ago • 5 comments

TL;DR

Identified in 773, debugged in https://github.com/terraform-google-modules/terraform-docs-samples/pull/777

After changes in https://github.com/terraform-google-modules/terraform-docs-samples/pull/669, there are still samples that aren't pruned. This increases the CI execution time

Expected behavior

No response

Observed behavior

No response

Terraform Configuration

build/int.cloudbuild.yaml

Terraform Version

cloud-foundation-toolkit latest

Additional information

No response

glasnt avatar Dec 09 '24 23:12 glasnt

Example remaining folders:

looker/ et al contains test.yaml files, so samples are validated but not executed (slight increase to CI exec time) functions/ contains reference code (.js, package.json), so samples are executed completely (and failing in 777 exec)

glasnt avatar Dec 09 '24 23:12 glasnt

@apeabody confirming your intent on 669, this comment was added to the code:

Remove leaf folders without changes or non-tf resources

Do you intend to always test samples with test.yaml files? Always samples with other artifacts?

glasnt avatar Dec 10 '24 02:12 glasnt

@apeabody confirming your intent on 669, this comment was added to the code:

Remove leaf folders without changes or non-tf resources

Do you intend to always test samples with test.yaml files? Always samples with other artifacts?

Hey @glasnt! I'd have to refresh my memory, but the intention was to avoid deleting non-TF test artifacts that are (commonly) in sub-directories below the TF code itself. Likely the logic can/should be improved. :) At the very least it should be safe to delete folders with test.yaml as those are not per say test artifacts.

apeabody avatar Dec 10 '24 17:12 apeabody

There may be a new general solution on this coming from my team, but in the mean time, I will address some of the more flaky resource-heavy tests as to try and streamline the process for other PRs

glasnt avatar Dec 11 '24 21:12 glasnt

There may be a new general solution on this coming from my team, but in the mean time, I will address some of the more flaky resource-heavy tests as to try and streamline the process for other PRs

As a quick fix, I was thinking we could first run the original logic to purge root level directories with zero changes, and then depend on the new logic just to clean the remaining directories further. Likely still some edge cases, but that would give us at least the best of both right in the meantime.

apeabody avatar Dec 11 '24 21:12 apeabody