@wtf/release-oci 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mikael Karon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,111 @@
1
- # Temporary Holding Version
1
+ # @wtf/release-oci
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Releases the OCI images of a repo in trains, with no release tool and no rebuild. A pipeline builds
4
+ and tests an image; a release copies that tested image, by its digest, to the tags of its version
5
+ in the registry, so the bytes released are the bytes tested. This library reads the images of a
6
+ repo for the trains, finds the tested image of each, and copies it to the tags of a release by
7
+ [crane](https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md). It is the
8
+ library of [`@wtf/semantic-release-oci`](../semantic-release-oci/README.md), with no dependency on
9
+ semantic-release; each function runs `git` and `crane` by the `System` of
10
+ [`@wtf/release-system/system`](../release-system/README.md) its caller gives it.
11
+
12
+ ## The ecosystem
13
+
14
+ Its default export is the ecosystem of OCI images, `ociEcosystem` of `./ecosystem`, an `Ecosystem`
15
+ of [`@wtf/release-trains/ecosystem`](../release-trains/README.md), which a config names in
16
+ `ecosystems` as `'@wtf/release-oci'`. The trains then read the images of the repo as they read npm
17
+ packages and crates: which train holds each, the order of the trains, and the checks of a release
18
+ ([Ecosystems](../docs/guides/ecosystems.md)).
19
+
20
+ - `packages` gives a package for each folder of a file an image is built of that git tracks: a
21
+ `Dockerfile` or a `Containerfile`, or a `.devcontainer/devcontainer.json`, which the devcontainer
22
+ CLI builds. A folder of more than one of them is one image. Its name is its repository in the
23
+ registry: the registry image of the project, `CI_REGISTRY_IMAGE` of a pipeline, for an image at
24
+ the root, and that and its folder for another, as GitLab names the images of a project; its
25
+ folder where the environment names no registry image. Every image is published, and none depends
26
+ on another: a `FROM` or a base pins a tag of a registry, not a package of the repo. It reads the
27
+ working tree by default, or a commit by `git ls-tree`.
28
+ - `resolve` gives the tag a release publishes, the version itself: `1.4.0` for `1.4.0`.
29
+ - `satisfies` takes a tag of the one version it names.
30
+
31
+ ```ts
32
+ import oci from '@wtf/release-oci'
33
+ import type { System } from '@wtf/release-system/system'
34
+
35
+ oci.resolve('0.0.0', '1.4.0') // '1.4.0'
36
+ oci.satisfies('1.4.0', '1.4.0') // true
37
+
38
+ /** The images of the repo at the tag of a release, as the trains read them. */
39
+ export const imagesAt = (system: System, tag: string) => oci.packages({ system, ref: tag })
40
+ ```
41
+
42
+ ## What a release of images is
43
+
44
+ No version is written into git: the tags of the registry are the versions. A release of a train
45
+ does this:
46
+
47
+ - `readImages` (`./images`) reads the images of the files git tracks; `imagesAt` reads them at a
48
+ commit.
49
+ - `ownersOf` of `@wtf/release-trains/packages` gives each image its train.
50
+ - `smokeImages` (`./publish`) finds the tested image of each, its source, by its digest
51
+ (`crane digest`), and the platforms of its index (`crane manifest`). A source the registry has
52
+ not, or of fewer platforms than the release asks, fails (`EOCISMOKE`).
53
+ - `publishImages` copies the digest of each source to the tags of the release
54
+ (`crane copy <source>@<digest> <image>:<tag>`), which mounts each blob of the source's repository
55
+ rather than moving it. The tag of the version is copied once: a registry that has it at the same
56
+ digest is skipped, so a release that stopped part way is finished by running it again, and at
57
+ another digest is refused (`EOCIRETAG`), as a released version never moves.
58
+ - `registryPageOf` (`./registry`) gives the page of each image in the container registry of GitLab,
59
+ which the GitLab release of the tag links it by.
60
+
61
+ ## The tags of a release
62
+
63
+ `tagsOfRelease` (`./tags`) gives the version, and of a release, the minor and the major, which move
64
+ to each release of their line, so a consumer that pins `1` takes each fix and feature of 1.x:
65
+
66
+ | Version | Tags |
67
+ | -------------- | ------------------- |
68
+ | `1.4.2` | `1.4.2`, `1.4`, `1` |
69
+ | `0.3.1` | `0.3.1`, `0.3` |
70
+ | `8.0.0-next.1` | `8.0.0-next.1` |
71
+
72
+ A minor of the major `0` breaks what the one before gave, so a release of `0.x` moves its minor
73
+ alone; a prerelease moves no tag.
74
+
75
+ ```ts
76
+ import { tagsOfRelease } from '@wtf/release-oci/tags'
77
+
78
+ export const tags = tagsOfRelease('1.4.2') // ['1.4.2', '1.4', '1']
79
+ ```
80
+
81
+ ## The version in an image
82
+
83
+ A release stamps nothing: the image a pipeline tested is the image it publishes. A pipeline that
84
+ labels an image of the version it will be, as `org.opencontainers.image.version`, reads the next
85
+ version of its train of the dotenv `semantic-release-info` of
86
+ [`@wtf/semantic-release-trains`](../semantic-release-trains/README.md) writes, and passes it to the
87
+ build as an argument of its own.
88
+
89
+ ## Subpaths
90
+
91
+ | Subpath | What it is |
92
+ | ------------- | ---------------------------------------------------------------------------------- |
93
+ | `.` | `OciImage`, and the ecosystem as the default export |
94
+ | `./ecosystem` | `ociEcosystem`, `packagesOfImages`, `packagesOfRepo`, `resolveTag`, `satisfiesTag` |
95
+ | `./images` | `readImages`, `imagesAt`, `imagesOf`, `imageDirOf`, `repositoryOf` |
96
+ | `./tags` | `tagsOfRelease`, `releaseTagsOf` |
97
+ | `./publish` | `smokeImages`, `publishImages`, `digestOf`, `platformsOf` |
98
+ | `./registry` | `registryPageOf` |
99
+ | `./errors` | `OciError`, `OCI_ERRORS` |
100
+
101
+ ## Errors
102
+
103
+ | Code | Means |
104
+ | --------------- | ----------------------------------------------------------------------------- |
105
+ | `EOCIECOSYSTEM` | `ecosystems` lists neither `@wtf/semantic-release-oci/ecosystem` nor this |
106
+ | `EOCIIMAGE` | An image has no repository: neither `image` nor `CI_REGISTRY_IMAGE` names one |
107
+ | `EOCISOURCE` | The tested image has no tag: neither `sourceTag` nor `CI_COMMIT_REF_SLUG` |
108
+ | `EOCISMOKE` | The registry has not the tested image, or crane cannot ask it |
109
+ | `EOCIRETAG` | The registry has the version already, at another digest |
110
+ | `EOCITAG` | crane cannot copy the tested image to a tag |
111
+ | `EOCILINK` | GitLab cannot give the page of an image in its container registry |
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The ecosystem of OCI images ({@link ociEcosystem}), as the trains read it, and the default export
3
+ * of the package, which a config names in `ecosystems` as `'@wtf/release-oci'`: the images of the
4
+ * repo, each folder of a file an image is built of that git tracks ({@link packagesOfRepo}), of the
5
+ * working tree or of a commit; a repo of none has none. An image names no other image of the repo
6
+ * as a dependency the trains could read: a `FROM` or a base pins a tag of a registry, not a package
7
+ * of the repo. A range of an image is a tag: a release publishes the version itself
8
+ * ({@link resolveTag}), which takes that version alone ({@link satisfiesTag}).
9
+ *
10
+ * ```js
11
+ * // release.config.mjs
12
+ * export default {
13
+ * trains: {
14
+ * base: { paths: ['images/base'] },
15
+ * release: { paths: ['images/release'] }
16
+ * },
17
+ * ecosystems: ['@wtf/release-oci']
18
+ * }
19
+ * ```
20
+ *
21
+ * @packageDocumentation
22
+ * @module @wtf/release-oci/ecosystem
23
+ */
24
+ import type { Ecosystem, EcosystemContext, Package } from '@wtf/release-trains/ecosystem';
25
+ import type { OciImage } from './index.ts';
26
+ /** An image as the trains read it: a package of the trains, and the image it is of. */
27
+ export interface OciPackage extends Package {
28
+ /** The image, as `readImages` of `./images` gives it. */
29
+ readonly image: OciImage;
30
+ }
31
+ /**
32
+ * The images of the repo as the trains read them: each a package named by its repository, or by its
33
+ * folder where the environment names no registry image; of its folder and the file it is built of;
34
+ * published, as every image a pipeline builds is; and of no dependency.
35
+ *
36
+ * @param images - The images of the repo, as `readImages` of `./images` gives them.
37
+ * @returns The packages, one of each image, in the order of `images`.
38
+ */
39
+ export declare function packagesOfImages(images: readonly OciImage[]): OciPackage[];
40
+ /**
41
+ * The tag a release publishes of an image of `version`, the release of its train: the version
42
+ * itself, as `1.4.0`. No image of the repo names another as a dependency, so a range is never read
43
+ * of a manifest.
44
+ *
45
+ * @param _range - The tag before the release, as a manifest would write it.
46
+ * @param version - The release of the image, as `1.4.0`.
47
+ * @returns The tag, as `1.4.0`.
48
+ */
49
+ export declare const resolveTag: (_range: string, version: string) => string;
50
+ /**
51
+ * Whether `version` is the one `tag` names: a tag of an image names one version, and a moving tag,
52
+ * as `1`, is no range the trains read.
53
+ *
54
+ * @param tag - A tag, as `1.4.0`.
55
+ * @param version - A version, as `1.4.0`.
56
+ * @returns Whether they are the same version.
57
+ */
58
+ export declare const satisfiesTag: (tag: string, version: string) => boolean;
59
+ /**
60
+ * The images of the repo of `context` as the trains read them, of the commit `ref` where it names
61
+ * one, else of the working tree.
62
+ *
63
+ * @param context - The folder of the repo, its environment, the system, and the commit.
64
+ * @returns The packages, one of each image.
65
+ * @throws `EGIT` of a commit git has not.
66
+ */
67
+ export declare function packagesOfRepo(context: EcosystemContext): Promise<OciPackage[]>;
68
+ /**
69
+ * The ecosystem of OCI images: its packages, the images of the repo, of the working tree or of a
70
+ * commit ({@link packagesOfRepo}); a tag published as the version ({@link resolveTag}); and a tag
71
+ * of one version ({@link satisfiesTag}).
72
+ */
73
+ export declare const ociEcosystem: Ecosystem;
74
+ //# sourceMappingURL=ecosystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ecosystem.d.ts","sourceRoot":"","sources":["../src/ecosystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAEzF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAG1C,uFAAuF;AACvF,MAAM,WAAW,UAAW,SAAQ,OAAO;IACzC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,GAAG,UAAU,EAAE,CAS1E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,SAAS,MAAM,KAAG,MAAiB,CAAA;AAE9E;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,KAAG,OACP,CAAA;AAErD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAIrF;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,SAK1B,CAAA"}
@@ -0,0 +1,61 @@
1
+ import { imagesAt, readImages } from "./images.js";
2
+ /**
3
+ * The images of the repo as the trains read them: each a package named by its repository, or by its
4
+ * folder where the environment names no registry image; of its folder and the file it is built of;
5
+ * published, as every image a pipeline builds is; and of no dependency.
6
+ *
7
+ * @param images - The images of the repo, as `readImages` of `./images` gives them.
8
+ * @returns The packages, one of each image, in the order of `images`.
9
+ */
10
+ export function packagesOfImages(images) {
11
+ return images.map((image) => ({
12
+ name: image.repository ?? image.dir,
13
+ dir: image.dir,
14
+ manifest: image.manifest,
15
+ published: true,
16
+ dependencies: [],
17
+ image
18
+ }));
19
+ }
20
+ /**
21
+ * The tag a release publishes of an image of `version`, the release of its train: the version
22
+ * itself, as `1.4.0`. No image of the repo names another as a dependency, so a range is never read
23
+ * of a manifest.
24
+ *
25
+ * @param _range - The tag before the release, as a manifest would write it.
26
+ * @param version - The release of the image, as `1.4.0`.
27
+ * @returns The tag, as `1.4.0`.
28
+ */
29
+ export const resolveTag = (_range, version) => version;
30
+ /**
31
+ * Whether `version` is the one `tag` names: a tag of an image names one version, and a moving tag,
32
+ * as `1`, is no range the trains read.
33
+ *
34
+ * @param tag - A tag, as `1.4.0`.
35
+ * @param version - A version, as `1.4.0`.
36
+ * @returns Whether they are the same version.
37
+ */
38
+ export const satisfiesTag = (tag, version) => tag.replace(/^v/, '') === version.replace(/^v/, '');
39
+ /**
40
+ * The images of the repo of `context` as the trains read them, of the commit `ref` where it names
41
+ * one, else of the working tree.
42
+ *
43
+ * @param context - The folder of the repo, its environment, the system, and the commit.
44
+ * @returns The packages, one of each image.
45
+ * @throws `EGIT` of a commit git has not.
46
+ */
47
+ export async function packagesOfRepo(context) {
48
+ return packagesOfImages(context.ref === undefined ? await readImages(context) : await imagesAt(context.ref, context));
49
+ }
50
+ /**
51
+ * The ecosystem of OCI images: its packages, the images of the repo, of the working tree or of a
52
+ * commit ({@link packagesOfRepo}); a tag published as the version ({@link resolveTag}); and a tag
53
+ * of one version ({@link satisfiesTag}).
54
+ */
55
+ export const ociEcosystem = {
56
+ name: 'oci',
57
+ packages: packagesOfRepo,
58
+ resolve: resolveTag,
59
+ satisfies: satisfiesTag
60
+ };
61
+ //# sourceMappingURL=ecosystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ecosystem.js","sourceRoot":"","sources":["../src/ecosystem.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAQlD;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA2B;IAC1D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC5B,IAAI,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG;QACnC,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,EAAE;QAChB,KAAK;KACN,CAAC,CAAC,CAAA;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,OAAe,EAAU,EAAE,CAAC,OAAO,CAAA;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,OAAe,EAAW,EAAE,CACpE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAyB;IAC5D,OAAO,gBAAgB,CACrB,OAAO,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAC7F,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,cAAc;IACxB,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,YAAY;CACxB,CAAA"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * What the release of OCI images throws: {@link OciError}, a `ReleaseError` of
3
+ * `@wtf/release-system/errors` of the codes of {@link OCI_ERRORS}, which semantic-release prints by
4
+ * its mark, beside the codes of the options of a plugin, its `SYSTEM_ERRORS` (`EOPTIONS`). What is
5
+ * the same of every ecosystem, as a package of two trains, is the trains' own, `TRAINS_ERRORS` of
6
+ * `@wtf/release-trains/errors`.
7
+ *
8
+ * @packageDocumentation
9
+ * @module @wtf/release-oci/errors
10
+ */
11
+ import { ReleaseError } from '@wtf/release-system/errors';
12
+ /** The codes of the errors of the OCI images, each with what it means. */
13
+ export declare const OCI_ERRORS: {
14
+ readonly EOCIECOSYSTEM: "The `ecosystems` of the config lists neither `@wtf/semantic-release-oci/ecosystem` nor `@wtf/release-oci`, so the trains read no image.";
15
+ readonly EOCIIMAGE: "The repository of an image cannot be named: neither the option `image` nor `CI_REGISTRY_IMAGE` of the environment gives one.";
16
+ readonly EOCISOURCE: "The tested image of a release cannot be named: neither the option `sourceTag` nor `CI_COMMIT_REF_SLUG` of the environment gives its tag.";
17
+ readonly EOCISMOKE: "The registry has not the tested image of a release, or crane cannot ask it: there is nothing to copy to the tags of the release.";
18
+ readonly EOCIRETAG: "The registry has the full version of a release already, at another digest: a released version is never moved.";
19
+ readonly EOCITAG: "crane cannot copy the tested image to a tag of the release.";
20
+ readonly EOCILINK: "The container registry of GitLab cannot be asked the page of an image, or lists none.";
21
+ };
22
+ /** A code of {@link OCI_ERRORS}. */
23
+ export type OciErrorCode = keyof typeof OCI_ERRORS;
24
+ /**
25
+ * An error of the OCI images, or of the options of the plugin over them: a stable `code`, of
26
+ * {@link OCI_ERRORS} or of `SYSTEM_ERRORS` of `@wtf/release-system/errors`, its `message` what is
27
+ * wrong, and its `details` how to fix it.
28
+ */
29
+ export declare class OciError extends ReleaseError {
30
+ }
31
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,0EAA0E;AAC1E,eAAO,MAAM,UAAU;;;;;;;;CAab,CAAA;AAEV,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,CAAA;AAElD;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,YAAY;CAAG"}
package/dist/errors.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * What the release of OCI images throws: {@link OciError}, a `ReleaseError` of
3
+ * `@wtf/release-system/errors` of the codes of {@link OCI_ERRORS}, which semantic-release prints by
4
+ * its mark, beside the codes of the options of a plugin, its `SYSTEM_ERRORS` (`EOPTIONS`). What is
5
+ * the same of every ecosystem, as a package of two trains, is the trains' own, `TRAINS_ERRORS` of
6
+ * `@wtf/release-trains/errors`.
7
+ *
8
+ * @packageDocumentation
9
+ * @module @wtf/release-oci/errors
10
+ */
11
+ import { ReleaseError } from '@wtf/release-system/errors';
12
+ /** The codes of the errors of the OCI images, each with what it means. */
13
+ export const OCI_ERRORS = {
14
+ EOCIECOSYSTEM: 'The `ecosystems` of the config lists neither `@wtf/semantic-release-oci/ecosystem` nor `@wtf/release-oci`, so the trains read no image.',
15
+ EOCIIMAGE: 'The repository of an image cannot be named: neither the option `image` nor `CI_REGISTRY_IMAGE` of the environment gives one.',
16
+ EOCISOURCE: 'The tested image of a release cannot be named: neither the option `sourceTag` nor `CI_COMMIT_REF_SLUG` of the environment gives its tag.',
17
+ EOCISMOKE: 'The registry has not the tested image of a release, or crane cannot ask it: there is nothing to copy to the tags of the release.',
18
+ EOCIRETAG: 'The registry has the full version of a release already, at another digest: a released version is never moved.',
19
+ EOCITAG: 'crane cannot copy the tested image to a tag of the release.',
20
+ EOCILINK: 'The container registry of GitLab cannot be asked the page of an image, or lists none.'
21
+ };
22
+ /**
23
+ * An error of the OCI images, or of the options of the plugin over them: a stable `code`, of
24
+ * {@link OCI_ERRORS} or of `SYSTEM_ERRORS` of `@wtf/release-system/errors`, its `message` what is
25
+ * wrong, and its `details` how to fix it.
26
+ */
27
+ export class OciError extends ReleaseError {
28
+ }
29
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,aAAa,EACX,yIAAyI;IAC3I,SAAS,EACP,8HAA8H;IAChI,UAAU,EACR,0IAA0I;IAC5I,SAAS,EACP,kIAAkI;IACpI,SAAS,EACP,+GAA+G;IACjH,OAAO,EAAE,6DAA6D;IACtE,QAAQ,EAAE,uFAAuF;CACzF,CAAA;AAKV;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The OCI images of a repo: {@link readImages} reads each image of the working tree, and
3
+ * {@link imagesAt} each of a commit, of the files git tracks. An image is a folder that holds what
4
+ * it is built of ({@link isImageManifest}): a `Dockerfile` or a `Containerfile`, or a
5
+ * `.devcontainer/devcontainer.json`, which the devcontainer CLI builds; a folder of both is one image.
6
+ * Its repository in the registry is the registry image of the project, `CI_REGISTRY_IMAGE` of a
7
+ * pipeline, of the root, and that and its folder of another ({@link repositoryOf}), as GitLab names
8
+ * the images of a project.
9
+ *
10
+ * ```ts
11
+ * import { readImages } from '@wtf/release-oci/images'
12
+ * import type { System } from '@wtf/release-system'
13
+ *
14
+ * // The folders of the images of the repo.
15
+ * export async function folders(system: System): Promise<string[]> {
16
+ * return (await readImages({ system })).map(({ dir }) => dir)
17
+ * }
18
+ * ```
19
+ *
20
+ * @packageDocumentation
21
+ * @module @wtf/release-oci/images
22
+ */
23
+ import { type GitContext } from '@wtf/release-system/git';
24
+ import type { OciImage } from './index.ts';
25
+ /**
26
+ * The folder of the image `file` is built of: of a `Dockerfile` or a `Containerfile`, its folder; of
27
+ * a `.devcontainer/devcontainer.json`, the folder above `.devcontainer`; of any other file, none.
28
+ *
29
+ * @param file - A file of the repo, from its root.
30
+ * @returns The folder of its image, `.` of the root; none of a file no image is built of.
31
+ */
32
+ export declare function imageDirOf(file: string): string | undefined;
33
+ /**
34
+ * Whether `file`, a file of the repo, is what an image is built of (see {@link imageDirOf}).
35
+ *
36
+ * @param file - The file, from the root of the repo.
37
+ * @returns Whether it is.
38
+ */
39
+ export declare const isImageManifest: (file: string) => boolean;
40
+ /**
41
+ * The repository of the image of `dir` in the registry of `registryImage`, the registry image of
42
+ * the project: that of the root, and that and the folder of another.
43
+ *
44
+ * @param registryImage - The registry image of the project, as `registry.gitlab.com/acme/images`,
45
+ * or none.
46
+ * @param dir - The folder of the image, `.` of the root.
47
+ * @returns The repository, as `registry.gitlab.com/acme/images/base`; none of no registry image.
48
+ */
49
+ export declare function repositoryOf(registryImage: string | undefined, dir: string): string | undefined;
50
+ /**
51
+ * The images of `files`, the files of the repo: one of each folder that holds what an image is
52
+ * built of, of the first such file of it, in the order of their folders.
53
+ *
54
+ * @param files - The files of the repo, from its root.
55
+ * @param registryImage - The registry image of the project, which names the repository of each.
56
+ * @returns The images, by their folders.
57
+ */
58
+ export declare function imagesOf(files: readonly string[], registryImage: string | undefined): OciImage[];
59
+ /**
60
+ * The registry image of the project of `context`, as GitLab gives a pipeline it:
61
+ * `CI_REGISTRY_IMAGE` of the environment; none of none.
62
+ *
63
+ * @param context - The environment of the run, of its system.
64
+ * @returns The registry image, or none.
65
+ */
66
+ export declare function registryImageOf(context: GitContext): string | undefined;
67
+ /**
68
+ * The images of the repo of `context`: each folder of the working tree that git tracks a file an
69
+ * image is built of in.
70
+ *
71
+ * @param context - The folder of the repo, its environment, and the system git runs by.
72
+ * @param registryImage - The registry image of the project: {@link registryImageOf} by default.
73
+ * @returns The images, by their folders.
74
+ */
75
+ export declare function readImages(context: GitContext, registryImage?: string | undefined): Promise<OciImage[]>;
76
+ /**
77
+ * The images of the repo of `context` at the commit `ref`: each folder of its tree that holds a file
78
+ * an image is built of, by `git ls-tree`.
79
+ *
80
+ * @param ref - The commit, as `HEAD` or the tag of a release.
81
+ * @param context - The folder of the repo, its environment, and the system git runs by.
82
+ * @param registryImage - The registry image of the project: {@link registryImageOf} by default.
83
+ * @returns The images, by their folders.
84
+ * @throws `EGIT` of a commit git has not.
85
+ */
86
+ export declare function imagesAt(ref: string, context: GitContext, registryImage?: string | undefined): Promise<OciImage[]>;
87
+ //# sourceMappingURL=images.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAO,KAAK,UAAU,EAAuB,MAAM,yBAAyB,CAAA;AAGnF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAQ1C;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK3D;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,OAAyC,CAAA;AAExF;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI/F;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,EAAE,CAShG;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAGvE;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,UAAU,EACnB,aAAa,GAAE,MAAM,GAAG,SAAoC,GAC3D,OAAO,CAAC,QAAQ,EAAE,CAAC,CAErB;AAED;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,UAAU,EACnB,aAAa,GAAE,MAAM,GAAG,SAAoC,GAC3D,OAAO,CAAC,QAAQ,EAAE,CAAC,CAKrB"}
package/dist/images.js ADDED
@@ -0,0 +1,124 @@
1
+ /**
2
+ * The OCI images of a repo: {@link readImages} reads each image of the working tree, and
3
+ * {@link imagesAt} each of a commit, of the files git tracks. An image is a folder that holds what
4
+ * it is built of ({@link isImageManifest}): a `Dockerfile` or a `Containerfile`, or a
5
+ * `.devcontainer/devcontainer.json`, which the devcontainer CLI builds; a folder of both is one image.
6
+ * Its repository in the registry is the registry image of the project, `CI_REGISTRY_IMAGE` of a
7
+ * pipeline, of the root, and that and its folder of another ({@link repositoryOf}), as GitLab names
8
+ * the images of a project.
9
+ *
10
+ * ```ts
11
+ * import { readImages } from '@wtf/release-oci/images'
12
+ * import type { System } from '@wtf/release-system'
13
+ *
14
+ * // The folders of the images of the repo.
15
+ * export async function folders(system: System): Promise<string[]> {
16
+ * return (await readImages({ system })).map(({ dir }) => dir)
17
+ * }
18
+ * ```
19
+ *
20
+ * @packageDocumentation
21
+ * @module @wtf/release-oci/images
22
+ */
23
+ import { git, gitOf, trackedFiles } from '@wtf/release-system/git';
24
+ import { basenameOf, dirnameOf } from '@wtf/release-system/posix';
25
+ /** The names of the files an image is built of, at the root of its folder. */
26
+ const BUILD_FILES = new Set(['Dockerfile', 'Containerfile']);
27
+ /** The file of a devcontainer the devcontainer CLI builds, from the folder of its image. */
28
+ const DEVCONTAINER = '.devcontainer/devcontainer.json';
29
+ /**
30
+ * The folder of the image `file` is built of: of a `Dockerfile` or a `Containerfile`, its folder; of
31
+ * a `.devcontainer/devcontainer.json`, the folder above `.devcontainer`; of any other file, none.
32
+ *
33
+ * @param file - A file of the repo, from its root.
34
+ * @returns The folder of its image, `.` of the root; none of a file no image is built of.
35
+ */
36
+ export function imageDirOf(file) {
37
+ if (BUILD_FILES.has(basenameOf(file)))
38
+ return dirnameOf(file);
39
+ if (file === DEVCONTAINER)
40
+ return '.';
41
+ if (file.endsWith(`/${DEVCONTAINER}`))
42
+ return file.slice(0, -DEVCONTAINER.length - 1);
43
+ return undefined;
44
+ }
45
+ /**
46
+ * Whether `file`, a file of the repo, is what an image is built of (see {@link imageDirOf}).
47
+ *
48
+ * @param file - The file, from the root of the repo.
49
+ * @returns Whether it is.
50
+ */
51
+ export const isImageManifest = (file) => imageDirOf(file) !== undefined;
52
+ /**
53
+ * The repository of the image of `dir` in the registry of `registryImage`, the registry image of
54
+ * the project: that of the root, and that and the folder of another.
55
+ *
56
+ * @param registryImage - The registry image of the project, as `registry.gitlab.com/acme/images`,
57
+ * or none.
58
+ * @param dir - The folder of the image, `.` of the root.
59
+ * @returns The repository, as `registry.gitlab.com/acme/images/base`; none of no registry image.
60
+ */
61
+ export function repositoryOf(registryImage, dir) {
62
+ if (registryImage === undefined || registryImage === '')
63
+ return undefined;
64
+ const base = registryImage.replace(/\/+$/, '');
65
+ return dir === '.' ? base : `${base}/${dir}`;
66
+ }
67
+ /**
68
+ * The images of `files`, the files of the repo: one of each folder that holds what an image is
69
+ * built of, of the first such file of it, in the order of their folders.
70
+ *
71
+ * @param files - The files of the repo, from its root.
72
+ * @param registryImage - The registry image of the project, which names the repository of each.
73
+ * @returns The images, by their folders.
74
+ */
75
+ export function imagesOf(files, registryImage) {
76
+ const manifests = new Map();
77
+ for (const file of [...files].toSorted()) {
78
+ const dir = imageDirOf(file);
79
+ if (dir !== undefined && !manifests.has(dir))
80
+ manifests.set(dir, file);
81
+ }
82
+ return [...manifests]
83
+ .toSorted(([a], [b]) => a.localeCompare(b))
84
+ .map(([dir, manifest]) => ({ dir, manifest, repository: repositoryOf(registryImage, dir) }));
85
+ }
86
+ /**
87
+ * The registry image of the project of `context`, as GitLab gives a pipeline it:
88
+ * `CI_REGISTRY_IMAGE` of the environment; none of none.
89
+ *
90
+ * @param context - The environment of the run, of its system.
91
+ * @returns The registry image, or none.
92
+ */
93
+ export function registryImageOf(context) {
94
+ const value = gitOf(context).env['CI_REGISTRY_IMAGE'];
95
+ return value === undefined || value === '' ? undefined : value;
96
+ }
97
+ /**
98
+ * The images of the repo of `context`: each folder of the working tree that git tracks a file an
99
+ * image is built of in.
100
+ *
101
+ * @param context - The folder of the repo, its environment, and the system git runs by.
102
+ * @param registryImage - The registry image of the project: {@link registryImageOf} by default.
103
+ * @returns The images, by their folders.
104
+ */
105
+ export async function readImages(context, registryImage = registryImageOf(context)) {
106
+ return imagesOf(await trackedFiles(context), registryImage);
107
+ }
108
+ /**
109
+ * The images of the repo of `context` at the commit `ref`: each folder of its tree that holds a file
110
+ * an image is built of, by `git ls-tree`.
111
+ *
112
+ * @param ref - The commit, as `HEAD` or the tag of a release.
113
+ * @param context - The folder of the repo, its environment, and the system git runs by.
114
+ * @param registryImage - The registry image of the project: {@link registryImageOf} by default.
115
+ * @returns The images, by their folders.
116
+ * @throws `EGIT` of a commit git has not.
117
+ */
118
+ export async function imagesAt(ref, context, registryImage = registryImageOf(context)) {
119
+ const files = (await git(['ls-tree', '-r', '-z', '--name-only', ref], context))
120
+ .split('\0')
121
+ .filter((file) => file !== '');
122
+ return imagesOf(files, registryImage);
123
+ }
124
+ //# sourceMappingURL=images.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"images.js","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,GAAG,EAAmB,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACnF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAIjE,8EAA8E;AAC9E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAA;AAE5D,4FAA4F;AAC5F,MAAM,YAAY,GAAG,iCAAiC,CAAA;AAEtD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,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**
2
+ * The OCI images of a repo released in trains, of no release tool and no rebuild. Its default export
3
+ * is the ecosystem of OCI images, `ociEcosystem` of `./ecosystem`, which a config of the trains
4
+ * names in `ecosystems` as `'@wtf/release-oci'`, so the trains read the images of the repo by it;
5
+ * and this module holds the type of an image, which the modules of this package do with: the
6
+ * images of the repo, each folder of a Dockerfile, a Containerfile or a
7
+ * `.devcontainer/devcontainer.json` (`./images`), the tags of a release (`./tags`), the tested image
8
+ * of each copied to them by crane (`./publish`), and the page of each in the container registry of
9
+ * GitLab (`./registry`). An image is built and tested by its own pipeline; a release copies the
10
+ * image it tested, by its digest, to the tags of its version, so the bytes released are the bytes
11
+ * tested. Each function takes the `System` it runs by, and runs `git` and `crane` through it.
12
+ *
13
+ * ```ts
14
+ * import type { OciImage } from '@wtf/release-oci'
15
+ *
16
+ * // The repositories of the images, as a release lists them.
17
+ * export const repositoriesOf = (images: readonly OciImage[]): (string | undefined)[] =>
18
+ * images.map(({ repository }) => repository)
19
+ * ```
20
+ *
21
+ * @packageDocumentation
22
+ * @module @wtf/release-oci
23
+ */
24
+ import { ociEcosystem } from './ecosystem.ts';
25
+ /** An OCI image of the repo: one folder, built of one manifest. */
26
+ export interface OciImage {
27
+ /** Its folder, from the root of the repo, as `images/base`; `.` of the root. */
28
+ readonly dir: string;
29
+ /**
30
+ * What it is built of, from the root of the repo: its `Dockerfile` or `Containerfile`, or its
31
+ * `.devcontainer/devcontainer.json`, as `images/base/Dockerfile`.
32
+ */
33
+ readonly manifest: string;
34
+ /**
35
+ * The repository of the image in its registry, as `registry.gitlab.com/acme/images/base`: the
36
+ * registry image of the project, `CI_REGISTRY_IMAGE` of a pipeline, of the root, and that and
37
+ * the folder of an image of a folder; none where the environment names no registry image.
38
+ */
39
+ readonly repository: string | undefined;
40
+ }
41
+ /** The ecosystem of OCI images, which a config of the trains names as `'@wtf/release-oci'`. */
42
+ export default ociEcosystem;
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,mEAAmE;AACnE,MAAM,WAAW,QAAQ;IACvB,gFAAgF;IAChF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CACxC;AAED,+FAA+F;AAC/F,eAAe,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The OCI images of a repo released in trains, of no release tool and no rebuild. Its default export
3
+ * is the ecosystem of OCI images, `ociEcosystem` of `./ecosystem`, which a config of the trains
4
+ * names in `ecosystems` as `'@wtf/release-oci'`, so the trains read the images of the repo by it;
5
+ * and this module holds the type of an image, which the modules of this package do with: the
6
+ * images of the repo, each folder of a Dockerfile, a Containerfile or a
7
+ * `.devcontainer/devcontainer.json` (`./images`), the tags of a release (`./tags`), the tested image
8
+ * of each copied to them by crane (`./publish`), and the page of each in the container registry of
9
+ * GitLab (`./registry`). An image is built and tested by its own pipeline; a release copies the
10
+ * image it tested, by its digest, to the tags of its version, so the bytes released are the bytes
11
+ * tested. Each function takes the `System` it runs by, and runs `git` and `crane` through it.
12
+ *
13
+ * ```ts
14
+ * import type { OciImage } from '@wtf/release-oci'
15
+ *
16
+ * // The repositories of the images, as a release lists them.
17
+ * export const repositoriesOf = (images: readonly OciImage[]): (string | undefined)[] =>
18
+ * images.map(({ repository }) => repository)
19
+ * ```
20
+ *
21
+ * @packageDocumentation
22
+ * @module @wtf/release-oci
23
+ */
24
+ import { ociEcosystem } from "./ecosystem.js";
25
+ /** The ecosystem of OCI images, which a config of the trains names as `'@wtf/release-oci'`. */
26
+ export default ociEcosystem;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAmB7C,+FAA+F;AAC/F,eAAe,YAAY,CAAA"}
@@ -0,0 +1,98 @@
1
+ import { type GitContext } from '@wtf/release-system/git';
2
+ /** The tested image of a release: its repository and its tag, as the pipeline that tested it wrote it. */
3
+ export interface OciSource {
4
+ /** Its repository, as `registry.gitlab.com/acme/images/base/snapshot`. */
5
+ readonly repository: string;
6
+ /** Its tag, as `base-v1-4-2`. */
7
+ readonly tag: string;
8
+ }
9
+ /** An image of a release: its repository, and the tested image a release copies to its tags. */
10
+ export interface ImageToPublish {
11
+ /** The repository of the image, as `registry.gitlab.com/acme/images/base`. */
12
+ readonly repository: string;
13
+ /** The tested image, which the release copies. */
14
+ readonly source: OciSource;
15
+ }
16
+ /** Where crane runs: the folder, the environment and the system, and the command of crane. */
17
+ export interface CraneContext extends GitContext {
18
+ /** The command of crane, by its name on the path or its path: `crane` by default. */
19
+ readonly crane?: string | undefined;
20
+ }
21
+ /** The tested image of an image, as the registry has it. */
22
+ export interface SmokedImage extends ImageToPublish {
23
+ /** The digest of the source, as `sha256:…`. */
24
+ readonly digest: string;
25
+ /** The platforms it is of, as `linux/amd64`: none of an image of one manifest of no index. */
26
+ readonly platforms: readonly string[];
27
+ }
28
+ /** An image of a release published: each tag copied, and each the registry had already. */
29
+ export interface PublishedImage extends SmokedImage {
30
+ /** The version of the release, as `1.4.2`. */
31
+ readonly version: string;
32
+ /** Each tag the release copied the source to, the version's first. */
33
+ readonly tags: readonly string[];
34
+ /** Each tag the registry had already at the digest of the source, and the release skipped. */
35
+ readonly skipped: readonly string[];
36
+ }
37
+ /**
38
+ * The digest of the image `ref`, as `crane digest` gives it: none of a repository or a tag the
39
+ * registry has not.
40
+ *
41
+ * @param ref - The reference of the image, as `registry.example/a:1.4.2`.
42
+ * @param context - Where crane runs, and its command.
43
+ * @returns The digest, as `sha256:…`; none of an image the registry has not.
44
+ * @throws `EOCISMOKE` of a registry crane cannot ask, as of no credentials.
45
+ */
46
+ export declare function digestOf(ref: string, context: CraneContext): Promise<string | undefined>;
47
+ /**
48
+ * The platforms of the image `ref` at `digest`: of an index, each manifest's `os/architecture` and
49
+ * variant, of `crane manifest`; of a manifest of no index, none.
50
+ *
51
+ * @param ref - The repository of the image, as `registry.example/a`.
52
+ * @param digest - Its digest, as `sha256:…`.
53
+ * @param context - Where crane runs, and its command.
54
+ * @returns The platforms, as `['linux/amd64', 'linux/arm64']`.
55
+ * @throws `EOCISMOKE` of a manifest crane cannot give, or that is no JSON.
56
+ */
57
+ export declare function platformsOf(ref: string, digest: string, context: CraneContext): Promise<string[]>;
58
+ /**
59
+ * The tested image of each image of a release, as the registry has it: its digest and its
60
+ * platforms. Throws, together, `EOCISMOKE` of each source the registry has not, or of fewer
61
+ * platforms than `platforms` names.
62
+ *
63
+ * @param images - The images of the release, each of its source.
64
+ * @param context - Where crane runs, and its command.
65
+ * @param platforms - The platforms each source must be of, as `['linux/amd64']`: any by default.
66
+ * @returns Each image, of the digest and the platforms of its source.
67
+ */
68
+ export declare function smokeImages(images: readonly ImageToPublish[], context: CraneContext, platforms?: readonly string[]): Promise<SmokedImage[]>;
69
+ /** What {@link publishImages} publishes. */
70
+ export interface ImagesRelease {
71
+ /** Where crane runs, and its command. */
72
+ readonly context: CraneContext;
73
+ /** The images of the release, each of its source. */
74
+ readonly images: readonly ImageToPublish[];
75
+ /** The version of the release, as `1.4.2`. */
76
+ readonly version: string;
77
+ /** Whether a release moves its minor and its major: `true` by default. */
78
+ readonly moving?: boolean | undefined;
79
+ /** The platforms each source must be of: any by default. */
80
+ readonly platforms?: readonly string[] | undefined;
81
+ /**
82
+ * Where the steps are said, a line each.
83
+ *
84
+ * @param line - The line.
85
+ */
86
+ readonly log?: ((line: string) => void) | undefined;
87
+ }
88
+ /**
89
+ * The images of a release published: each source smoked ({@link smokeImages}), then copied by its
90
+ * digest to the tag of the version, of an image the registry has not at it, and to each moving tag.
91
+ * Throws, together, `EOCIRETAG` of each image whose version the registry has at another digest,
92
+ * before anything is copied; and `EOCITAG` of a copy crane cannot make.
93
+ *
94
+ * @param release - The images, the version and where crane runs.
95
+ * @returns Each image, of the tags copied and skipped.
96
+ */
97
+ export declare function publishImages(release: ImagesRelease): Promise<PublishedImage[]>;
98
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,KAAK,UAAU,EAAS,MAAM,yBAAyB,CAAA;AAKhE,0GAA0G;AAC1G,MAAM,WAAW,SAAS;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED,gGAAgG;AAChG,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAC3B;AAED,8FAA8F;AAC9F,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,qFAAqF;IACrF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACpC;AAED,4DAA4D;AAC5D,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,8FAA8F;IAC9F,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC;AAED,2FAA2F;AAC3F,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,M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AAc,EAAE,CAAC,CAiDrF"}
@@ -0,0 +1,179 @@
1
+ /**
2
+ * The images of a release published, of no rebuild, by crane: {@link smokeImages} finds the tested
3
+ * image of each, its source, by its digest, and the platforms it is of; {@link publishImages} copies
4
+ * that digest to each tag of the release, `crane copy <source>@<digest> <image>:<tag>`, which mounts
5
+ * each blob of the source's repository rather than moving it. The tag of the version is copied once:
6
+ * a registry that has it at the same digest is skipped, so a release that stopped part way is
7
+ * finished by running it again, and at another digest is refused (`EOCIRETAG`), as a released
8
+ * version never moves. The moving tags, as `1.4` and `1`, are copied every time.
9
+ *
10
+ * crane runs by the `System` it is given, of the environment it is given: it reads the credentials
11
+ * of the registry of its own config, as `crane auth login` writes it, or of the docker config.
12
+ *
13
+ * ```ts
14
+ * import { publishImages } from '@wtf/release-oci/publish'
15
+ * import type { System } from '@wtf/release-system'
16
+ *
17
+ * export async function release(system: System): Promise<void> {
18
+ * await publishImages({
19
+ * context: { system },
20
+ * images: [
21
+ * {
22
+ * repository: 'registry.gitlab.com/acme/images/base',
23
+ * source: { repository: 'registry.gitlab.com/acme/images/base/snapshot', tag: 'base-v1-4-2' }
24
+ * }
25
+ * ],
26
+ * version: '1.4.2'
27
+ * })
28
+ * }
29
+ * ```
30
+ *
31
+ * @packageDocumentation
32
+ * @module @wtf/release-oci/publish
33
+ */
34
+ import { throwAll } from '@wtf/release-system/errors';
35
+ import { gitOf } from '@wtf/release-system/git';
36
+ import { OciError } from "./errors.js";
37
+ import { releaseTagsOf } from "./tags.js";
38
+ /** The reference of a source, of its repository and its tag. */
39
+ const sourceRef = ({ repository, tag }) => `${repository}:${tag}`;
40
+ /** Whether crane said the registry has no such repository or manifest. */
41
+ const isAbsent = (stderr) => /MANIFEST_UNKNOWN|NAME_UNKNOWN|NOT_FOUND|not found|404/i.test(stderr);
42
+ /** The command of crane of `context`. */
43
+ const craneOf = (context) => context.crane ?? 'crane';
44
+ /**
45
+ * Runs crane with `args`, in the folder and the environment of `context`.
46
+ *
47
+ * @param args - The arguments of crane, as `['digest', 'registry.example/a:1']`.
48
+ * @param context - Where crane runs, and its command.
49
+ * @returns What crane wrote, and its exit code.
50
+ */
51
+ async function crane(args, context) {
52
+ const { cwd, env, system } = gitOf(context);
53
+ return system.exec(craneOf(context), args, { cwd, env });
54
+ }
55
+ /**
56
+ * The digest of the image `ref`, as `crane digest` gives it: none of a repository or a tag the
57
+ * registry has not.
58
+ *
59
+ * @param ref - The reference of the image, as `registry.example/a:1.4.2`.
60
+ * @param context - Where crane runs, and its command.
61
+ * @returns The digest, as `sha256:…`; none of an image the registry has not.
62
+ * @throws `EOCISMOKE` of a registry crane cannot ask, as of no credentials.
63
+ */
64
+ export async function digestOf(ref, context) {
65
+ const { stdout, stderr, code } = await crane(['digest', ref], context);
66
+ if (code === 0 && stdout.trim() !== '')
67
+ return stdout.trim();
68
+ if (isAbsent(stderr))
69
+ return undefined;
70
+ throw new OciError('EOCISMOKE', `crane cannot ask the registry for ${ref}: ${stderr.trim() || `exit code ${code}`}`, 'Log crane in to the registry, as `crane auth login`, of a token that may read the repository, and check that crane is on the path of the run.');
71
+ }
72
+ /**
73
+ * The platforms of the image `ref` at `digest`: of an index, each manifest's `os/architecture` and
74
+ * variant, of `crane manifest`; of a manifest of no index, none.
75
+ *
76
+ * @param ref - The repository of the image, as `registry.example/a`.
77
+ * @param digest - Its digest, as `sha256:…`.
78
+ * @param context - Where crane runs, and its command.
79
+ * @returns The platforms, as `['linux/amd64', 'linux/arm64']`.
80
+ * @throws `EOCISMOKE` of a manifest crane cannot give, or that is no JSON.
81
+ */
82
+ export async function platformsOf(ref, digest, context) {
83
+ const { stdout, stderr, code } = await crane(['manifest', `${ref}@${digest}`], context);
84
+ let manifest;
85
+ try {
86
+ if (code !== 0)
87
+ throw new Error(stderr.trim() || `exit code ${code}`);
88
+ manifest = JSON.parse(stdout);
89
+ }
90
+ catch (error) {
91
+ throw new OciError('EOCISMOKE', `crane cannot give the manifest of ${ref}@${digest}: ${error.message}`, 'Check that the registry has the image, and that crane may read it.');
92
+ }
93
+ return (manifest.manifests ?? []).flatMap(({ platform }) => {
94
+ if (platform?.['os'] === undefined || platform['architecture'] === undefined)
95
+ return [];
96
+ if (platform['os'] === 'unknown')
97
+ return [];
98
+ const variant = platform['variant'] === undefined ? '' : `/${platform['variant']}`;
99
+ return [`${platform['os']}/${platform['architecture']}${variant}`];
100
+ });
101
+ }
102
+ /**
103
+ * The tested image of each image of a release, as the registry has it: its digest and its
104
+ * platforms. Throws, together, `EOCISMOKE` of each source the registry has not, or of fewer
105
+ * platforms than `platforms` names.
106
+ *
107
+ * @param images - The images of the release, each of its source.
108
+ * @param context - Where crane runs, and its command.
109
+ * @param platforms - The platforms each source must be of, as `['linux/amd64']`: any by default.
110
+ * @returns Each image, of the digest and the platforms of its source.
111
+ */
112
+ export async function smokeImages(images, context, platforms = []) {
113
+ const errors = [];
114
+ const smoked = [];
115
+ for (const image of images) {
116
+ // oxlint-disable-next-line no-await-in-loop -- crane asks the registry one image at a time
117
+ const digest = await digestOf(sourceRef(image.source), context);
118
+ if (digest === undefined) {
119
+ errors.push(new OciError('EOCISMOKE', `The registry has no ${sourceRef(image.source)}, the tested image of ${image.repository}.`, 'Build and test the image in the pipeline of the release before it publishes, as the devcontainer component does of a tag, or give the plugin the `sourceRepository` and the `sourceTag` the pipeline pushes it as.'));
120
+ continue;
121
+ }
122
+ // oxlint-disable-next-line no-await-in-loop -- crane asks the registry one image at a time
123
+ const of = await platformsOf(image.source.repository, digest, context);
124
+ const missing = platforms.filter((platform) => of.length > 0 && !of.includes(platform));
125
+ if (missing.length > 0)
126
+ errors.push(new OciError('EOCISMOKE', `${sourceRef(image.source)} is of ${of.join(', ')}, and not of ${missing.join(', ')}.`, 'Build the image of each platform of the option `platforms`, or name fewer.'));
127
+ smoked.push({ ...image, digest, platforms: of });
128
+ }
129
+ throwAll(errors);
130
+ return smoked;
131
+ }
132
+ /**
133
+ * The images of a release published: each source smoked ({@link smokeImages}), then copied by its
134
+ * digest to the tag of the version, of an image the registry has not at it, and to each moving tag.
135
+ * Throws, together, `EOCIRETAG` of each image whose version the registry has at another digest,
136
+ * before anything is copied; and `EOCITAG` of a copy crane cannot make.
137
+ *
138
+ * @param release - The images, the version and where crane runs.
139
+ * @returns Each image, of the tags copied and skipped.
140
+ */
141
+ export async function publishImages(release) {
142
+ const { context, version } = release;
143
+ const log = release.log ?? (() => undefined);
144
+ const tags = releaseTagsOf(version, release.moving ?? true);
145
+ const smoked = await smokeImages(release.images, context, release.platforms ?? []);
146
+ const errors = [];
147
+ const has = new Map();
148
+ for (const image of smoked) {
149
+ // oxlint-disable-next-line no-await-in-loop -- crane asks the registry one image at a time
150
+ const at = await digestOf(`${image.repository}:${tags.version}`, context);
151
+ has.set(image.repository, at);
152
+ if (at !== undefined && at !== image.digest)
153
+ errors.push(new OciError('EOCIRETAG', `${image.repository}:${tags.version} is ${at} already, not ${image.digest}, the tested image of the release.`, 'Release a new version: a released version is never moved. Delete the tag in the registry yourself only where nothing pulls it yet.'));
154
+ }
155
+ throwAll(errors);
156
+ const published = [];
157
+ for (const image of smoked) {
158
+ const skipped = has.get(image.repository) === image.digest ? [tags.version] : [];
159
+ const copy = skipped.length > 0 ? tags.moving : [tags.version, ...tags.moving];
160
+ for (const tag of copy) {
161
+ const target = `${image.repository}:${tag}`;
162
+ // oxlint-disable-next-line no-await-in-loop -- one copy at a time, the version's first
163
+ const { stderr, code } = await crane(['copy', `${image.source.repository}@${image.digest}`, target], context);
164
+ if (code !== 0)
165
+ throw new OciError('EOCITAG', `crane cannot copy ${image.source.repository}@${image.digest} to ${target}: ${stderr.trim() || `exit code ${code}`}`, 'Check that crane is logged in to the registry of a token that may write the repository, and run the release of the tag again: what is published is skipped.');
166
+ log(`Copied ${image.digest} to ${target}.`);
167
+ }
168
+ for (const tag of skipped)
169
+ log(`${image.repository}:${tag} is ${image.digest} already.`);
170
+ published.push({
171
+ ...image,
172
+ version: tags.version,
173
+ tags: [tags.version, ...tags.moving],
174
+ skipped
175
+ });
176
+ }
177
+ return published;
178
+ }
179
+ //# sourceMappingURL=publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAmB,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AA0CzC,gEAAgE;AAChE,MAAM,SAAS,GAAG,CAAC,EAAE,UAAU,EAAE,GAAG,EAAa,EAAU,EAAE,CAAC,GAAG,UAAU,IAAI,GAAG,EAAE,CAAA;AAEpF,0EAA0E;AAC1E,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAW,EAAE,CAC3C,wDAAwD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAEvE,yCAAyC;AACzC,MAAM,OAAO,GAAG,CAAC,OAAqB,EAAU,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAA;AAE3E;;;;;;GAMG;AACH,KAAK,UAAU,KAAK,CAClB,IAAuB,EACvB,OAAqB;IAErB,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;IAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAA;AAC1D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAW,EAAE,OAAqB;IAC/D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC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AAM,CAAC,IAAI,EAAE,IAAI,aAAa,IAAI,EAAE,EAAE,EACpH,6JAA6J,CAC9J,CAAA;YACH,GAAG,CAAC,UAAU,KAAK,CAAC,MAAM,OAAO,MAAM,GAAG,CAAC,CAAA;QAC7C,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,OAAO;YAAE,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,IAAI,GAAG,OAAO,KAAK,CAAC,MAAM,WAAW,CAAC,CAAA;QACxF,SAAS,CAAC,IAAI,CAAC;YACb,GAAG,KAAK;YACR,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;YACpC,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The page of an image in the container registry of GitLab ({@link registryPageOf}), which the
3
+ * GitLab release of a tag links each image by: the Container Registry API of the project lists its
4
+ * repositories, `GET /projects/<id>/registry/repositories`, each of its `location`, as
5
+ * `registry.gitlab.com/acme/images/base`, and its ID, whose page is
6
+ * `<project>/container_registry/<id>`. An image is linked where it lives, never uploaded.
7
+ *
8
+ * ```ts
9
+ * import { registryPageOf } from '@wtf/release-oci/registry'
10
+ * import { gitlabHeadersOf, gitlabProjectOf } from '@wtf/release-trains/gitlab'
11
+ *
12
+ * const env = { CI_PROJECT_PATH: 'acme/images', GITLAB_TOKEN: 'token' }
13
+ * export const page = await registryPageOf({
14
+ * fetch,
15
+ * project: gitlabProjectOf({}, env, undefined),
16
+ * repository: 'registry.gitlab.com/acme/images/base',
17
+ * headers: gitlabHeadersOf(env)
18
+ * })
19
+ * ```
20
+ *
21
+ * @packageDocumentation
22
+ * @module @wtf/release-oci/registry
23
+ */
24
+ import type { GitLabProject, HttpFetch } from '@wtf/release-trains/gitlab';
25
+ /** What {@link registryPageOf} looks up. */
26
+ export interface RegistryQuery {
27
+ /** The `fetch` the request is made by. */
28
+ readonly fetch: HttpFetch;
29
+ /** The project whose container registry holds the image. */
30
+ readonly project: GitLabProject;
31
+ /** The repository of the image, as `registry.gitlab.com/acme/images/base`. */
32
+ readonly repository: string;
33
+ /** The headers the request authenticates by: none of a public project. */
34
+ readonly headers: Readonly<Record<string, string>>;
35
+ }
36
+ /**
37
+ * The page of the image `repository` in the container registry of `project`: the repository of its
38
+ * `location`, of the first page of a hundred, at `<project>/container_registry/<id>`. Throws
39
+ * `EOCILINK` of a request GitLab refuses or that cannot be made, and of a registry that lists no
40
+ * repository of the location.
41
+ *
42
+ * @param query - The `fetch`, the project, the repository and the headers.
43
+ * @returns The URL of the page of the image.
44
+ */
45
+ export declare function registryPageOf(query: RegistryQuery): Promise<string>;
46
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAI1E,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACnD;AAQD;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA+B1E"}
@@ -0,0 +1,36 @@
1
+ import { OciError } from "./errors.js";
2
+ /**
3
+ * The page of the image `repository` in the container registry of `project`: the repository of its
4
+ * `location`, of the first page of a hundred, at `<project>/container_registry/<id>`. Throws
5
+ * `EOCILINK` of a request GitLab refuses or that cannot be made, and of a registry that lists no
6
+ * repository of the location.
7
+ *
8
+ * @param query - The `fetch`, the project, the repository and the headers.
9
+ * @returns The URL of the page of the image.
10
+ */
11
+ export async function registryPageOf(query) {
12
+ const { fetch, project, repository, headers } = query;
13
+ const url = `${project.api}/projects/${project.id}/registry/repositories?per_page=100`;
14
+ let text;
15
+ try {
16
+ const response = await fetch(url, { method: 'GET', headers: { ...headers } });
17
+ text = await response.text();
18
+ if (!response.ok)
19
+ throw new Error(`GitLab answered ${response.status}: ${text}`);
20
+ }
21
+ catch (error) {
22
+ throw new OciError('EOCILINK', `The container registry of ${project.path} cannot be asked for ${repository}, at ${url}: ${error.message}`, 'Give the run a token that may read the registry of the project, `GITLAB_TOKEN` of the `read_api` scope, and check the URL of GitLab.');
23
+ }
24
+ let listed;
25
+ try {
26
+ listed = JSON.parse(text);
27
+ }
28
+ catch {
29
+ listed = undefined;
30
+ }
31
+ const found = (Array.isArray(listed) ? listed : []).find(({ location }) => location === repository);
32
+ if (found?.id === undefined)
33
+ throw new OciError('EOCILINK', `The container registry of ${project.path} lists no repository ${repository}.`, 'Publish the image to the registry of the project of the release, whose page the release links: its repository is `CI_REGISTRY_IMAGE`, of its folder.');
34
+ return `${project.url}/container_registry/${found.id}`;
35
+ }
36
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAoBtC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAoB;IACvD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;IACrD,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,aAAa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C"}
package/dist/tags.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ /** The tags of a release of an image: the one that names its version, and those that move. */
2
+ export interface ReleaseTags {
3
+ /** The tag of the version, as `1.4.2`, which a release never moves once it is published. */
4
+ readonly version: string;
5
+ /** The tags that move to each release of their line, as `1.4` and `1`: none of a prerelease. */
6
+ readonly moving: readonly string[];
7
+ }
8
+ /**
9
+ * The tags of a release of `version`: the version, and of a release, its minor and its major, which
10
+ * move; of a release of the major `0`, its minor alone, as a minor of `0` breaks what the one before
11
+ * gave; of a prerelease, none that moves.
12
+ *
13
+ * @param version - The version of the release, as `1.4.2`.
14
+ * @param moving - Whether a release moves its minor and its major: `true` by default.
15
+ * @returns The tags.
16
+ * @throws `TypeError` of a version that is no semver.
17
+ */
18
+ export declare function releaseTagsOf(version: string, moving?: boolean): ReleaseTags;
19
+ /**
20
+ * Every tag of a release of `version`, the version first (see {@link releaseTagsOf}).
21
+ *
22
+ * @param version - The version of the release, as `1.4.2`.
23
+ * @param moving - Whether a release moves its minor and its major: `true` by default.
24
+ * @returns The tags, as `['1.4.2', '1.4', '1']`.
25
+ */
26
+ export declare function tagsOfRelease(version: string, moving?: boolean): string[];
27
+ //# sourceMappingURL=tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../src/tags.ts"],"names":[],"mappings":"AAiBA,8FAA8F;AAC9F,MAAM,WAAW,WAAW;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,gGAAgG;IAChG,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,WAAW,CASzE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,MAAM,EAAE,CAGtE"}
package/dist/tags.js ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The tags of a release of an image ({@link tagsOfRelease}): its version, and of a release, the
3
+ * minor and the major that move with each release of them, as `1.4` and `1` of `1.4.2`, which a
4
+ * consumer pins to take each fix of its line. A prerelease, as `2.0.0-next.1`, has its own tag
5
+ * alone, so no moving tag points at a version that is not released.
6
+ *
7
+ * ```ts
8
+ * import { tagsOfRelease } from '@wtf/release-oci/tags'
9
+ *
10
+ * export const tags = tagsOfRelease('1.4.2') // ['1.4.2', '1.4', '1']
11
+ * ```
12
+ *
13
+ * @packageDocumentation
14
+ * @module @wtf/release-oci/tags
15
+ */
16
+ import semver from 'semver';
17
+ /**
18
+ * The tags of a release of `version`: the version, and of a release, its minor and its major, which
19
+ * move; of a release of the major `0`, its minor alone, as a minor of `0` breaks what the one before
20
+ * gave; of a prerelease, none that moves.
21
+ *
22
+ * @param version - The version of the release, as `1.4.2`.
23
+ * @param moving - Whether a release moves its minor and its major: `true` by default.
24
+ * @returns The tags.
25
+ * @throws `TypeError` of a version that is no semver.
26
+ */
27
+ export function releaseTagsOf(version, moving = true) {
28
+ const parsed = semver.parse(version);
29
+ if (parsed === null)
30
+ throw new TypeError(`${version} is no semver version.`);
31
+ if (!moving || parsed.prerelease.length > 0)
32
+ return { version: parsed.version, moving: [] };
33
+ const minor = `${parsed.major}.${parsed.minor}`;
34
+ return {
35
+ version: parsed.version,
36
+ moving: parsed.major === 0 ? [minor] : [minor, `${parsed.major}`]
37
+ };
38
+ }
39
+ /**
40
+ * Every tag of a release of `version`, the version first (see {@link releaseTagsOf}).
41
+ *
42
+ * @param version - The version of the release, as `1.4.2`.
43
+ * @param moving - Whether a release moves its minor and its major: `true` by default.
44
+ * @returns The tags, as `['1.4.2', '1.4', '1']`.
45
+ */
46
+ export function tagsOfRelease(version, moving = true) {
47
+ const tags = releaseTagsOf(version, moving);
48
+ return [tags.version, ...tags.moving];
49
+ }
50
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../src/tags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAU3B;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,MAAM,GAAG,IAAI;IAC1D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACpC,IAAI,MAAM,KAAK,IAAI;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,OAAO,wBAAwB,CAAC,CAAA;IAC5E,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;IAC3F,MAAM,KAAK,GAAG,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAA;IAC/C,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;KAClE,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,MAAM,GAAG,IAAI;IAC1D,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC3C,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,83 @@
1
1
  {
2
2
  "name": "@wtf/release-oci",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "The OCI images of a repo released in trains and tagged in their registry, of no release tool and no rebuild, each function by the System it is given: the ecosystem of OCI images, as the trains read it, its default export (., ./ecosystem), the images of a repo, each folder of a Dockerfile, a Containerfile or a .devcontainer/devcontainer.json git tracks, of the working tree or of a commit (./images), the tags of a release, its version and of a release the moving minor and major (./tags), the tested image of each found by its digest and copied to the tags of the release by crane, a full version the registry has at another digest refused (./publish), the page of each image in the container registry of GitLab (./registry), and OciError, the class of its errors, with their codes (./errors).",
5
+ "keywords": [
6
+ "container",
7
+ "docker",
8
+ "ecosystem",
9
+ "image",
10
+ "oci",
11
+ "release",
12
+ "release-train",
13
+ "tags"
14
+ ],
15
+ "homepage": "https://gitlab.com/wetryfun/release/release/-/tree/main/packages/release-oci",
16
+ "bugs": {
17
+ "url": "https://gitlab.com/wetryfun/release/release/-/issues"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Mikael Karon <mikael@karon.se>",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://gitlab.com/wetryfun/release/release.git",
24
+ "directory": "packages/release-oci"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "type": "module",
32
+ "sideEffects": false,
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./ecosystem": {
39
+ "types": "./dist/ecosystem.d.ts",
40
+ "default": "./dist/ecosystem.js"
41
+ },
42
+ "./errors": {
43
+ "types": "./dist/errors.d.ts",
44
+ "default": "./dist/errors.js"
45
+ },
46
+ "./images": {
47
+ "types": "./dist/images.d.ts",
48
+ "default": "./dist/images.js"
49
+ },
50
+ "./publish": {
51
+ "types": "./dist/publish.d.ts",
52
+ "default": "./dist/publish.js"
53
+ },
54
+ "./registry": {
55
+ "types": "./dist/registry.d.ts",
56
+ "default": "./dist/registry.js"
57
+ },
58
+ "./tags": {
59
+ "types": "./dist/tags.d.ts",
60
+ "default": "./dist/tags.js"
61
+ },
62
+ "./package.json": "./package.json"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "scripts": {
68
+ "build": "tsc -b"
69
+ },
70
+ "dependencies": {
71
+ "@wtf/release-system": "^1.0.1",
72
+ "@wtf/release-trains": "^8.0.2",
73
+ "semver": "^7.7.0"
74
+ },
75
+ "devDependencies": {
76
+ "@types/node": "^24.10.0",
77
+ "@types/semver": "^7.7.0",
78
+ "vitest": "^5.0.5"
79
+ },
80
+ "engines": {
81
+ "node": ">=24.15.0"
82
+ }
83
+ }