@izykitten/ce 0.0.3-dev.5 → 0.0.3-dev.6
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/README.md +32 -4
- package/dist/ce.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ Prefixes can use guards too. A guard that does not pass leaves the prefix empty,
|
|
|
53
53
|
|
|
54
54
|
Guards decide from the run's metadata, so they need it too: outside a Forgejo Actions run, `{?default}` fails like `{default}` would. Only `{env.NAME}` and `{arg.NAME}` work everywhere. A guard that does not pass decides on its own, though: a tag with one is left out, and a prefix with one is empty, even if another guard in it could not be worked out, so `{?default}{?env.X}` outside a run with `X` empty is simply left out. To tell whether a branch is the default one, ce reads `repository.default_branch` from the event file, or `DEFAULT_BRANCH` when the event has none, as on a scheduled run; set `DEFAULT_BRANCH: main` in such a workflow. Pull requests and tags are never the default branch, so they need neither.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Quote a template in a workflow's `env:`: YAML reads `CACHE_PREFIX: {ref}` as a mapping, and `{?pr}pr-{pr}` not at all.
|
|
57
57
|
|
|
58
58
|
A branch, PR and default-branch build:
|
|
59
59
|
|
|
@@ -73,13 +73,41 @@ The same can be written by hand, since ce only prefixes a `--cache-from` whose s
|
|
|
73
73
|
|
|
74
74
|
The `--cache-from` that `--cache` makes leaves out a gha `mode=`, which only applies to export, and a `--cache-from` given twice, as the default branch's own scope is on the default branch, is passed once.
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
### Recommended tags
|
|
77
|
+
|
|
78
|
+
For an image others pull by version:
|
|
77
79
|
|
|
78
80
|
```sh
|
|
79
|
-
-t '{image}:{ref},{?version}{version},{?stable}{major}.{minor},{?stable}{major},
|
|
81
|
+
-t '{image}:{ref},{?version}{version},{?stable}{major}.{minor},{?stable}{major},{?stable}latest'
|
|
80
82
|
```
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
| Build | Tags |
|
|
85
|
+
| ----------------- | --------------------------------------- |
|
|
86
|
+
| branch `main` | `main` |
|
|
87
|
+
| branch `ci/fix` | `ci-fix` |
|
|
88
|
+
| pull request 3 | `pr-3` |
|
|
89
|
+
| tag `v1.2.3` | `v1.2.3`, `1.2.3`, `1.2`, `1`, `latest` |
|
|
90
|
+
| tag `v1.3.0-rc.1` | `v1.3.0-rc.1`, `1.3.0-rc.1` |
|
|
91
|
+
| tag `v0.3.1` | `v0.3.1`, `0.3.1`, `0.3`, `0`, `latest` |
|
|
92
|
+
|
|
93
|
+
- `{ref}` names every build after what was pushed, so a branch or pull request can be pulled to try it, and a release keeps its git tag's name, `v` included.
|
|
94
|
+
- `{?version}{version}` adds the version without the `v`, as most images are tagged, for pre-releases too.
|
|
95
|
+
- `1.2` and `1` follow the newest stable release in their line, for those who want fixes but not the next major version. Before 1.0, SemVer lets any minor release break things, so `0` can move from 0.3 to a 0.4 that does; pin `0.3` to avoid that.
|
|
96
|
+
- `latest` is the newest stable release, as on most images. A repository with no release tag yet has no `latest`: deploy `main` instead, or use `{?default}latest` until the first release.
|
|
97
|
+
|
|
98
|
+
The guard on `latest` picks what it follows:
|
|
99
|
+
|
|
100
|
+
| Tag | `latest` follows |
|
|
101
|
+
| --------------------- | ----------------------------------------- |
|
|
102
|
+
| `{?stable}latest` | stable releases |
|
|
103
|
+
| `{?version}latest` | every SemVer tag, pre-releases included |
|
|
104
|
+
| `{?tag}latest` | every tag |
|
|
105
|
+
| `{?default}latest` | the default branch |
|
|
106
|
+
| `{?env.LATEST}latest` | builds where an earlier step set `LATEST` |
|
|
107
|
+
|
|
108
|
+
Guards go by the build, not by what is in the registry: `latest` and the version aliases move to the last build whose guards pass. A `v1.2.4` fix pushed after `v2.0.0`, or a rebuild of an older release, moves them back to it. For a rule such as "only the highest version" or "the default branch until the first release", have an earlier step check the registry and set the variable an `{?env.NAME}` guard reads.
|
|
109
|
+
|
|
110
|
+
`{ref}` moves with each push. To also keep every branch and pull request build under a name of its own, add `{?branch}{ref}-{sha},{?pr}{ref}-{sha}`, which gives `main-0123456` and `pr-3-0123456`.
|
|
83
111
|
|
|
84
112
|
### Build args and the Containerfile
|
|
85
113
|
|
package/dist/ce.js
CHANGED
|
@@ -2112,7 +2112,7 @@ function envFlag(name) {
|
|
|
2112
2112
|
throw new CeError(`ce: ${name} must be true or false, not ${JSON.stringify(process.env[name])}`);
|
|
2113
2113
|
}
|
|
2114
2114
|
function shellQuote(arg) {
|
|
2115
|
-
return /^[A-Za-z0-9_
|
|
2115
|
+
return /^[A-Za-z0-9_@%+=:,./-]+$/u.test(arg) ? arg : `'${arg.replaceAll("'", `'\\''`)}'`;
|
|
2116
2116
|
}
|
|
2117
2117
|
async function runEngine(engine, argv, tagPrefix, cachePrefix, options = {}) {
|
|
2118
2118
|
const dryRun = options.dryRun ?? envFlag("CE_DRY_RUN");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izykitten/ce",
|
|
3
|
-
"version": "0.0.3-dev.
|
|
3
|
+
"version": "0.0.3-dev.6",
|
|
4
4
|
"description": "Container engine wrapper: tag/cache rewriting for docker, podman and buildah, registry login, and a Forgejo OIDC Docker credential helper",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/bun": "1.4.3"
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|