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

push_rule API call causes 404 with selft-hosted gitlab CE #514

Open
snake007v opened this issue Feb 27, 2024 · 6 comments
Open

push_rule API call causes 404 with selft-hosted gitlab CE #514

snake007v opened this issue Feb 27, 2024 · 6 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec

Comments

@snake007v
Copy link

snake007v commented Feb 27, 2024

What happened?

In the case of self-hosted Gitlab CE it will cause a 404 error on push_rule API call as it's available only for EE.
This call can't be turned off and the error can't be handled.

Example

	// Create a new GitLab Group
	gitlabGroup, err := gitlab.NewGroup(ctx, gitlabGroupName, &gitlab.GroupArgs{
		Name: pulumi.String(gitlabGroupName),
		Path: pulumi.String(gitlabGroupName),
	}, pulumi.Provider(gitlabProvider))
	if err != nil {
		return nil, err
	}
Diagnostics:
  gitlab:index:Group (paas-vm2-test):
    error:   sdk/resource_gitlab_group.go:564: provider: [ERROR] Failed to get push rules for group: group_id=8081 error="GET https://git.xxx.com/api/v4/groups/8081/push_rule: 404 {error: 404 Not Found}" provider=gitlab@v6.8.1	

Output of pulumi about

❯ pulumi about
CLI          
Version      3.103.1
Go Version   go1.21.5
Go Compiler  gc

Plugins
NAME  VERSION
go    unknown

Host     
OS       darwin
Version  14.1.1
Arch     arm64

This project is written in go: executable='/opt/homebrew/bin/go' version='go version go1.21.6 darwin/arm64'

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@snake007v snake007v added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Feb 27, 2024
@iwahbe iwahbe removed the needs-triage Needs attention from the triage team label Feb 28, 2024
@iwahbe
Copy link
Member

iwahbe commented Feb 28, 2024

Hi @snake007v. Just to clarify, is the bug that a 404 is returned, or that the error can't be handled?

In the case of self-hosted Gitlab CE it will cause a 404 error on push_rule API call as it's available only for EE.

It sounds like the 404 is correct.

@iwahbe iwahbe added the awaiting-feedback Blocked on input from the author label Feb 28, 2024
@snake007v
Copy link
Author

snake007v commented Feb 29, 2024

Hi @iwahbe

Sorry if I wasn't clear in my initial report.
This bug is about the push_rule API call itself, which will be executed even if you don't configure any rules in your code(as you can see from my example). And there is no way to disable that call.

As a result, we will always get 404 error in case if you're creating a new group in GitlabCE.

@iwahbe
Copy link
Member

iwahbe commented Feb 29, 2024

Thanks for clarifying.

@iwahbe iwahbe removed the awaiting-feedback Blocked on input from the author label Feb 29, 2024
@Medialo
Copy link

Medialo commented Apr 17, 2024

Hi,

I have the same problem, so I have edited the terraform provider gitlab to not read push rules if Gitlab CE is used.
@snake007v if it can help you to build your own pulumi gitlab plugin : https://gitlab.com/Medialo/terraform-provider-gitlab

@qerub
Copy link

qerub commented May 16, 2024

For the record: I'm running into the same unexpected error message on self-hosted GitLab EE too for groups with no configured push rule(s). Looks like https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/1730 (Add push rule support to group resource) wasn't fully baked. Code in question: https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/blob/684ed8e8/internal/provider/sdk/resource_gitlab_group.go#L576-579

By the way: @Medialo's patch has been merged upstream: https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/1891 (Fix: 404 on group creation on Pulumi with Gitlab CE)

@iwahbe iwahbe added the awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). label May 16, 2024
@iwahbe
Copy link
Member

iwahbe commented May 16, 2024

@Medialo thanks for the patch and @qerub thanks for letting us know it has merged. As soon as upstream releases it should be available in pulumi-gitlab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

4 participants