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

Introduce Git step command #751

Merged
merged 2 commits into from
May 6, 2021
Merged

Introduce Git step command #751

merged 2 commits into from
May 6, 2021

Conversation

HeavyWombat
Copy link
Contributor

@HeavyWombat HeavyWombat commented Apr 29, 2021

Changes

In order to replace Tekton Git resource, a replacement container image
is required that performs a Git clone.

Add Git step command which wraps git CLI to clone user repositories
with different authentication options.

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

See the contributor guide
for details on coding conventions, github and prow interactions, and the code review process.

Release Notes

Added Git command as a replacement for the Tekton Git Resource.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Apr 29, 2021
@HeavyWombat HeavyWombat requested review from SaschaSchwarze0 and removed request for mattcui April 29, 2021 12:28
@openshift-ci-robot openshift-ci-robot added release-note Label for when a PR has specified a release note and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 29, 2021
@HeavyWombat HeavyWombat added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 29, 2021
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

Which make target can be used to build the image?

isSSHGitURL := sshGitURLRegEx.MatchString(flagValues.url)
switch {
case hasPrivateKey && !isSSHGitURL:
return typeUndef, &ExitError{Code: 110, Message: "Credential/URL inconsistency: SSH credentials provided, but URL is not a SSH Git URL"}
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 Apr 29, 2021

Choose a reason for hiding this comment

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

This is different to the current behavior where there is "only" a warning. Our current e2e tests - when running with private repo support - also adds the credential to all Builds ignoring if it is to test a private repo or not if I remember correctly. On the other hand, it is not a bad idea to do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we can have a call about this. I took the liberty to change the behavior a bit and that we then can discuss the pros and cons.

@SaschaSchwarze0
Copy link
Member

Related to #696

@HeavyWombat
Copy link
Contributor Author

Which make target can be used to build the image?

Is coming up next. I wanted to code to be out already for some feedback.

@HeavyWombat HeavyWombat marked this pull request as draft April 29, 2021 14:07
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 29, 2021
@adambkaplan
Copy link
Member

There's a huge amount of overlap here with what we've done in OpenShift builds. We have a lot of battle-tested code to manage the cloning of git source. It is currently spread across several repos - I can do a deep dive to see where these bits are and if they can be repackaged for Shipwright.

@HeavyWombat HeavyWombat marked this pull request as ready for review April 30, 2021 07:30
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 30, 2021
@HeavyWombat
Copy link
Contributor Author

Which make target can be used to build the image?

Is coming up next. I wanted to code to be out already for some feedback.

We eventually decided against a Makefile target as ideally it will be magically done by the build through a ko reference.

Copy link
Contributor

@qu1queee qu1queee left a comment

Choose a reason for hiding this comment

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

From my quick overview today, it looks good 👍🏾. I would like to go over the credentials part tomorrow. Leaving you some open q´s from my side for now.

cmd/git/README.md Show resolved Hide resolved
cmd/git/main.go Show resolved Hide resolved
cmd/git/main.go Show resolved Hide resolved
Copy link
Contributor

@qu1queee qu1queee left a comment

Choose a reason for hiding this comment

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

I tested the different auth methods locally. All of the seems to be running smoothly, pretty nice behaviour, thanks for this!

In order to replace Tekton Git resource, a replacement container image
is required that performs a Git clone.

Add Git step command which wraps `git` CLI to clone user repositories
with different authentication options.
Since the key provided via a secret can have undesirable file
permissions, it will end up failing due to SSH sanity checks.

Create temporary SSH private key using `0400` file permissions.
@qu1queee qu1queee self-requested a review May 6, 2021 08:35
Copy link
Contributor

@qu1queee qu1queee left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2021
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SaschaSchwarze0

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2021
@openshift-merge-robot openshift-merge-robot merged commit 67f6df4 into shipwright-io:master May 6, 2021
@HeavyWombat HeavyWombat deleted the add/git-step-command branch May 17, 2021 16:16
@adambkaplan adambkaplan added this to the release-v0.5.0 milestone Jun 10, 2021
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants