Skip to content
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

fix(tests): Re-add directory prune to int build config #514

Merged
merged 11 commits into from
Oct 19, 2023
Merged

Conversation

rogerthatdev
Copy link
Contributor

@rogerthatdev rogerthatdev commented Oct 13, 2023

This PR is a 2nd attempt at #508 which was reverted via #512

Reason for reverting the first PR was that the cloud build step used the following to identify what files have changed in the branch corresponding with the PR:
git diff origin/${_BASE_BRANCH}..origin/${_HEAD_BRANCH} --name-only > _changed_files

This did not take into account changes coming from forks. A change from from a fork resulted in an error like this one when identifying changed files:
fatal: ambiguous argument 'origin/main..origin/update-object-table-sample': unknown revision or path not in the working tree.

This is due to the hardcoded origin in the second half of the diff. This error would not cause the test to fail it would assume no files were changed and the int test would skip all files (resulting in a false positive test pass).

This PR simply uses git diff origin/${_BASE_BRANCH} --name-only > _changed_files which in my testing works for changes coming from clones and forks.

@rogerthatdev rogerthatdev requested review from a team as code owners October 13, 2023 20:20
@rogerthatdev rogerthatdev requested a review from a team as a code owner October 13, 2023 20:38
@rogerthatdev rogerthatdev changed the title Int patch fix(tests): Re-add directory prune to int build config Oct 13, 2023
@rogerthatdev rogerthatdev removed the request for review from a team October 13, 2023 20:59
@msampathkumar
Copy link
Contributor

CICD test are running fast. Nice work.

To be sure, can you do any minor edits to one of the existing code?

@rogerthatdev
Copy link
Contributor Author

CICD test are running fast. Nice work.

To be sure, can you do any minor edits to one of the existing code?

See this build job which ran against this commit that changed a sample under the functions subdirectory.

@rogerthatdev rogerthatdev merged commit 2641bd3 into main Oct 19, 2023
msampathkumar added a commit to msampathkumar/terraform-docs-samples that referenced this pull request Dec 7, 2023
…gle-modules#514)

* fix: add directory prune to int build config

* exclude test/

* also prune from lint test

* nevermind lint

* Update build/int.cloudbuild.yaml

Co-authored-by: Sampath Kumar <[email protected]>

* whitespace

* don't use _HEAD_BRANCH in diff

* a test change

* undo test change

---------

Co-authored-by: Sampath Kumar <[email protected]>
@apeabody apeabody deleted the int-patch branch June 4, 2024 18:17
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