argocd-commenter icon indicating copy to clipboard operation
argocd-commenter copied to clipboard

Deployment URL cannot be parsed for GitHub Enterprise

Open jensvandenreyt opened this issue 2 years ago • 2 comments

Problem

The deployment URL for GitHub Enterprise cannot be parsed. As a result, ParseDeploymentURL in pkg/github/deployment.go will always return nil and deployment statuses in GitHub will never be updated when phases change.

https://github.com/int128/argocd-commenter/blob/b7c76020fdd7acb54c2750090b0365e079815a6d/pkg/github/deployment.go#L17-L25

As an example, our GitHub Enterprise URL https://api.github.some-company.com/repos/IOTA/repo/deployments/54392 will never match the regex.

This also does not seem to be the only place the issue occurs. In pkg/github/types.go there are also some hardcoded regexes for the public github.com. https://github.com/int128/argocd-commenter/blob/b7c76020fdd7acb54c2750090b0365e079815a6d/pkg/github/types.go#L23-L26

Edit I just discovered that the issue also occurs in https://github.com/int128/oauth2-github-app. The config.go file also has the hardcoded public github.com URL.

Solution

Can the regex either be made less strict on the hostname, or be constructed using the GITHUB_ENTERPRISE_URL from the secret?

jensvandenreyt avatar Feb 08 '23 09:02 jensvandenreyt

Thank you for bringing up the issue. I will fix the implementation for GitHub Enterprise Server.

int128 avatar Feb 18 '23 12:02 int128

@jensvandenreyt Can you check https://github.com/int128/argocd-commenter/pull/878? Let me clarify if it meets the requirement because I don't have an environment of GitHub Enterprise Server.

int128 avatar Feb 18 '23 12:02 int128