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

Checkout a specific git commit #1153

Merged
merged 1 commit into from
Aug 13, 2020
Merged

Conversation

why-xn
Copy link
Contributor

@why-xn why-xn commented Mar 23, 2020

Description

I have added support for checking out to a specific git commit. For this, the git url pattern should be like below.

git://[repository url][#reference][#commit-id]

Reviewer Notes

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

Release Notes

  • Support for checking out a specific git commit

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no CLA not signed by all commit authors label Mar 23, 2020
@why-xn
Copy link
Contributor Author

why-xn commented Mar 23, 2020

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes CLA signed by all commit authors and removed cla: no CLA not signed by all commit authors labels Mar 23, 2020

if err == nil && len(parts) > 2 {
// ... retrieving the commit being pointed by HEAD
_, err := r.Head()
Copy link
Member

@tejal29 tejal29 Mar 25, 2020

Choose a reason for hiding this comment

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

Can you please add more explanation around whyr.Head() is necessary?
It would be great to add some tests around this integration.
Please see your existing Git Context integration test.

Copy link
Member

@tejal29 tejal29 left a comment

Choose a reason for hiding this comment

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

@why-xn Thank you for your contribution!
In order to make sure, this integration is not broken, please add

  1. either unit tests or
  2. Integration tests

Can you also explain how feature will benefit the community?
Is the idea to build on some older commit in the git workspace?

@tomprince
Copy link
Contributor

I would find something like this useful in a CI pipeline, where the kaniko task might end being run after another commit was pushed. In that case, it should be possible to run kaniko in such a way that the image built comes from the commit the rest of the pipeline is expecting, rather than whatever commit happend to get pushed later.

@tejal29
Copy link
Member

tejal29 commented Mar 26, 2020

I would find something like this useful in a CI pipeline, where the kaniko task might end being run after another commit was pushed. In that case, it should be possible to run kaniko in such a way that the image built comes from the commit the rest of the pipeline is expecting, rather than whatever commit happend to get pushed later.

Thanks for the explanation @tomprince. Not aware how other pipeline orchestrator works. I am most familiar with tekton and it supports running a pipeline at a git commit which other tasks in pipeline (in this case kaniko will run on)
Your use case also sounds legit. Just curios do you have your own pipeline orchestrator ?

@tomprince
Copy link
Contributor

Thanks for the explanation @tomprince. Not aware how other pipeline orchestrator works. I am most familiar with tekton and it supports running a pipeline at a git commit which other tasks in pipeline (in this case kaniko will run on)
Your use case also sounds legit. Just curios do you have your own pipeline orchestrator ?

I will note that I probably won't use this, since we have additional constraints that means we need to wrap kaniko, but might use something like this without those contraints.

I'm not sure of @why-xn setup, but I know the setup we use does not support persistent volumes between different tasks in a pipeline, so would want to pin the commit here.

@aca
Copy link
Contributor

aca commented May 25, 2020

Hope this get merged. I build very simple [git push -> webhook -> build] pipeline in my company.
I experience same problem like tomprince mentioned.

In that case, it should be possible to run kaniko in such a way that the image built comes from the commit the rest of the pipeline is expecting, rather than whatever commit happend to get pushed later.

@aca
Copy link
Contributor

aca commented May 27, 2020

@why-xn Seems like review is requested. Any updates on this?

@tejal29
Copy link
Member

tejal29 commented Jun 4, 2020

@why-xn Can you add some unit tests?

@gcalmettes
Copy link
Contributor

Confirming that this would be a very nice and useful feature to have. Thanks for considering this !

@tejal29 tejal29 merged commit 1bf66ef into GoogleContainerTools:master Aug 13, 2020
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-unit-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants