Create components without SCM integration

3 minute read

Use the v4 Component API to create a component directly from a repository URL, without first configuring an SCM integration. Use this if your source code is behind a VPN or firewall, and you still want component-level visibility and Jenkins job discovery through CloudBees CI.

Without an SCM integration, CloudBees Unify doesn’t read any data directly from the repository. Pipeline job data appears only when an external CI/CD tool reports it against the component, either through the CloudBees CI integration on CloudBees Unify or by calling the Run APIs directly. For the full list of limitations when no SCM integration is attached, refer to Components without SCM integration.

Before you begin, generate a personal access token to authenticate your requests. For instructions, refer to Manage personal access tokens. You also need the organization ID that will own the component. For instructions, refer to Locate organization ID.

All requests use the base URL https://api.cloudbees.io and authenticate with the personal access token as a bearer token.

Create a component

Send a POST request to /v4/organizations/{orgId}/components.

Table 1. Fields
Field Required? Description

name

Yes

Display name for the component.

repositoryUrl

Yes

Repository clone URL, in the format https://github.com/org/repo.git. This is the identity of the component and can’t be changed after creation. CloudBees Unify matches incoming pipeline job data to the component using this URL.

description

No

Optional free-text description. Mutable via PATCH after creation, but can’t be cleared back to empty once set; sending an empty value leaves the existing description unchanged.

provider

No

The SCM provider backing the repository. Inferred from the repositoryUrl hostname for known public providers. Supply this explicitly for self-hosted providers: GITHUB, GITHUB_ENTERPRISE, GITLAB, GITLAB_SERVER, BITBUCKET, BITBUCKET_DATACENTER, or GERRIT. Without an SCM integration, you can also supply any other provider as a free-text value, containing letters, digits, and hyphens, up to 63 characters. CloudBees Unify returns this value uppercased, for example, codecommit becomes CODECOMMIT.

defaultBranch

No

Default branch for the repository. Defaults to main if omitted.

integrationId

No

ID of an existing SCM integration to attach at creation. If you provide a valid ID, the component is created with that integration attached. If omitted, CloudBees Unify checks for an existing SCM integration that has access to repositoryUrl, and attaches it automatically if found; otherwise the component is created without an integration. Find an integration’s ID in CloudBees Unify under Configuration  Integration, listed for each integration.

The response contains the new component’s id. Capture this value to get, update, or delete the component later. For an example, refer to Example: Create a component.

List and view components

To list components in an organization, send a GET request to /v4/organizations/{orgId}/components. Filter the results with the name, repositoryUrl, or provider query parameters, and page through large result sets with pageSize and pageToken.

To view a single component, send a GET request to /v4/organizations/{orgId}/components/{id}. For examples, refer to Example: List and filter components and Example: Retrieve a single component.

Update or delete a component

To rename a component, change its default branch, or attach an SCM integration, send a PATCH request to /v4/organizations/{orgId}/components/{id} with only the fields to change. For an example, refer to Example: Update a component.

To detach an already-attached SCM integration and return the component to integration-less state, send the same PATCH request with the removeIntegration=true query parameter instead of a body.

To delete a component, send a DELETE request to /v4/organizations/{orgId}/components/{id}. For an example, refer to Example: Delete a component.

Deleting a component is irreversible.

Upgrade to a full SCM integration later

When you configure an SCM integration that has access to an existing integration-less component’s repository, CloudBees Unify attaches it to that component automatically and upgrades it to a regular, fully integrated component. No data migration or manual steps are needed. To see this entire lifecycle end-to-end, including reporting a run against the integration-less component before the upgrade, refer to Example end-to-end use case, onboard a component without SCM and upgrade it later.