Skip to content

RHTAP-1134: Support custom Gitlab instances#240

Merged
chmeliik merged 1 commit into
konflux-ci:mainfrom
gbenhaim:gitlab_base_url
Jan 8, 2024
Merged

RHTAP-1134: Support custom Gitlab instances#240
chmeliik merged 1 commit into
konflux-ci:mainfrom
gbenhaim:gitlab_base_url

Conversation

@gbenhaim
Copy link
Copy Markdown
Member

@gbenhaim gbenhaim commented Jan 5, 2024

When creating a Gitlab client, the base url of the Gitlab instance should be provided (unless the default is used, which is https://gitlab.com). With this change, it would be possible to use Gitlab instance other than gitlab.com.

In addition, fixed an issue in "getWebhookByTargetUrl" where it tried to access a nil pointer of a request.

@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Jan 5, 2024

@gbenhaim: This pull request references RHTAP-1134 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the feature to target the "4.16.0" version, but no target version was set.

Details

In response to this:

When creating a Gitlab client, the base url of the Gitlab instance should be provided (unless the default is used, which is https://gitlab.com). With this change, it would be possible to use Gitlab instance other than gitlab.com.

In addition, fixed an issue in "getWebhookByTargetUrl" where it tried to access a nil pointer of a request.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@gbenhaim gbenhaim requested a review from mmorhun January 5, 2024 08:08
@openshift-ci openshift-ci Bot requested a review from psturc January 5, 2024 08:08
@gbenhaim gbenhaim requested review from chmeliik and removed request for psturc January 5, 2024 08:08
Copy link
Copy Markdown
Contributor

@chmeliik chmeliik left a comment

Choose a reason for hiding this comment

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

LGTM with a minor nitpick for the test data

Comment thread pkg/git/gitlab/gitlab_helper_test.go Outdated
err error
}{
{
"https://gitlab.cee.redhat.com/rhtap/tenants-config.git",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AFAIK we should generally avoid mentioning internal URLs in upstream code, could you replace the redhat.com urls with something else?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

When creating a Gitlab client, the base url of the Gitlab instance
should be provided (unless the default is used, which is
https://gitlab.com). With this change, it would be possible to use
Gitlab instance other than gitlab.com.

In addition, fixed an issue in "getWebhookByTargetUrl"
where it tried to access a nil pointer of a request.

Signed-off-by: gbenhaim <gbenhaim@redhat.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 5, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
6.4% Duplication on New Code

See analysis details on SonarCloud

Copy link
Copy Markdown
Member

@mmorhun mmorhun left a comment

Choose a reason for hiding this comment

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

LGTM in general, just a small remark.
Thanks for contributions!

func GetBaseUrl(repoUrl string) (string, error) {
url, err := url.Parse(repoUrl)
if err != nil {
return "", FailedToParseUrlError{url: repoUrl, err: err.Error()}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Custom errors looks redundant here: they are never used / distinguished.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

they are used in the tests :)

@gbenhaim
Copy link
Copy Markdown
Member Author

gbenhaim commented Jan 8, 2024

@chmeliik @mmorhun can someone please merge it?

@chmeliik
Copy link
Copy Markdown
Contributor

chmeliik commented Jan 8, 2024

/retest

@gbenhaim
Copy link
Copy Markdown
Member Author

gbenhaim commented Jan 8, 2024

@chmeliik can you please merge it? I see that all the checks passed. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants