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

git-init: add support for fetching submodules 🚝 #1531

Merged
merged 2 commits into from
Nov 7, 2019

Conversation

vdemeester
Copy link
Member

Changes

It will do those commands by default as they are no-op.

Closes #1523

Signed-off-by: Vincent Demeester vdemeest@redhat.com

Submitter Checklist

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

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

`git-init` (thus `GitResource`) will now init and update submodules recursively by default

It will do those commands by default as they are no-op.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Nov 6, 2019
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 6, 2019
@@ -111,3 +111,45 @@ func Commit(logger *zap.SugaredLogger, revision, path string) (string, error) {
}
return strings.TrimSuffix(output, "\n"), nil
}

func SubmoduleFetch(logger *zap.SugaredLogger, path string) error {
// HACK: This is to get git+ssh to work since ssh doesn't respect the HOME
Copy link

Choose a reason for hiding this comment

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

This looks like this hack is copied from Fetch(). Opportunity to de-dup by creating a helper func?

Copy link
Member Author

Choose a reason for hiding this comment

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

@sbwsg indeed 😛 I was a bit lazy 🤫, I need to enhance that 😉

Copy link

Choose a reason for hiding this comment

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

nice 👍

@@ -29,6 +29,7 @@ var (
revision = flag.String("revision", "", "The Git revision to make the repository HEAD")
path = flag.String("path", "", "Path of directory under which git repository will be copied")
terminationMessagePath = flag.String("terminationMessagePath", "/dev/termination-log", "Location of file containing termination message")
submodules = flag.Bool("submodules", true, "Initialize and fetch git submodules")
Copy link
Member

Choose a reason for hiding this comment

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

WDYT about surfacing this option all the way up into the Git resource, so users can turn it off if they'd prefer?

Copy link
Member Author

Choose a reason for hiding this comment

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

@imjasonh I was waiting for someone to comment this to do it 😛

@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 7, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/git_resource.go 78.9% 75.0% -3.9

@@ -252,6 +252,9 @@ Params that can be added are the following:
(branch, tag, commit SHA or ref) to clone. You can use this to control what
commit [or branch](#using-a-branch) is used. _If no revision is specified,
the resource will default to `latest` from `master`._
1. `submodules`: defines if the resource should initialize and
fetch the submodules, value is either `true` or `false`. _If note
Copy link

Choose a reason for hiding this comment

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

s/note/not/

@@ -111,3 +111,45 @@ func Commit(logger *zap.SugaredLogger, revision, path string) (string, error) {
}
return strings.TrimSuffix(output, "\n"), nil
}

func SubmoduleFetch(logger *zap.SugaredLogger, path string) error {
// HACK: This is to get git+ssh to work since ssh doesn't respect the HOME
Copy link

Choose a reason for hiding this comment

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

nice 👍

@ghost
Copy link

ghost commented Nov 7, 2019

/lgtm

@tekton-robot tekton-robot assigned ghost Nov 7, 2019
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/git_resource.go 78.9% 75.0% -3.9

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/git_resource.go 78.9% 75.0% -3.9

@ghost
Copy link

ghost commented Nov 7, 2019

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2019
@vdemeester
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests

@NicolasRouquette
Copy link

As a new tekton fanboy here at JPL, I'm impressed by the quality of the PR & discussion.
I look forward to using this update here.

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 7, 2019
@tekton-robot tekton-robot merged commit 3b24043 into tektoncd:master Nov 7, 2019
@vdemeester vdemeester deleted the 1523-submodules branch November 7, 2019 21:11
tekton-robot pushed a commit that referenced this pull request Dec 12, 2019
Fixes #1727. In #1531, the submodules parameter was added, but it has no
influence on the generated git-init invocation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tekton pipeline git resource should init and update submodules recursively.
6 participants