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 regression: can fetch branches and tags references without specifying commit hashes for private git repository used as context #1823

Conversation

gcalmettes
Copy link
Contributor

Fixes #1801

Description

This PR fixes a regression introduced in #1765 (PR released in v1.7.0) that led to the need of always specifying a commit hash even for tags or branches references, when a git source context was used.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Adds integration tests if needed.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

@gcalmettes
Copy link
Contributor Author

Rescan needed from a repository manager (post CLA signature). Thanks !

@gcalmettes gcalmettes changed the title Fix regression: can fetch branches and tags references without specifying commit hashes Fix regression: can fetch branches and tags references without specifying commit hashes for private git repository used as context Nov 25, 2021
@google-cla google-cla bot added cla: yes CLA signed by all commit authors and removed cla: no CLA not signed by all commit authors labels Nov 25, 2021
Copy link
Collaborator

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

LGTM, but would it be possible to add an integration test to ensure this behavior doesn't regress in a future change?

@gcalmettes
Copy link
Contributor Author

Thanks @imjasonh for the review.

Regarding implementing some integration tests, this would mean adding a test involving the build from a private repository, so that the authentication is required. Right now, Kaniko GitHub repository is used in the integration tests to check the git context from a public repository.

I could definitely add some integration tests involving a local git server, the same way the use of a local registry is described in the Development guide (in this case, using a docker image of Gogs for example could be an option, as it is very easy to setup).
Another option would be to connect to a private registry (hosted on GitHub for example). I do not know if there is already a dedicated authenticated repository for such a purpose, but this can definitely be also made.

What do you think ?

@imjasonh
Copy link
Collaborator

Makes sense. If this causes more trouble in the future we can add a test then.

Can you rebase on master to make sure current tests pass? We've made a lot of changes since this PR was opened.

Thanks for this contribution, and for your patience!

@gcalmettes
Copy link
Contributor Author

Thanks!
Rebase on master done ✔️

@gcalmettes gcalmettes force-pushed the fix-1801-git-context-supports-branches-tags-and-commit-hashs branch from 9ba9f97 to 572584f Compare December 24, 2021 18:01
@imjasonh imjasonh merged commit d2f3e89 into GoogleContainerTools:master Dec 24, 2021
@pnbecker
Copy link

Thank you @imjasonh and @gcalmettes for working on this! The bug was quite annoying for us.

@gcalmettes gcalmettes deleted the fix-1801-git-context-supports-branches-tags-and-commit-hashs branch December 26, 2021 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes CLA signed by all commit authors needs-integration-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kaniko v1.7.0 fails to clone private git repositories when specifying a specific branch
4 participants