jenkins-x-plugins / jx-pipeline

a small binary plugin for working with Jenkins X pipelines
Apache License 2.0
8 stars 25 forks source link

feat: check if gitRef is private and format git resolver params #523

Closed Skisocks closed 1 year ago

Skisocks commented 1 year ago

The Tekton git resolver uses different params for public/private repositories. This PR allows the migration tool to check if a repo is public then sets the gitRef params accordingly.

jenkins-x-bot commented 1 year ago

Hi @Skisocks. Thanks for your PR.

I'm waiting for a jenkins-x-plugins member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository.
Skisocks commented 1 year ago

/cc @tomhobson @msvticket

msvticket commented 1 year ago

/ok-to-test

msvticket commented 1 year ago
                level=warning msg="[linters_context] rowserrcheck is disabled because of generics. You can track the evolution of the generics support by following the [https://github.com/golangci/golangci-lint/issues/2649."](https://github.com/golangci/golangci-lint/issues/2649.)
        pkg/pipelines/processor/gitref.go:20:7: hugeParam: g is heavy (81 bytes); consider passing it by pointer (gocritic)
        func (g GitRef) IsEmpty() bool {
              ^
        pkg/pipelines/processor/gitref.go:25:7: hugeParam: g is heavy (81 bytes); consider passing it by pointer (gocritic)
        func (g GitRef) GetParentFileName() string {
              ^
        pkg/pipelines/processor/gitref.go:31:7: hugeParam: g is heavy (81 bytes); consider passing it by pointer (gocritic)
        func (g GitRef) ToParams() []v1beta1.Param {
              ^
        pkg/pipelines/processor/gitref.go:69:7: hugeParam: g is heavy (81 bytes); consider passing it by pointer (gocritic)
        func (g GitRef) ToResolverRef() v1beta1.ResolverRef {
              ^
        pkg/pipelines/processor/remotetasks_migrator.go:324:70: hugeParam: ref is heavy (81 bytes); consider passing it by pointer (gocritic)
        func (p *RemoteTasksMigrator) pipelineTaskFromParentRef(name string, ref GitRef) v1beta1.PipelineTask {
                                                                             ^
        pkg/pipelines/processor/gitref.go:4: File is not `goimports`-ed (goimports)
            "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
        pkg/pipelines/processor/gitresolverref.go:6: File is not `goimports`-ed (goimports)
            "github.com/jenkins-x/jx-helpers/v3/pkg/gitclient/giturl"
        pkg/pipelines/processor/gitresolverref.go:69:45: var-naming: method parameter cloneUrl should be cloneURL (revive)
        func (g *GitRefResolver) isRepositoryPublic(cloneUrl string) (bool, error) {
                                                    ^
        pkg/pipelines/processor/gitresolverref.go:75:24: response body must be closed (bodyclose)
            resp, err := client.Do(req)
                                  ^
        pkg/pipelines/processor/remotetasks_migrator.go:301:10: shadow: declaration of "err" shadows declaration at line 290 (govet)
                    task, err := p.NewTaskFromStepAndPipelineRun(step, prs, true)
                          ^
sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

tomhobson commented 1 year ago

/retest

jenkins-x-bot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tomhobson

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: - ~~[OWNERS](https://github.com/jenkins-x-plugins/jx-pipeline/blob/main/OWNERS)~~ [tomhobson] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment