Back to Buildpacks

Declare Source Metadata

content/docs/for-platform-operators/how-to/build-inputs/declare-source-metadata.md

latest3.4 KB
Original Source

+++ title="Declare source metadata" aliases=[ "/docs/platform-guide/conventions/source-metadata" ] weight=3 summary="Declare information about application source code, to be included as metadata in the application image." tags=["spec:platform/0.6", "spec:project-descriptor/0.2"] +++

Summary

The following are conventions for declaring different type of source inputs. This information is provided to the lifecycle using project-metadata.toml.

Sources

Types

The following types are concrete source types and can use any keys as long as they don't overlap with additive sources.

Git

  • type (string, required)

    Must be git

  • source (required)

    • version (required)

      • commit (string, required)
        Full commit hash

      • describe (string, optional)
        Description of commit (see git describe)

    • metadata (optional)

      • repository (string, optional)
        Repository URL

      • refs (list of strings, optional)
        Additional relevant Git references

Example
toml
[source]
type = "git"

  [source.version]
  commit = "63a73f1b0f2a4f6978c19184b0ea33ad3f092913"
  describe = "v0.18.1-2-g3f092913"

  [source.metadata]
  repository = "https://github.com/myorg/myrepo.git"
  refs = ["master", "v3.0"]

Image

  • type (string, required)

    Must be image

  • source (required)

    • version (required)

      • digest (string, required)
        Image digest
    • metadata (optional)

      • path (string, optional)
        Absolute path to source in image

      • repository (string, optional)
        Fully-qualified image name

      • refs (list of strings, optional)
        Additional relevant image names/tags

Example
toml
[source]
type = "image"

  [source.version]
  digest = "146c4bce42545e6a4575283b32a7f01924ef86ce848273079693a42b52b27321"

  [source.metadata]
   path = "/source"
   repository =  "index.docker.io/example/image:latest"
   refs = ["index.docker.io/example/image:mytag", "index.docker.io/example/image@sha256:146c4bce42545e6a4575283b32a7f01924ef86ce848273079693a42b52b27321"]

Additive

The following source information is considered additive and should not overlap with source types.

project.toml

  • type (string, required)

    Must be project (only if no other type is present)

  • source (required)

    • version (required)

      • version (string, optional)
        Version as declared in _.version
    • metadata (optional)

      • url (string, optional)
        URL as declared in _.source-url
Example (standalone)
toml
[source]
type = "project"

  [source.version]
  version = "1.2.3"

  [source.metadata]
  url = "https://github.com/example/repo"
Example (w/ Image)
toml
[source]
type = "image"

  [source.version]
  digest = "146c4bce42545e6a4575283b32a7f01924ef86ce848273079693a42b52b27321"
  version = "1.2.3"

  [source.metadata]
  path = "/source"
  repository =  "index.docker.io/example/image:latest"
  refs = ["index.docker.io/example/image:mytag", "index.docker.io/example/image@sha256:146c4bce42545e6a4575283b32a7f01924ef86ce848273079693a42b52b27321"]
  url = "https://github.com/example/repo"