@ligeti/workflow-attest-and-publish 1.0.4 → 2.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/README.md +24 -47
- package/dist/workflow.d.ts +3 -26
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +25 -95
- package/dist/workflow.js.map +1 -1
- package/package.json +3 -5
- package/dist/store.d.ts +0 -9
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -15
- package/dist/store.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
# @ligeti/workflow-attest-and-publish
|
|
2
2
|
|
|
3
3
|
Runs the verification gate for one commit of a target repository and, only if it passes, publishes the signed
|
|
4
|
-
attestation
|
|
5
|
-
remote. A failed gate is never published. See
|
|
4
|
+
attestation as a git note on the repository's remote. A failed gate is never published. See
|
|
6
5
|
[`docs/attestation.md`](../../docs/attestation.md) for what the gate proves, what it does not, and
|
|
7
6
|
the trust model behind signing and publishing -- this README covers only the workflow's own
|
|
8
7
|
surface.
|
|
9
8
|
|
|
10
9
|
## Inputs
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `minRemainingHours` | no
|
|
22
|
-
| `replace` | no
|
|
11
|
+
The input is strict: a `store` or `projectUrl` input, which earlier versions took, is rejected.
|
|
12
|
+
|
|
13
|
+
| Input | Required | Default | Notes |
|
|
14
|
+
| ------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `repoPath` | yes | -- | Path to the local repository the commit is cloned from; the gate never runs in it. |
|
|
16
|
+
| `commit` | yes | -- | The commit to gate: a sha, or a commit-ish the shell resolves in `repoPath` once. |
|
|
17
|
+
| `configPath` | no | -- | Path to the gate config. Defaults to the shell's own default gate config path when omitted. |
|
|
18
|
+
| `base` | no | -- | A commit-ish whose merge-base with `commit` bounds the changed files. A check whose `paths` match none of them reports `skipped_not_applicable`. Every check runs when omitted. |
|
|
19
|
+
| `remote` | no | `origin` | Name of the git remote the note is published to; a leading `-`, whitespace, `..`, `@` or a URL is rejected at input validation. |
|
|
20
|
+
| `minRemainingHours` | no | `0` | How much of `maxAgeHours` a note already published for this sha must have left to be kept; less makes the step overwrite it. |
|
|
21
|
+
| `replace` | no | `false` | Overwrite the note already published for this sha, however fresh it looks. |
|
|
23
22
|
|
|
24
23
|
## Output
|
|
25
24
|
|
|
@@ -28,32 +27,16 @@ surface.
|
|
|
28
27
|
runOutcome: "passed" | "failed"; // the gate's predicate.result
|
|
29
28
|
commitSha: string;
|
|
30
29
|
predicate: GatePredicate; // { result: "passed" | "failed"; checks: CheckResult[]; ... }
|
|
31
|
-
publish?: // present only when the gate passed
|
|
32
|
-
| { store: "gitlab-registry"; status: "published" | "already-published"; url: string; packageFile?: ... }
|
|
33
|
-
| { store: "git-notes"; status: "published" | "already-published"; remote: string; ref: string; sha: string };
|
|
30
|
+
publish?: { status: "published" | "already-published"; remote: string; ref: string; sha: string }; // present only when the gate passed
|
|
34
31
|
failedChecks?: { id: string; stderr: string }[]; // only when the gate failed
|
|
35
32
|
}
|
|
36
33
|
```
|
|
37
34
|
|
|
38
|
-
##
|
|
39
|
-
|
|
40
|
-
With `store` omitted, the workflow reads `remote`'s URL in `repoPath` (`git.remote-url`) and applies
|
|
41
|
-
one rule: a host that is exactly `gitlab.com` publishes to the `gitlab-registry`, any other host --
|
|
42
|
-
GitHub, a self-hosted GitLab, a local path -- to `git-notes`. Nothing else is guessed: a
|
|
43
|
-
self-hosted GitLab gets `git-notes` unless the caller passes `store: "gitlab-registry"` (and
|
|
44
|
-
`projectUrl`). When that rule picks `git-notes` and `projectUrl` was given, the run fails before the gate: a GitLab
|
|
45
|
-
reached through an SSH host alias is not recognised, so pass `store: "gitlab-registry"` or drop
|
|
46
|
-
`projectUrl`. Passing `store` skips reading the URL. The host rule is `src/store.ts`; the Rules are
|
|
47
|
-
in [`test/store.feature`](test/store.feature).
|
|
48
|
-
|
|
49
|
-
With `git-notes`, `git-notes-attestation.publish` writes the envelope as a note on the commit under
|
|
50
|
-
`refs/notes/ligeti-attestations` and pushes that ref to `remote`; it replaces a stale note itself, so
|
|
51
|
-
the delete-and-publish-again path below belongs to `gitlab-registry` only. See
|
|
52
|
-
[`steps/git-notes-attestation/README.md`](../../steps/git-notes-attestation/README.md).
|
|
35
|
+
## Publishing
|
|
53
36
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
`git-notes-attestation.publish` writes the envelope as a note on the commit under
|
|
38
|
+
`refs/notes/ligeti-attestations` and pushes that ref to `remote`; it replaces a stale note itself.
|
|
39
|
+
See [`steps/git-notes-attestation/README.md`](../../steps/git-notes-attestation/README.md).
|
|
57
40
|
|
|
58
41
|
`predicate` is always present. `publish` is present only when `predicate.result` is `"passed"` --
|
|
59
42
|
a failed gate returns `runOutcome`, `commitSha`, `predicate` and `failedChecks`, with no publish
|
|
@@ -63,24 +46,18 @@ Either way the run ends with a `done` status carrying the same `runOutcome`.
|
|
|
63
46
|
|
|
64
47
|
## Steps
|
|
65
48
|
|
|
66
|
-
1. `@ligeti/step-
|
|
67
|
-
2. `@ligeti/step-attest`'s `attestGate` -- runs the gate for `commit` in a fresh gate checkout and
|
|
49
|
+
1. `@ligeti/step-attest`'s `attestGate` -- runs the gate for `commit` in a fresh gate checkout and
|
|
68
50
|
returns a signed envelope plus the commit sha, predicate and the gate config's `maxAgeHours`. See
|
|
69
51
|
[`steps/attest/README.md`](../../steps/attest/README.md).
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
passed. See [`steps/gitlab-registry/README.md`](../../steps/gitlab-registry/README.md).
|
|
73
|
-
4. `gitlabRegistryDeleteAttestation` -- run only when the publish reported the attestation stale or `replace` is true.
|
|
74
|
-
5. `@ligeti/step-git-notes-attestation`'s `gitNotesAttestationPublish` -- instead of steps 3 and 4
|
|
75
|
-
when the store is `git-notes`.
|
|
52
|
+
2. `@ligeti/step-git-notes-attestation`'s `gitNotesAttestationPublish` -- publishes that envelope as
|
|
53
|
+
a git note. Run only when the gate passed.
|
|
76
54
|
|
|
77
55
|
## Configuration
|
|
78
56
|
|
|
79
|
-
This workflow reads no environment variables directly. Signing
|
|
80
|
-
|
|
81
|
-
[`steps/
|
|
82
|
-
|
|
83
|
-
signing key sits behind.
|
|
57
|
+
This workflow reads no environment variables directly. Signing and the git credentials used to
|
|
58
|
+
push notes are the composed steps' concern; see [`steps/attest/README.md`](../../steps/attest/README.md)
|
|
59
|
+
and [`steps/git-notes-attestation/README.md`](../../steps/git-notes-attestation/README.md), and
|
|
60
|
+
[`docs/attestation.md`](../../docs/attestation.md) for the trust boundary the signing key sits behind.
|
|
84
61
|
|
|
85
62
|
This is one of the default workflows: `ligeti serve` offers it while `LIGETI_WORKFLOWS` is unset.
|
|
86
63
|
Setting `LIGETI_WORKFLOWS` replaces the default list, so it must then list this directory too (see
|
package/dist/workflow.d.ts
CHANGED
|
@@ -4,15 +4,10 @@ declare const _default: import("@ligeti/sdk").WorkflowDefinition<z.ZodObject<{
|
|
|
4
4
|
commit: z.ZodString;
|
|
5
5
|
configPath: z.ZodOptional<z.ZodString>;
|
|
6
6
|
base: z.ZodOptional<z.ZodString>;
|
|
7
|
-
store: z.ZodOptional<z.ZodEnum<{
|
|
8
|
-
"gitlab-registry": "gitlab-registry";
|
|
9
|
-
"git-notes": "git-notes";
|
|
10
|
-
}>>;
|
|
11
7
|
remote: z.ZodOptional<z.ZodString>;
|
|
12
|
-
projectUrl: z.ZodOptional<z.ZodString>;
|
|
13
8
|
minRemainingHours: z.ZodOptional<z.ZodNumber>;
|
|
14
9
|
replace: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
-
}, z.core.$
|
|
10
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
11
|
runOutcome: z.ZodEnum<{
|
|
17
12
|
passed: "passed";
|
|
18
13
|
failed: "failed";
|
|
@@ -38,24 +33,7 @@ declare const _default: import("@ligeti/sdk").WorkflowDefinition<z.ZodObject<{
|
|
|
38
33
|
detail: z.ZodOptional<z.ZodString>;
|
|
39
34
|
}, z.core.$loose>>;
|
|
40
35
|
}, z.core.$loose>;
|
|
41
|
-
publish: z.ZodOptional<z.
|
|
42
|
-
url: z.ZodString;
|
|
43
|
-
packageFile: z.ZodOptional<z.ZodObject<{
|
|
44
|
-
id: z.ZodNumber;
|
|
45
|
-
package_id: z.ZodNumber;
|
|
46
|
-
created_at: z.ZodString;
|
|
47
|
-
file_name: z.ZodString;
|
|
48
|
-
size: z.ZodNumber;
|
|
49
|
-
file_md5: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
-
file_sha1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
-
file_sha256: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
-
}, z.core.$loose>>;
|
|
53
|
-
store: z.ZodLiteral<"gitlab-registry">;
|
|
54
|
-
status: z.ZodEnum<{
|
|
55
|
-
published: "published";
|
|
56
|
-
"already-published": "already-published";
|
|
57
|
-
}>;
|
|
58
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
36
|
+
publish: z.ZodOptional<z.ZodObject<{
|
|
59
37
|
status: z.ZodEnum<{
|
|
60
38
|
published: "published";
|
|
61
39
|
"already-published": "already-published";
|
|
@@ -63,8 +41,7 @@ declare const _default: import("@ligeti/sdk").WorkflowDefinition<z.ZodObject<{
|
|
|
63
41
|
remote: z.ZodString;
|
|
64
42
|
ref: z.ZodString;
|
|
65
43
|
sha: z.ZodString;
|
|
66
|
-
|
|
67
|
-
}, z.core.$strict>], "store">>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
68
45
|
failedChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
69
46
|
id: z.ZodString;
|
|
70
47
|
stderr: z.ZodString;
|
package/dist/workflow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,CAAC,EAAE,MAAM,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,CAAC,EAAE,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBhD,wBA8GG"}
|
package/dist/workflow.js
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
// ABOUTME: The attest-and-publish workflow: runs the gate for one commit of a repository, and, only when it
|
|
2
|
-
// ABOUTME: passes, publishes the signed attestation
|
|
2
|
+
// ABOUTME: passes, publishes the signed attestation as a git note. A failed gate is never published.
|
|
3
3
|
import { defineWorkflow, z } from "@ligeti/sdk";
|
|
4
4
|
import { attestGate, AttestGateInput, GatePredicate } from "@ligeti/step-attest";
|
|
5
5
|
import { gitNotesAttestationPublish, GitNotesPublishOutput, isSafeRemoteName, } from "@ligeti/step-git-notes-attestation";
|
|
6
|
-
import { gitRemoteUrl } from "@ligeti/step-git-worktree";
|
|
7
|
-
import { gitlabRegistryDeleteAttestation, gitlabRegistryPublishAttestation, PublishAttestationInput, PublishAttestationOutput, } from "@ligeti/step-gitlab-registry";
|
|
8
|
-
import { AttestationStore, storeForRemoteUrl } from "./store.js";
|
|
9
|
-
const RegistryPublish = PublishAttestationOutput.extend({
|
|
10
|
-
store: z.literal("gitlab-registry"),
|
|
11
|
-
status: z.enum(["published", "already-published"]),
|
|
12
|
-
});
|
|
13
|
-
const NotesPublish = GitNotesPublishOutput.extend({ store: z.literal("git-notes") });
|
|
14
|
-
const PublishedAttestation = z.discriminatedUnion("store", [RegistryPublish, NotesPublish]);
|
|
15
6
|
const MAX_FAILED_CHECK_STDERR_CHARS = 4000;
|
|
16
7
|
const FailedCheck = z.object({ id: z.string(), stderr: z.string() });
|
|
17
8
|
function tail(text) {
|
|
@@ -19,22 +10,18 @@ function tail(text) {
|
|
|
19
10
|
? `...${text.slice(text.length - MAX_FAILED_CHECK_STDERR_CHARS)}`
|
|
20
11
|
: text;
|
|
21
12
|
}
|
|
22
|
-
function isPublished(output) {
|
|
23
|
-
return output.status !== "stale";
|
|
24
|
-
}
|
|
25
13
|
export default defineWorkflow({
|
|
26
14
|
name: "attest-and-publish",
|
|
27
15
|
description: "Runs the gate for one commit of a repository in a fresh gate checkout, signs the " +
|
|
28
|
-
"attestation, and publishes it
|
|
29
|
-
"
|
|
30
|
-
input: z
|
|
16
|
+
"attestation, and publishes it as a git note on the repository's remote, but only when the " +
|
|
17
|
+
"gate passes.",
|
|
18
|
+
input: z
|
|
19
|
+
.object({
|
|
31
20
|
repoPath: AttestGateInput.shape.repository.describe("Path to the local repository the commit is cloned from; the gate never runs in it"),
|
|
32
21
|
commit: AttestGateInput.shape.commit.describe("The commit to gate: a sha, or a commit-ish the shell resolves in the repository once"),
|
|
33
22
|
configPath: AttestGateInput.shape.configPath.describe("Path to the gate config. Defaults to the shell's own default gate config path when omitted"),
|
|
34
23
|
base: AttestGateInput.shape.base.describe("A commit-ish whose merge-base with the commit bounds the changed files; a check whose " +
|
|
35
24
|
"paths match none of them reports skipped_not_applicable. Every check runs when omitted"),
|
|
36
|
-
store: AttestationStore.optional().describe("Where to publish the attestation: gitlab-registry or git-notes. Defaults to gitlab-registry " +
|
|
37
|
-
"when the remote's host is gitlab.com and git-notes for any other host"),
|
|
38
25
|
remote: z
|
|
39
26
|
.string()
|
|
40
27
|
.min(1)
|
|
@@ -43,48 +30,28 @@ export default defineWorkflow({
|
|
|
43
30
|
'(no "://" or "@")',
|
|
44
31
|
})
|
|
45
32
|
.optional()
|
|
46
|
-
.describe("The name of the git remote
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
.describe("The name of the git remote the attestation note is published to. Defaults to origin"),
|
|
34
|
+
minRemainingHours: z
|
|
35
|
+
.number()
|
|
36
|
+
.min(0)
|
|
49
37
|
.optional()
|
|
50
|
-
.describe("
|
|
51
|
-
minRemainingHours: PublishAttestationInput.shape.minRemainingHours.describe("How many hours of maxAgeHours an attestation already published for this sha must have " +
|
|
38
|
+
.describe("How many hours of maxAgeHours an attestation already published for this sha must have " +
|
|
52
39
|
"left to be kept. Defaults to 0"),
|
|
53
40
|
replace: z
|
|
54
41
|
.boolean()
|
|
55
42
|
.optional()
|
|
56
|
-
.describe("
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}),
|
|
43
|
+
.describe("Overwrite the note already published for this sha, however fresh it looks. Defaults to false"),
|
|
44
|
+
})
|
|
45
|
+
.strict(),
|
|
60
46
|
output: z.object({
|
|
61
47
|
runOutcome: z.enum(["passed", "failed"]),
|
|
62
48
|
commitSha: z.string(),
|
|
63
49
|
predicate: GatePredicate,
|
|
64
|
-
publish:
|
|
50
|
+
publish: GitNotesPublishOutput.optional(),
|
|
65
51
|
failedChecks: z.array(FailedCheck).optional(),
|
|
66
52
|
}),
|
|
67
|
-
steps: [
|
|
68
|
-
|
|
69
|
-
gitRemoteUrl,
|
|
70
|
-
gitlabRegistryPublishAttestation,
|
|
71
|
-
gitlabRegistryDeleteAttestation,
|
|
72
|
-
gitNotesAttestationPublish,
|
|
73
|
-
],
|
|
74
|
-
async run(ctx, { repoPath, commit, configPath, base, store, remote, projectUrl, minRemainingHours, replace }) {
|
|
75
|
-
const remoteName = remote ?? "origin";
|
|
76
|
-
let resolvedStore = store;
|
|
77
|
-
if (resolvedStore === undefined) {
|
|
78
|
-
const { url } = await ctx.run(gitRemoteUrl, { worktreePath: repoPath, remote: remoteName });
|
|
79
|
-
resolvedStore = storeForRemoteUrl(url);
|
|
80
|
-
if (resolvedStore === "git-notes" && projectUrl !== undefined) {
|
|
81
|
-
throw new Error(`attest-and-publish: projectUrl was given but the remote ${url} resolves to the git-notes ` +
|
|
82
|
-
'store; pass store: "gitlab-registry" to publish to the registry, or drop projectUrl');
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (resolvedStore === "gitlab-registry" && projectUrl === undefined) {
|
|
86
|
-
throw new Error("attest-and-publish: the gitlab-registry store needs a projectUrl, and none was given");
|
|
87
|
-
}
|
|
53
|
+
steps: [attestGate, gitNotesAttestationPublish],
|
|
54
|
+
async run(ctx, { repoPath, commit, configPath, base, remote, minRemainingHours, replace }) {
|
|
88
55
|
await ctx.status("running-gate");
|
|
89
56
|
const gate = await ctx.run(attestGate, {
|
|
90
57
|
repository: repoPath,
|
|
@@ -109,52 +76,15 @@ export default defineWorkflow({
|
|
|
109
76
|
};
|
|
110
77
|
}
|
|
111
78
|
await ctx.status("publishing");
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
...(replace === true ? { replace } : {}),
|
|
122
|
-
});
|
|
123
|
-
publish = { store: "git-notes", ...published };
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
const registryProjectUrl = projectUrl ?? "";
|
|
127
|
-
const publishInput = {
|
|
128
|
-
projectUrl: registryProjectUrl,
|
|
129
|
-
sha: gate.commitSha,
|
|
130
|
-
envelope: gate.envelope,
|
|
131
|
-
maxAgeHours: gate.maxAgeHours,
|
|
132
|
-
...(minRemainingHours !== undefined ? { minRemainingHours } : {}),
|
|
133
|
-
};
|
|
134
|
-
if (replace === true) {
|
|
135
|
-
await ctx.status("replacing-stale-attestation");
|
|
136
|
-
await ctx.run(gitlabRegistryDeleteAttestation, {
|
|
137
|
-
projectUrl: registryProjectUrl,
|
|
138
|
-
sha: gate.commitSha,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
const first = await ctx.run(gitlabRegistryPublishAttestation, publishInput);
|
|
142
|
-
if (isPublished(first)) {
|
|
143
|
-
publish = { store: "gitlab-registry", ...first };
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
await ctx.status("replacing-stale-attestation");
|
|
147
|
-
await ctx.run(gitlabRegistryDeleteAttestation, {
|
|
148
|
-
projectUrl: registryProjectUrl,
|
|
149
|
-
sha: gate.commitSha,
|
|
150
|
-
});
|
|
151
|
-
const second = await ctx.run(gitlabRegistryPublishAttestation, publishInput);
|
|
152
|
-
if (!isPublished(second)) {
|
|
153
|
-
throw new Error(`the attestation for ${gate.commitSha} is still stale after it was deleted and published again`);
|
|
154
|
-
}
|
|
155
|
-
publish = { store: "gitlab-registry", ...second };
|
|
156
|
-
}
|
|
157
|
-
}
|
|
79
|
+
const publish = await ctx.run(gitNotesAttestationPublish, {
|
|
80
|
+
repoPath,
|
|
81
|
+
remote: remote ?? "origin",
|
|
82
|
+
sha: gate.commitSha,
|
|
83
|
+
envelope: gate.envelope,
|
|
84
|
+
maxAgeHours: gate.maxAgeHours,
|
|
85
|
+
...(minRemainingHours !== undefined ? { minRemainingHours } : {}),
|
|
86
|
+
...(replace === true ? { replace } : {}),
|
|
87
|
+
});
|
|
158
88
|
await ctx.status("done", {
|
|
159
89
|
runOutcome: "passed",
|
|
160
90
|
result: gate.predicate.result,
|
package/dist/workflow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,qGAAqG;AACrG,OAAO,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,6BAA6B,G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C,MAAM;SAC9B,CAAC,CAAC;QACH,OAAO;YACL,UAAU,EAAE,QAAiB;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO;SACR,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ligeti/workflow-attest-and-publish",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"ligeti": {
|
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@ligeti/step-git-notes-attestation": "1.1.1",
|
|
16
|
-
"@ligeti/step-git-worktree": "2.2.1",
|
|
17
|
-
"@ligeti/step-gitlab-registry": "2.2.1",
|
|
18
15
|
"@ligeti/sdk": "2.5.0",
|
|
19
|
-
"@ligeti/step-attest": "3.2.2"
|
|
16
|
+
"@ligeti/step-attest": "3.2.2",
|
|
17
|
+
"@ligeti/step-git-notes-attestation": "1.2.0"
|
|
20
18
|
},
|
|
21
19
|
"devDependencies": {
|
|
22
20
|
"ajv": "^8.20.0"
|
package/dist/store.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from "@ligeti/sdk";
|
|
2
|
-
export declare const AttestationStore: z.ZodEnum<{
|
|
3
|
-
"gitlab-registry": "gitlab-registry";
|
|
4
|
-
"git-notes": "git-notes";
|
|
5
|
-
}>;
|
|
6
|
-
export type AttestationStore = z.infer<typeof AttestationStore>;
|
|
7
|
-
export declare function remoteHost(remoteUrl: string): string | undefined;
|
|
8
|
-
export declare function storeForRemoteUrl(remoteUrl: string): AttestationStore;
|
|
9
|
-
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,eAAO,MAAM,gBAAgB;;;EAA2C,CAAC;AACzE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAMhE,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIhE;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAErE"}
|
package/dist/store.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// ABOUTME: The attestation store a repository's attestations are published to, and the host rule that
|
|
2
|
-
// ABOUTME: picks it from the repository's remote URL: gitlab.com means the registry, any other host git notes.
|
|
3
|
-
import { z } from "@ligeti/sdk";
|
|
4
|
-
export const AttestationStore = z.enum(["gitlab-registry", "git-notes"]);
|
|
5
|
-
const URL_FORM = /^[A-Za-z][A-Za-z0-9+.-]*:\/\/(?:[^@/]*@)?(\[[^\]]+\]|[^/:@]+)(?::\d*)?(?:[/?#]|$)/;
|
|
6
|
-
const SCP_FORM = /^(?:[^@/:]+@)?([^/:@]+):/;
|
|
7
|
-
export function remoteHost(remoteUrl) {
|
|
8
|
-
const url = remoteUrl.trim();
|
|
9
|
-
const match = URL_FORM.exec(url) ?? (url.includes("://") ? null : SCP_FORM.exec(url));
|
|
10
|
-
return match?.[1]?.toLowerCase();
|
|
11
|
-
}
|
|
12
|
-
export function storeForRemoteUrl(remoteUrl) {
|
|
13
|
-
return remoteHost(remoteUrl) === "gitlab.com" ? "gitlab-registry" : "git-notes";
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=store.js.map
|
package/dist/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,+GAA+G;AAC/G,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC,CAAC;AAGzE,MAAM,QAAQ,GACZ,mFAAmF,CAAC;AACtF,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAE5C,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACtF,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC;AAClF,CAAC"}
|