redhat-actions / openshift-github-connector

OpenShift <--> GitHub connector app
3 stars 5 forks source link

Create a secret into cluster with app auth for other tools (gitops) to reference #17

Open tetchel opened 3 years ago

tetchel commented 3 years ago

the token should have permissions to read from the repository and put up pull requests

tetchel commented 3 years ago

There is no frontend yet but here is what the endpoint looks like:

$ curl -sSLk https://locahost:3000/api/v1/user/github/installation/token -H "Authorization: Bearer $(oc whoami --show-token)" -X POST -d "namespace=developer&overwriteExisting=true" | jq
{
  "success": true,
  "message": "Created installation token into developer/secret/tims-openshift-actions-connector-token",
  "namespace": "developer",
  "secretName": "tims-openshift-actions-connector-token",
  "expiresAt": "2021-07-15T14:30:54Z",
  "permissions": {
    "contents": "read",
    "metadata": "read",
    "pull_requests": "write"
  }
}

$ oc describe secret tims-openshift-actions-connector-token -n developer
Name:         tims-openshift-actions-connector-token
Namespace:    developer
Labels:       app.kubernetes.io/managed-by=openshift-github-connector
              github-connector.openshift.io/created-by=kubeadmin
              github-connector.openshift.io/subtype=github-installation-token
Annotations:  created-at: 2021-07-15T13:30:55.039Z
              github-connector.openshift.io/expires-at: 2021-07-15t14-30-54z
              updated-at: 2021-07-15T13:30:55.039Z

Type:  Opaque

Data
====
expires_at:   20 bytes
permissions:  61 bytes
token:        40 bytes