redhat-cop / group-sync-operator

Synchronizes groups from external providers into OpenShift
Apache License 2.0
110 stars 60 forks source link

Error 'strconv.ParseInt: parsing "aaaaaa11111111111": invalid syntax' when using Github enterprise #283

Closed daisleyj closed 9 months ago

daisleyj commented 9 months ago

On Openshift 4.13.12 the Group Sync resource, configured for Github enterprise and using a Github App for authentication, returns the error:

strconv.ParseInt: parsing "aaaaaa11111111111": invalid syntax (Value changed in this error message - Value in actual error matches appId from secret)

It appears to be trying to parse the AppId as an integer but Github App Id's are alphanumeric.

Group Sync Yaml:

apiVersion: redhatcop.redhat.io/v1alpha1
kind: GroupSync
  name: github-group-sync
  namespace: group-sync-operator
spec:
  providers:
    - github:
        ca:
          key: ca-bundle.crt
          kind: ConfigMap
          name: custom-ca
          namespace: group-sync-operator
        credentialsSecret:
          key: privateKey
          kind: Secret
          name: github-sync
          namespace: group-sync-operator
        organization: MyOrg
        teams:
          - MyOrg/group-sync
          - MyOrg/developers
          - MyOrg/admins
        url: 'https://github.mydomain.com/'
        v4url: 'https://github.mydomain.com/api/graphql'
      name: mydomain-github
  schedule: '*/10 8-18 * * *'

Credential Secret YAML:

kind: Secret
apiVersion: v1
metadata:
  name: github-sync
  namespace: group-sync-operator
data:
  appId: ZZZZZZZZk2YzNlOWXXXXXXXcxN2E=
  privateKey: ZZZZZZZZZZE5ZTQ3NWExMGVlZmQzNjIzMWMxXXXXXXXXXXhYwo=
type: Opaque

ca configmap yaml:

kind: ConfigMap
apiVersion: v1
metadata:
  name: custom-ca
  namespace: group-sync-operator
  uid: 22f4692b-a333-4c79-9879-16ab9faee9fd
  resourceVersion: '109921'
  creationTimestamp: '2023-11-21T21:35:02Z'
  managedFields:
    - manager: kubectl-create
      operation: Update
      apiVersion: v1
      time: '2023-11-21T21:35:02Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:data':
          .: {}
          'f:ca-bundle.crt': {}
data:
  ca-bundle.crt: |
    -----BEGIN CERTIFICATE-----
    MIIFhfC
    ....
    ....
    0FA==
    -----END CERTIFICATE-----
daisleyj commented 9 months ago

Sorry, spent hours trying to resolve this before opening the issue, then noticed a stupid mistake :(