Conversation
✅ Deploy Preview for chef-inspec canceled.
|
ecd1ebb to
e28f0fe
Compare
…re git is not initialized or does not contain the .git directory Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
…ld clone the repo and checkout the default HEAD Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
… is not provided as it's not required logically as we will be cloning the and checkout the default HEAD Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
…vert once the work is done for the git fetcher fix Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
…h does not exist make sure it deletes the cache directory created to copy the cloned repo. It raises error if any git command fails Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
…fted that to resolve_ref which is already raising the error in case of git ls remote command fails Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
4635788 to
be47ce7
Compare
Nik08
reviewed
Aug 31, 2023
| def checkout(dir = @repo_directory) | ||
| clone(dir) | ||
| git_cmd("checkout #{resolved_ref}", dir) | ||
| if resolved_ref.nil? |
Contributor
There was a problem hiding this comment.
Maybe if we can add a comment on these conditions, it will be useful to determine the scenarios in future.
Nik08
approved these changes
Aug 31, 2023
Contributor
Nik08
left a comment
There was a problem hiding this comment.
Great tests, looks good to me. We can maybe just add few more comments to remember the scenarios we just handled
…or ref is not given and unit test for invalid git repo Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
be47ce7 to
76aec92
Compare
clintoncwolfe
approved these changes
Aug 31, 2023
Vasu1105
added a commit
that referenced
this pull request
Aug 31, 2023
…ory does not have .git directory (#6626) * Functional Test to verify git fetcher able to work in a directory where git is not initialized or does not contain the .git directory Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> * Fix: If git branch, tag or reference information is not given it should clone the repo and checkout the default HEAD Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> * Remove the logic to find default branch in case of branch, tag or ref is not provided as it's not required logically as we will be cloning the and checkout the default HEAD Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * This is a temporary change to make verify test working on this PR. Revert once the work is done for the git fetcher fix Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Unit Test: Fix unit test Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Verifies the git url before creating cache_key, if given relative path does not exist make sure it deletes the cache directory created to copy the cloned repo. It raises error if any git command fails Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Reverted verify git repo url call from cache_key as cache_key and shifted that to resolve_ref which is already raising the error in case of git ls remote command fails Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Unit test to cover the changes done for resolve_ref when branch, tag or ref is not given and unit test for invalid git repo Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> --------- Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
4 tasks
Vasu1105
added a commit
that referenced
this pull request
Sep 1, 2023
…ory does not have .git directory (#6626) (#6640) * Functional Test to verify git fetcher able to work in a directory where git is not initialized or does not contain the .git directory * Fix: If git branch, tag or reference information is not given it should clone the repo and checkout the default HEAD * Remove the logic to find default branch in case of branch, tag or ref is not provided as it's not required logically as we will be cloning the and checkout the default HEAD * This is a temporary change to make verify test working on this PR. Revert once the work is done for the git fetcher fix * Unit Test: Fix unit test * Verifies the git url before creating cache_key, if given relative path does not exist make sure it deletes the cache directory created to copy the cloned repo. It raises error if any git command fails * Reverted verify git repo url call from cache_key as cache_key and shifted that to resolve_ref which is already raising the error in case of git ls remote command fails * Unit test to cover the changes done for resolve_ref when branch, tag or ref is not given and unit test for invalid git repo --------- Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
Nik08
pushed a commit
that referenced
this pull request
Oct 1, 2023
…ory does not have .git directory (#6626) * Functional Test to verify git fetcher able to work in a directory where git is not initialized or does not contain the .git directory Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> * Fix: If git branch, tag or reference information is not given it should clone the repo and checkout the default HEAD Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> * Remove the logic to find default branch in case of branch, tag or ref is not provided as it's not required logically as we will be cloning the and checkout the default HEAD Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * This is a temporary change to make verify test working on this PR. Revert once the work is done for the git fetcher fix Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Unit Test: Fix unit test Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Verifies the git url before creating cache_key, if given relative path does not exist make sure it deletes the cache directory created to copy the cloned repo. It raises error if any git command fails Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Reverted verify git repo url call from cache_key as cache_key and shifted that to resolve_ref which is already raising the error in case of git ls remote command fails Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Unit test to cover the changes done for resolve_ref when branch, tag or ref is not given and unit test for invalid git repo Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> --------- Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
4 tasks
Vasu1105
added a commit
that referenced
this pull request
Oct 1, 2023
…ory does not have .git directory (#6626) (#6750) * Functional Test to verify git fetcher able to work in a directory where git is not initialized or does not contain the .git directory * Fix: If git branch, tag or reference information is not given it should clone the repo and checkout the default HEAD * Remove the logic to find default branch in case of branch, tag or ref is not provided as it's not required logically as we will be cloning the and checkout the default HEAD * This is a temporary change to make verify test working on this PR. Revert once the work is done for the git fetcher fix * Unit Test: Fix unit test * Verifies the git url before creating cache_key, if given relative path does not exist make sure it deletes the cache directory created to copy the cloned repo. It raises error if any git command fails * Reverted verify git repo url call from cache_key as cache_key and shifted that to resolve_ref which is already raising the error in case of git ls remote command fails * Unit test to cover the changes done for resolve_ref when branch, tag or ref is not given and unit test for invalid git repo --------- Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> Co-authored-by: Vasundhara Jagdale <vasundhara.jagdale@chef.io>
Nik08
pushed a commit
that referenced
this pull request
Sep 13, 2024
…ory does not have .git directory (#6626) * Functional Test to verify git fetcher able to work in a directory where git is not initialized or does not contain the .git directory Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> * Fix: If git branch, tag or reference information is not given it should clone the repo and checkout the default HEAD Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> * Remove the logic to find default branch in case of branch, tag or ref is not provided as it's not required logically as we will be cloning the and checkout the default HEAD Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * This is a temporary change to make verify test working on this PR. Revert once the work is done for the git fetcher fix Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Unit Test: Fix unit test Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Verifies the git url before creating cache_key, if given relative path does not exist make sure it deletes the cache directory created to copy the cloned repo. It raises error if any git command fails Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Reverted verify git repo url call from cache_key as cache_key and shifted that to resolve_ref which is already raising the error in case of git ls remote command fails Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> * Unit test to cover the changes done for resolve_ref when branch, tag or ref is not given and unit test for invalid git repo Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com> --------- Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io> Signed-off-by: Vasu1105 <vasundhara.jagdale@progress.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This fixes #6064 for git fetcher (inspec git fetcher requires the $pwd to be a git repo)
This PR includes a bug fix in the git fetcher
git remote showcommand that requires the current directory to be git repo and was causing the git fetch to fail in case the current directory does not have .git directory.Test covering the failure https://buildkite.com/chef-oss/inspec-inspec-inspec-5-verify/builds/16#018a265e-c1fd-49b5-9562-c2575be5ee8d/710-731 (surprisingly currently this is only failing on ruby 3.1) Note: this reference is from my earlier PR which I opened against the inspec-5 branch.
Passing Test after fix:
https://buildkite.com/chef/inspec-inspec-main-verify-private/builds/66
Related Issue
Types of changes
Checklist: