trying to setup GitOps with Permit and a repo in g...
# permit-saas
b
trying to setup GitOps with Permit and a repo in gitlab, im trying to https://docs.permit.io/integrations/gitops/github I tried to validate a repo, but it says its in pending. and I cant find any APIs anywhere to tell me where to check for errors, etc. docs.permit.io Git and Permit | Permit.io Documentation Learn how to manage the policies configured in Permit in your GitHub repositories using GitOps
a
Hi @Bradley Herrup, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
When a GitOps repository is created in Permit, it starts with a "pending" status and will only change to "active" after you explicitly activate it (1) . This is the expected behavior. According to the documentation, after creating your repository configuration, you need to: 1. First, validate that the branches were created successfully - check your GitLab repository for new branches named
permit/generated/<env_id>
2. Once you've confirmed the branches exist, activate the repository using this API call :
Copy code
curl -X PUT "<https://api.permit.io/v2/projects/<your-project-id-or-key>/repos/<your-repo-id-or-key>/activate>" -H "Authorization: Bearer <your-permit-api-key>"
The repository will remain in "pending" status until you run this activation command . This two-step process (create then activate) ensures your repository is properly configured before Permit starts syncing policies to it. While the guide focuses on GitHub, it notes that the same steps apply to GitLab with minor modifications . Make sure you've: • Added the SSH deploy key with write access to your GitLab repository • Configured the SSH credentials correctly in your JSON payload
To learn more, see the sources I considered: [[1] Git and Permit](https://docs.permit.io/integrations/gitops/github)
b
what if the repos ARENT created
there are no docs for "updating a key"/repo
t
Hey @Bradley Herrup, when you do a
GET
on the repo API with the repo_id what do you get?
b
[{"id":"4c310308a90444b3930ea0f4f9db048d","status":"pending","key":"gitlab-cobalt","url":"git@gitlab.com:buckstop/cobalt.git","main_branch_name":"main","credentials":{"auth_type":"ssh","username":"git","public_key":null,"private_key":"******---\n"},"activate_when_validated":false},{"id":"5a48bad3ec804694a53f61c454b47c6b","status":"pending","key":"gitlab-cobalt-1","url":"git@gitlab.com:buckstop/cobalt.git","main_branch_name":"main","credentials":{"auth_type":"ssh","username":"brad163","public_key":null,"private_key":"******---\n"},"activate_when_validated":false},{"id":"9d2ae3a119a145b0a321d5d730b9f653","status":"pending","key":"gitops-private-key","url":"git@gitlab.com:buckstop/cobalt.git","main_branch_name":"main","credentials":{"auth_type":"ssh","username":"git","public_key":null,"private_key":"******--\n%"},"activate_when_validated":false}]
(PS i tried a put, but guess i need the repo id 😜
nope that didnt work either
DELETE works though 😜
t
the most common issues are: 1. the ssh isn't configured properly on gitlab for the repo 2. the private key isn't in the correct format for the API call
b
yeah the problem is that I have no visibility into which it MAY be
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
b
@Thomas just making sure they username for gitlab should be 'git' and not my gitlab username (for which the deploy key is associated with)
also. should it include the trailing % or not
t
No trailing % and it's whatever gitlab provides, which by default is git
b
is there a way to UPDATE a repo? or should i just go about deleting and re POST ing?
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
t
Delete and rePOST. you can update, but i've found it to be more confusing
āž• 1