an image artifact may name its own build context, apart from the module's repository
route-proxy's own Dockerfile documents the shape it has always needed and
never had: 'the proxy source is not vendored here... the build context is
the mesh-controller repository root, and this Dockerfile compiles
./examples/route-proxy from it.' Nothing in the mesh could do that — the
build command clones one repository and builds every artifact from
within it, so route-proxy has never once been built through the pipeline,
consistent with it never having been assigned anywhere. Found attempting
exactly that build tonight: 'stat go.mod: file does not exist', because
the context was mesh-catalog, which does not have one.
An image artifact may now carry a context: {repository, ref}, cloned
fresh alongside the module's own tree. The recipe (Dockerfile) is still
read from the module's own directory, at the module's own commit — only
docker build's own context argument moves. Packaging and source stay
exactly as separate as route-proxy's own comment already said they were,
now for real.
This commit is contained in:
@@ -447,6 +447,18 @@ type BuildsOn struct {
|
||||
Image string `json:"image,omitempty"`
|
||||
}
|
||||
|
||||
// ArtifactContext names the repository an image artifact's build context is cloned from, when
|
||||
// that is not this module's own repository.
|
||||
type ArtifactContext struct {
|
||||
// Repository is cloned fresh, the same way the module's own repository is — a working tree
|
||||
// nothing has touched, so what was built is reproducible from the two commits named rather
|
||||
// than from whatever a previous build happened to leave behind.
|
||||
Repository string `json:"repository"`
|
||||
// Ref is the branch, tag or commit of that repository to build. Empty means its own default
|
||||
// branch — the same meaning an empty module ref already has.
|
||||
Ref string `json:"ref,omitempty"`
|
||||
}
|
||||
|
||||
// Artifact is one thing built from a module's source.
|
||||
type Artifact struct {
|
||||
// Name is how resources refer to it. Local to the module.
|
||||
@@ -466,6 +478,17 @@ type Artifact struct {
|
||||
// Empty means the whole recipe, which is what a module with one image says by saying nothing.
|
||||
Target string `json:"target,omitempty"`
|
||||
|
||||
// Context names a second repository this image's build reaches into for its own source — the
|
||||
// recipe itself is still read from this module's own directory, at this module's own commit;
|
||||
// only the build context `docker build`'s final argument names comes from here instead.
|
||||
//
|
||||
// **Packaging and source are allowed to live apart.** A module that only ships the recipe for
|
||||
// source that lives elsewhere — the reference route-proxy in mesh-controller's own repository,
|
||||
// packaged as a module in the catalogue rather than vendored a second time the two copies
|
||||
// could drift from — names where that source actually is. Empty means the ordinary case: an
|
||||
// image built from this same module's own repository, the same as every other artifact.
|
||||
Context *ArtifactContext `json:"context,omitempty"`
|
||||
|
||||
// Language is what this module's code is written in, for a bundle.
|
||||
//
|
||||
// **Declared, never guessed.** Inferring it from what files happen to be present makes a
|
||||
|
||||
Reference in New Issue
Block a user