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
Webhook: Azure git repo urls fail to match #9055
Labels
bug
Something isn't working
Comments
Interesting idea. Can you please share how you do it on #3937 |
10 tasks
crenshaw-dev
pushed a commit
that referenced
this issue
Feb 17, 2023
This commit fixes incorrect regular expression used for URL matching. Expected behavior: valid user info part is matched => webhook is sent. Actual behavior: some valid user info is not matched, example: `ssh://user-name@example.com/org/repo` => webhook is not sent. Context: - [RFC 3986 3.2.1 - User Information](https://www.rfc-editor.org/rfc/rfc3986#section-3.2.1) - [Username validation regex in shadow Linux package](https://github.com/shadow-maint/shadow/blob/master/libmisc/chkname.c#L36) Signed-off-by: mdsjip <2284562+mdsjip@users.noreply.github.com>
crenshaw-dev
pushed a commit
that referenced
this issue
Feb 17, 2023
This commit fixes incorrect regular expression used for URL matching. Expected behavior: valid user info part is matched => webhook is sent. Actual behavior: some valid user info is not matched, example: `ssh://user-name@example.com/org/repo` => webhook is not sent. Context: - [RFC 3986 3.2.1 - User Information](https://www.rfc-editor.org/rfc/rfc3986#section-3.2.1) - [Username validation regex in shadow Linux package](https://github.com/shadow-maint/shadow/blob/master/libmisc/chkname.c#L36) Signed-off-by: mdsjip <2284562+mdsjip@users.noreply.github.com>
crenshaw-dev
pushed a commit
that referenced
this issue
Feb 17, 2023
This commit fixes incorrect regular expression used for URL matching. Expected behavior: valid user info part is matched => webhook is sent. Actual behavior: some valid user info is not matched, example: `ssh://user-name@example.com/org/repo` => webhook is not sent. Context: - [RFC 3986 3.2.1 - User Information](https://www.rfc-editor.org/rfc/rfc3986#section-3.2.1) - [Username validation regex in shadow Linux package](https://github.com/shadow-maint/shadow/blob/master/libmisc/chkname.c#L36) Signed-off-by: mdsjip <2284562+mdsjip@users.noreply.github.com>
crenshaw-dev
pushed a commit
that referenced
this issue
Feb 17, 2023
This commit fixes incorrect regular expression used for URL matching. Expected behavior: valid user info part is matched => webhook is sent. Actual behavior: some valid user info is not matched, example: `ssh://user-name@example.com/org/repo` => webhook is not sent. Context: - [RFC 3986 3.2.1 - User Information](https://www.rfc-editor.org/rfc/rfc3986#section-3.2.1) - [Username validation regex in shadow Linux package](https://github.com/shadow-maint/shadow/blob/master/libmisc/chkname.c#L36) Signed-off-by: mdsjip <2284562+mdsjip@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To trigger argocd updates on git push I have a hook setup to mimic GitHub push events. It gets accepted by Argo but it fails to match the repos defined in Argo.
The generated regex has a few issues with the Azure specific Urls:
(\w+@)?
while it should be([\w-]+)?
(?i)^(http://|https://|\\w+@|ssh://)(\\w+@)?dev\\.azure\\.com(:[0-9]+|)[:/]tenant-name/ProjectName/_git/GitOps(\\.git)?$
As alternative I tried to use Ssh url and the same generated regexp has issue with ssh matches too:
The issue here is that the regexp expects the ssh to follow uri format which it doesn't:
(:[0-9]+|)
group doesn't match:v3
which in the case of ssh is not a port but a part of the path; this can be fixed by(:[0-9a-zA-Z]+|)
or(:\w+|)
To Reproduce
Enable debug level logging in the argocd-server app and use the command below to test the bahaviour:
Expected behavior
The regexps should match above cases.
Version
> argocd version argocd: v2.1.3+d855831.dirty BuildDate: 2021-09-30T22:11:24Z GitCommit: d855831540e51d8a90b1006d2eb9f49ab1b088af GitTreeState: dirty GoVersion: go1.17.1 Compiler: gc Platform: darwin/amd64 argocd-server: v2.3.3+07ac038
The text was updated successfully, but these errors were encountered: