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

Make owners and repos case insensitive #26

Conversation

gabriel-samfira
Copy link
Member

Github treats owners (users and orgs) and repos as case insensitive. To github, https://github.com/cloudbase/garm is equivalent to https://github.com/CloudBase/GaRm. This commit makes the sql store backend, case insensitive when querying repos and orgs.

Fixes: #25

Signed-off-by: Gabriel Adrian Samfira gsamfira@cloudbasesolutions.com

@maigl
Copy link
Contributor

maigl commented Oct 5, 2022

Hi @gabriel-samfira, very nice .. but I think we also need to make the comparison in ValidateOwner case insensitive. The reason is that the owner in the workflow_job event will have some case and we should make it robust here.

Github treats owners (users and orgs) and repos as case insensitive. To
github, https://github.com/cloudbase/garm is equivalent to
https://github.com/CloudBase/GaRm. This commit makes the sql store
backend, case insensitive when querying repos and orgs.

Fixes: cloudbase#25

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
Copy link
Contributor

@maigl maigl left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@gabriel-samfira gabriel-samfira merged commit e83f065 into cloudbase:main Oct 6, 2022
@gabriel-samfira
Copy link
Member Author

Tested with both orgs and repos:

ubuntu@garm:~$ garm-cli repo ls
+--------------------------------------+-----------------+---------+------------------+
| ID                                   | OWNER           | NAME    | CREDENTIALS NAME |
+--------------------------------------+-----------------+---------+------------------+
| f0b1c1c8-b605-4560-adb7-79b95e2e470c | gABrIeL-SaMfIra | ScRiPtS | gabriel          |
+--------------------------------------+-----------------+---------+------------------+
ubuntu@garm:~$ garm-cli org ls
+--------------------------------------+----------+------------------+
| ID                                   | NAME     | CREDENTIALS NAME |
+--------------------------------------+----------+------------------+
| 3f7b0a5c-1d7a-4e52-b0c8-06116eca4091 | GsAmFiRa | gabriel_org      |
+--------------------------------------+----------+------------------+

Seems to work well. Merging.

@maigl let me know if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Webhook owner match should be case insensitiv.
2 participants