|
| 1 | ++++ |
| 2 | +title="Source Metadata" |
| 3 | +weight=1 |
| 4 | +summary="Conventions for declaring app source information in the app image." |
| 5 | +tags=["spec:platform/0.6", "spec:project-descriptor/0.2"] |
| 6 | ++++ |
| 7 | + |
| 8 | +## Summary |
| 9 | + |
| 10 | +The following are conventions for declaring different type of source inputs. This information is provided to the [lifecycle][lifecycle] using [project-metadata.toml][project-metadata]. |
| 11 | + |
| 12 | +## Sources |
| 13 | + |
| 14 | +### Types |
| 15 | + |
| 16 | +The following types are concrete source types and can use any keys as long as they don't overlap with [additive](#additive) sources. |
| 17 | + |
| 18 | +#### Git |
| 19 | + |
| 20 | +- #### `type` _(string,required)_ |
| 21 | + Must be `git` |
| 22 | + |
| 23 | +- #### `source` _(required)_ |
| 24 | + |
| 25 | + - `version` _(required)_ |
| 26 | + |
| 27 | + - `commit` _(string,required)_\ |
| 28 | + Full commit hash |
| 29 | + |
| 30 | + - `describe` _(string,optional)_\ |
| 31 | + Description of commit (see `git describe`) |
| 32 | + |
| 33 | + - `metadata` _(optional)_ |
| 34 | + |
| 35 | + - `repository` _(string,optional)_\ |
| 36 | + Repository URL |
| 37 | + |
| 38 | + - `refs` _(string,optional)_\ |
| 39 | + Additional relevant Git references |
| 40 | + |
| 41 | +###### Example |
| 42 | + |
| 43 | +```toml |
| 44 | +[source] |
| 45 | +type = "git" |
| 46 | + |
| 47 | + [source.version] |
| 48 | + commit = "63a73f1b0f2a4f6978c19184b0ea33ad3f092913" |
| 49 | + describe = "v0.18.1-2-g3f092913" |
| 50 | + |
| 51 | + [source.metadata] |
| 52 | + repository = "https://github.com/myorg/myrepo.git" |
| 53 | + refs = ["master", "v3.0"] |
| 54 | +``` |
| 55 | + |
| 56 | +#### Image |
| 57 | + |
| 58 | +- #### `type` _(string,required)_ |
| 59 | + Must be `image` |
| 60 | + |
| 61 | +- #### `source` _(required)_ |
| 62 | + |
| 63 | + - `version` _(required)_ |
| 64 | + |
| 65 | + - `digest` _(string,required)_\ |
| 66 | + Image digest |
| 67 | + |
| 68 | + - `metadata` _(optional)_ |
| 69 | + |
| 70 | + - `path` _(string,optional)_\ |
| 71 | + Absolute path to source in image |
| 72 | + |
| 73 | + - `repository` _(string,optional)_\ |
| 74 | + Fully-qualified image name |
| 75 | + |
| 76 | + - `refs` _(string,optional)_\ |
| 77 | + Additional relevant image names/tags |
| 78 | + |
| 79 | +###### Example |
| 80 | + |
| 81 | +```toml |
| 82 | +[source] |
| 83 | +type = "image" |
| 84 | + |
| 85 | + [source.version] |
| 86 | + digest = "146c4bce42545e6a4575283b32a7f01924ef86ce848273079693a42b52b27321" |
| 87 | + |
| 88 | + [source.metadata] |
| 89 | + path = "/source" |
| 90 | + repository = "index.docker.io/example/image:latest" |
| 91 | + refs = ["index.docker.io/example/image:mytag", "index.docker.io/example/image@sha256:146c4bce42545e6a4575283b32a7f01924ef86ce848273079693a42b52b27321"] |
| 92 | +``` |
| 93 | + |
| 94 | +### Additive |
| 95 | + |
| 96 | +The following source information is considered additive and should not overlap with source [types](#types). |
| 97 | + |
| 98 | +#### `project.toml` |
| 99 | + |
| 100 | +- #### `type` _(string,required)_ |
| 101 | + Must be `project` **(only if no other type is present)** |
| 102 | + |
| 103 | +- #### `source` _(required)_ |
| 104 | + |
| 105 | + - `version` _(required)_ |
| 106 | + |
| 107 | + - `version` _(string,optional)_\ |
| 108 | + Version as declared in `_.version` |
| 109 | + |
| 110 | + - `metadata` _(optional)_ |
| 111 | + |
| 112 | + - `url` _(string,optional)_\ |
| 113 | + URL as declared in `_.source-url` |
| 114 | + |
| 115 | +###### Example (standalone) |
| 116 | + |
| 117 | +```toml |
| 118 | +[source] |
| 119 | +type = "project" |
| 120 | + |
| 121 | + [source.version] |
| 122 | + version = "1.2.3" |
| 123 | + |
| 124 | + [source.metadata] |
| 125 | + url = "https://github.com/example/repo" |
| 126 | +``` |
| 127 | + |
| 128 | +###### Example (w/ Image) |
| 129 | + |
| 130 | +```toml |
| 131 | +[source] |
| 132 | +type = "image" |
| 133 | + |
| 134 | + [source.version] |
| 135 | + digest = "146c4bce42545e6a4575283b32a7f01924ef86ce848273079693a42b52b27321" |
| 136 | + version = "1.2.3" |
| 137 | + |
| 138 | + [source.metadata] |
| 139 | + path = "/source" |
| 140 | + repository = "index.docker.io/example/image:latest" |
| 141 | + refs = ["index.docker.io/example/image:mytag", "index.docker.io/example/image@sha256:146c4bce42545e6a4575283b32a7f01924ef86ce848273079693a42b52b27321"] |
| 142 | + url = "https://github.com/example/repo" |
| 143 | +``` |
| 144 | + |
| 145 | +[lifecycle]: /docs/concepts/components/lifecycle/ |
| 146 | +[project-metadata]: https://github.com/buildpacks/spec/blob/platform/0.7/platform.md#project-metadatatoml-toml |
0 commit comments