coopnorge / provider-github

Apache License 2.0
25 stars 13 forks source link

Cannot unmarshal string into Go value of type clients.githubConfig #82

Closed KALAKATASUNEETHA closed 1 month ago

KALAKATASUNEETHA commented 1 month ago

Hi, I followed example of creating the secret for github app credentials


`apiVersion: v1
kind: Secret
metadata:
  name: provider-secret
  namespace: upbound-system
type: Opaque
stringData:
  credentials: "{\"app_auth\": [{\"id\": \"${APP_ID}\", \"installation_id\": \"${APP_INSTALLATION_ID}\", \"pem_file\": \"${APP_PEM_FILE}\"}] ,\"owner\":\"${GH_OWNER}\"}"
`

When I tried to create the repository resource , its failing with the following error cannot get terraform setup: cannot unmarshal github credentials as JSON: json: cannot unmarshal string into Go value of type clients.githubConfig

AtzeDeVries commented 1 month ago

can you inspect the result of the secret and check if all the vars (for ex ${APP_ID} ) are replaced correctly? How is the PEM encoded, as single line?

KALAKATASUNEETHA commented 1 month ago

I tried by storing the credentials in json format instead of string as mentioned in the documentation, then resource is synced

{
    "app_auth": [
        {
            "id": "******",
            "installation_id": "*******",
            "pem_file": "-----BEGIN RSA PRIVATE KEY-----\n**************\n"
         }
        ],
    "owner": "****" 
}
KALAKATASUNEETHA commented 1 month ago

But status is false since the repository was already exists in the organisation. What we need to do if need to add the team to the already existing repository

KALAKATASUNEETHA commented 1 month ago

I could able to figured it out. Thank you for your response

AtzeDeVries commented 1 month ago

what was the issue?

KALAKATASUNEETHA commented 1 month ago