Connectors
Link GitHub, GitLab, or a container registry to a person or a team, so pipelines, workspaces, builds, and environments use it.
Last updated
On this page
Overview
A connector links one provider account to an owner. The owner is a person or a team. Pipelines use the link without a token that you paste.
GitHub is the first provider, and container registries are the second. A connector installs the Kode GitHub App on your GitHub account or organization. Kode keeps no GitHub token. It asks GitHub for a short-lived token when a job needs one.
| Part | What it is |
|---|---|
| Connector | The link between an owner and one GitHub account. It has a name, such as acme-github-1. |
| State | connected, expired, or revoked. Only a connected connector works. |
A person's connector belongs to that person. A team's connector belongs to the team. Any active member can list the connectors of a team. Only a team admin or owner can connect or disconnect.
A GitHub account connects to one owner. A second owner that connects the same account gets the error This GitHub account is already connected to another owner.
To do these tasks with an AI agent, see Agentic workflows.
What Kode reads and writes
A GitHub or GitLab connector gives git read access to the pipeline jobs of its owner. It also gives git read access to the workspaces, capsules, and device workspaces of its person. A team connector gives it to those of every member of the team. The own connector of a member comes first. Kode writes nothing to the provider.
| Right | Use |
|---|---|
| Read repository contents | git clone and git fetch over HTTPS in a job with permissions.git: read, a workspace, or a capsule. See Git in pipeline jobs. |
A provider event, such as a push or a pull request, starts no run. A run starts by hand, on a schedule, from a webhook, or after another pipeline.
GitLab
A GitLab connector links one gitlab.com account to an owner. You sign in on GitLab and approve the Kode app.
After you connect, pick the projects to use in the Projects list of the connector. The list shows your projects, most recently active first. Type in the search box to narrow the list. Select Load more for the next fifty.
Kode lists only the projects where you are a Maintainer or Owner. It needs that role to make deploy tokens. If the list is empty, you hold no such project on this account.
Tick a project to use it, and select Save projects. Each git credential request makes a read-only deploy token on the ticked project. The token ends one hour after the request at most. Nothing revokes it when the job ends.
Clear the box of a project to remove its tokens. A save also removes a webhook that an earlier version made. The projects that you picked stay ticked while you search. If a save fails, the page shows the reason that Kode gives.
If the list cannot load, the page shows a box where you type the project as group/name.
Connect and reconnect
You connect in the web console. A terminal cannot show the consent page of GitHub, so no command connects an account. The console shows each connector as connected, expired, or revoked.
A connector becomes expired or revoked when GitHub removes the installation or the sign-in stops working. The console then shows Reconnect. The connector keeps its name.
Disconnect
A disconnect removes the connector. Kode uninstalls the app when it can, and deletes the stored data of the connector. A git command of a running job then gets no credential, and the log shows kd git-credential: no git connector of OWNER covers HOST/REPOSITORY. A registry login of a running job fails with connector NAME is gone.
Git in pipeline jobs
A job with permissions.git: read runs plain git clone https://github.com/OWNER/NAME in a step. Git asks the Kode credential helper for a credential each time, and the helper asks Kode.
| Host | Connector | Credential |
|---|---|---|
github.com | The GitHub connector of the account in the path. | A token for every repository that the app is installed on, with read access. It lasts one hour. |
gitlab.com | The GitLab connector that picked the project. | A read-only deploy token on that one project. It lasts one hour at most. |
A job with git: read can read every repository that the GitHub App is installed on, a webhook run included. Install the app only on the repositories that pipelines need.
The credentials are HTTPS only and read-only. A pipeline of a team uses only the connectors of the team. Kode makes no credential for other hosts. For them, put a personal access token from a Kode secret in the clone URL. A pull request cannot change the pipeline that tests it, because a pipeline is not stored in a repository. The rules and their errors are in Code in a job.
Container registries
A registry connector holds a login for a container registry. The registries are Docker Hub, GitHub Container Registry (GHCR), Azure Container Registry (ACR), Amazon ECR, Google Artifact Registry (GAR), and other OCI registries. You paste the credential in the console. Kode signs in to the registry with it before it keeps anything. For a pasted login, it signs in again every hour. A registry that refuses the credential turns the connector to expired.
| Provider | Host | Least credential |
|---|---|---|
| Docker Hub | docker.io | An access token with Read & Write on the one repository that you push to. |
| GHCR | ghcr.io | A personal access token with the scope write:packages, and your GitHub user name. |
| ACR | NAME.azurecr.io | A token with a scope map for the one repository. |
| Amazon ECR | ACCOUNT.dkr.ecr.REGION.amazonaws.com | An IAM role with an external ID, and an access key that can only assume it. |
| GAR | REGION-docker.pkg.dev | A service account with the role roles/artifactregistry.writer on the one repository. |
| Another OCI registry | Any host name | A robot account for the repositories that you use. |
A broader credential works too. Kode never shows the secret again.
For Amazon ECR and GAR, the credential that you paste is a root credential. Kode never hands it out. It keeps the root credential. It asks AWS or Google for a short login each time that a build, a pull or a job needs one. An ECR login lasts 12 hours. A GAR login lasts 1 hour.
For ECR without a role, give the access key ecr:GetAuthorizationToken on all resources. Also give it the push and pull actions on the named repositories only. The console shows the full policy.
Kode does not sign in to GHCR through the GitHub connector until a superadmin turns it on. Until then, paste a personal access token.
| Use | Connector that it takes |
|---|---|
kd container build and kd container push in your workspace | Yours first, then the connectors of the team of the workspace. |
| An environment that pulls a private image | Those of the team that owns the environment. |
A pipeline job with permissions: { registry: push } | Those of the owner of the pipeline. |
The connector of another member is never used. kd and docker-credential-kd ask Kode for a login each time, so a workspace holds no registry secret. With no registry connected, the commands answer no registry is configured.
Tasks
Connect GitHub
Reason for the task
Link a GitHub account or organization to a person or a team.
Job set-up
- Access: you. For a team, a team member with the role
adminor higher. - References:
GET /v1/connectors.
Procedure
- Open Connectors in your profile settings. For a team, open Connectors in the settings of the team.
- Select Connect GitHub.
- Install the Kode GitHub App on the account. Choose the repositories that pipelines use.
- Sign in to GitHub when it asks, to prove who you are.
Close-out
- List the connectors as in task 004. Make sure that the new connector is
connected.
Reconnect a connector
Reason for the task
Restore a connector that is expired or revoked.
Job set-up
- Access: you. For a team, a team member with the role
adminor higher. - References:
GET /v1/connectors.
Procedure
- Open Connectors in your profile settings. For a team, open Connectors in the settings of the team.
- Select Reconnect in the row of the connector.
- Install the Kode GitHub App again. Sign in to GitHub when it asks.
Close-out
- List the connectors as in task 004. Make sure that the connector is
connected.
Disconnect a connector
Reason for the task
Remove the link to a GitHub account that pipelines no longer use.
Job set-up
- Access: you. For a team, a team member with the role
adminor higher. - References:
DELETE /v1/connectors/{name},kode connectors remove.
Jobs that use the connector stop getting credentials. A git command of a running job fails at its next credential request.
Procedure
Remove the connector
acme-github-1. In the console, select Disconnect and type the name.from kloudlite import Kodekl = Kloudlite()kl.connectors.delete(name="acme-github-1")import { Kode } from "./index.ts";const kl = new Kloudlite();await kl.connectors.delete({ name: "acme-github-1" });kl := kloudlite.New(kloudlite.Options{})if err := kl.Connectors.Delete("acme-github-1"); err != nil { log.Fatal(err)}require_relative "kloudlite"kl = Kloudlite::Client.newkl.connectors.delete(name: "acme-github-1")var kl = new Kloudlite();kl.connectors().delete("acme-github-1");kode connectors remove acme-github-1
Close-out
- List the connectors as in task 004. Make sure that the connector is not in the list.
List the connectors
Reason for the task
Find the connectors of an owner, and the state of each one.
Job set-up
- Access: you. For a team, a team member whose access is not paused.
- References:
GET /v1/connectors,kode connectors list.
Procedure
List the connectors of the team
acme. For your own, leave out the owner.from kloudlite import Kodekl = Kloudlite()print(kl.connectors.list(owner="acme"))import { Kode } from "./index.ts";const kl = new Kloudlite();console.log(await kl.connectors.list({ owner: "acme" }));kl := kloudlite.New(kloudlite.Options{})rows, err := kl.Connectors.List("acme")if err != nil { log.Fatal(err)}fmt.Println(rows)require_relative "kloudlite"kl = Kloudlite::Client.newputs kl.connectors.list(owner: "acme")var kl = new Kloudlite();System.out.println(kl.connectors().list("acme"));kode connectors list --owner acme
Close-out
- Read the output. It shows the name, provider, account, and state, and never a token.
Connect a container registry
Reason for the task
Let builds push to a registry, and environments and pipelines pull from it.
Job set-up
- Access: you. For a team, a team member with the role
adminor higher. - References:
POST /v1/connectors/{name},kd container build.
Procedure
- Create a token or a robot account in the registry. Give it the least rights that you need.
- Open Connectors in your profile settings. For a team, open Connectors in the settings of the team.
- Select the registry in Add a container registry.
- Enter the host if the form asks, the path prefix, the user name, and the secret.
- Enter the region, the access key ID, and the secret access key for Amazon ECR. Add the role ARN to use a role.
- Enter the region, the path as
PROJECT/REPOSITORY, and the JSON key of the service account for GAR. - Select Connect.
Close-out
- List the connectors as in task 004. Make sure that the new connector is
connected.
Troubleshooting
| Symptom | Possible cause | Corrective action |
|---|---|---|
The connect link expired or was opened in another browser. Start again. | The link lasts 10 minutes and works only in the browser that started it. | Connect GitHub again in one browser. |
That connect link was already used. Start again. | Each link works once. | Connect GitHub again. |
Only a team admin can connect an account for the team. | Your role in the team is lower than admin. | Ask a team admin to connect the account. |
The app was not installed on an account. Install it and try again. | You left the GitHub page before the install finished. | Connect GitHub again, and finish the install. |
This GitHub account is already connected to another owner. | Another person or team holds the link to this account. | Disconnect the account from the other owner, then connect it. |
This owner has reached the connector limit. Disconnect one first. | The owner has as many connectors as Kode allows. | Disconnect a connector that you do not use. |
kd git-credential: no git connector of OWNER covers HOST/REPOSITORY | No connected connector of the owner reaches the repository. | Connect GitHub, or pick the project on the GitLab connector. |
connector NAME is gone | The registry connector was removed while a run used it. | Connect a container registry again, and start the run again. |
| A push starts no run | A provider event never starts a run. | Use a schedule, a webhook, or an after trigger. See Triggers and inputs. |
the registry refused this credential | The user name or the secret is wrong, or the token has too few rights. | Connect a container registry again with a correct credential. |
the registry refused the credential; paste a new one | The registry stopped accepting the stored credential. | Disconnect the connector, then connect the registry again. |
an access key id, a secret access key and a region such as us-east-1 are required | The ECR form lacks a value. | Fill in the three values, and connect again. |
the service account key is not a Google service account JSON key | The pasted text is not the JSON key of a service account. | Create a JSON key for the service account, and paste all of it. |
GHCR sign-in through GitHub is not enabled | Only a pasted token signs in to GHCR on this region. | Paste a personal access token with the scope write:packages. |
an ACR host must end in .azurecr.io | The host is not an Azure Container Registry host. | Enter the host as NAME.azurecr.io. |
no registry is configured | You and your team have no connected registry. | Connect a container registry. |
several registries are connected: NAMES; pass --registry | More than one registry fits, and none is only yours. | Add --registry with one of the names. |