Alpine

Buildkite Packages provides registry support for Alpine-based (apk) packages for Alpine Linux operating systems.

Once your Alpine registry has been created, you can publish/upload packages (generated from your application's build) to this registry via the relevant curl command presented on your Alpine registry's details page.

To view and copy this curl command:

  1. Select Packages in the global navigation to access the Registries page.
  2. Select your Alpine registry on this page.
  3. Select Publish an Alpine Package and in the resulting dialog, use the copy icon at the top-right of the code box to copy this curl command and run it to publish a package to your Alpine registry.

This command provides:

  • The specific URL to publish a package to your specific Alpine registry in Buildkite.
  • The API access token required to publish packages to your Alpine registry.
  • The Alpine package file to be published.

Publish a package

The following curl command (which you'll need to modify as required before submitting) describes the process above to publish an apk package to your Alpine registry:

curl -X POST https://api.buildkite.com/v2/packages/organizations/{org.slug}/registries/{registry.slug}/packages \
  -H "Authorization: Bearer $REGISTRY_WRITE_TOKEN" \
  -F "file=@<path_to_file>"

where:

  • {org.slug} can be obtained from the end of your Buildkite URL, after accessing Packages or Pipelines in the global navigation of your organization in Buildkite.
  • {registry.slug} is the slug of your Alpine registry, which is the kebab-case version of your Alpine registry name, and can be obtained after accessing Packages in the global navigation > your Alpine registry from the Registries page.
  • $REGISTRY_WRITE_TOKEN is your API access token used to publish/upload packages to your Alpine registry. Ensure this access token has the Write Packages REST API scope, which allows this token to publish packages to any registry your user account has access to within your Buildkite organization.
  • <path_to_file> is the full path required to the package file. If the file is located in the same directory that this command is running from, then no path is required.

For example, to upload the file my-alpine-package_0.1.1_r0.apk from the current directory to the My Alpine packages registry in the My organization Buildkite organization, run the curl command:

curl -X POST https://api.buildkite.com/v2/packages/organizations/my-organization/registries/my-alpine-packages/packages \
  -H "Authorization: Bearer $REPLACE_WITH_YOUR_REGISTRY_WRITE_TOKEN" \
  -F "file=@my-alpine-package_0.1.1_r0.apk"

Access a package's details

An Alpine (apk) package's details can be accessed from this registry using the Packages section of your Alpine registry page.

To access your apk package's details page:

  1. Select Packages in the global navigation to access the Registries page.
  2. Select your Alpine registry on this page.
  3. On your Alpine registry page, select the package to display its details page.

The package's details page provides the following information in the following sections:

  • Installation (tab): the installation instructions.
  • Contents (tab, where available): a list of directories and files contained within the package.
  • Details (tab): a list of checksum values for this package—MD5, SHA1, SHA256, and SHA512.
  • About this version: a brief (metadata) description about the package.
  • Details: details about:

    • the name of the package (typically the file name excluding any version details and extension).
    • the package version.
    • the registry the package is located in.
    • the package's visibility (based on its registry's visibility)—whether the package is Private and requires authentication to access, or is publicly accessible.
    • the distribution name / version.
    • additional optional metadata contained within the package, such as a homepage, licenses, etc.

  • Pushed: the date when the last package was uploaded to the registry.

  • Total files: the total number of files (and directories) within the package.

  • Dependencies: the number of dependency packages required by this package.

  • Package size: the storage size (in bytes) of this package.

  • Downloads: the number of times this package has been downloaded.

Downloading a package

An Alpine (apk) package can be downloaded from the package's details page. To do this:

  1. Access the package's details.
  2. Select Download.

Installing a package

An Alpine package can be installed using code snippet details provided on the package's details page. To do this:

  1. Access the package's details.
  2. Ensure the Installation > Installation instructions section is displayed.
  3. For each required command in the relevant code snippets, copy the relevant code snippet, paste it into your terminal, and run it.

The following set of code snippets are descriptions of what each code snippet does and where applicable, its format:

Registry configuration

Step 1: Configure your Alpine registry as the source for your Alpine (apk) packages:

echo "https://buildkite:{registry.read.token}@packages.buildkite.com/{org.slug}/{registry.slug}/alpine_any/alpine_any/main" >> /etc/apk/repositories

where:

  • {registry.read.token} is your API access token or registry token used to download packages from your Alpine registry. Ensure this access token has the Read Packages REST API scope, which allows this token to download packages from any registry your user account has access to within your Buildkite organization. This URL component, along with its surrounding buildkite: and @ components are not required for registries that are publicly accessible.
  • {org.slug} can be obtained from the end of your Buildkite URL, after accessing Packages or Pipelines in the global navigation of your organization in Buildkite.
  • {registry.slug} is the slug of your Debian registry, which is the kebab-case version of your Debian registry name, and can be obtained after accessing Packages in the global navigation > your Debian registry from the Registries page.

Step 2: Install the registry signing key:

wget -O /etc/apk/keys/{org.uuid}_{registry.uuid}.rsa.pub "https://buildkite:{registry.read.token}@packages.buildkite.com/{org.slug}/{registry.slug}/rsakey"

where:

  • {org.uuid} is the UUID of your Buildkite organization. This value can be obtained from this Alpine package Installation instructions page section. Alternatively, you can also obtain this value:

    • From your organization's Pipeline Settings page. To do this:
      1. Select Settings in the global navigation to access the Organization Settings page.
      2. Select Pipelines > Settings to access the Pipeline Settings page.
      3. At the end of the page, copy the value from the Organization UUID field.
    • By running the getCurrentUsersOrgs GraphQL query to obtain the relevant organization UUID value in the response for the current user's accessible organizations:

      query getCurrentUsersOrgs {
        viewer {
          organization {
            edges {
              node {
                name
                id
                uuid
              }
            }
          }
        }
      }
      
  • {registry.uuid} is the UUID of your Alpine registry. Again, this value can be obtained from this Alpine package Installation instructions page section. Alternatively, you can also obtain this value:

    • From your registry's Settings page. To do this:
      1. Select Packages in the global navigation to access the Registries page.
      2. Select your Alpine registry on this page.
      3. Select Settings to open the registry's Settings page.
      4. Copy the UUID shown in the API Integration section of this page, which is this {registry.uuid} value.
    • By running the getOrgRegistries GraphQL query to obtain the registry UUID values of your {org.slug} in the response:

      query getOrgRegistries {
        organization(slug: "{org.slug}") {
          registries(first: 20) {
            edges {
              node {
                name
                id
                uuid
              }
            }
          }
        }
      }
      
  • buildkite:{registry.read.token}@ while these values are the same as those in the previous step for configuring your Alpine registry source, this component is not required for registries that are publicly accessible.

Step 3: Retrieve the latest apk indices:

apk update

Package installation

Use apk to install the package:

apk add package-name==version-number

where:

  • package-name is the name of your package.

  • version-numnber is the version number of this package.