@ligeti/step-git-notes-attestation 0.0.0-stage → 1.0.1
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 +201 -0
- package/README.md +46 -2
- package/dist/fetch.d.ts +4 -0
- package/dist/fetch.d.ts.map +1 -0
- package/dist/fetch.js +44 -0
- package/dist/fetch.js.map +1 -0
- package/dist/freshness.d.ts +3 -0
- package/dist/freshness.d.ts.map +1 -0
- package/dist/freshness.js +36 -0
- package/dist/freshness.js.map +1 -0
- package/dist/git.d.ts +20 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +131 -0
- package/dist/git.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/publish.d.ts +5 -0
- package/dist/publish.d.ts.map +1 -0
- package/dist/publish.js +62 -0
- package/dist/publish.js.map +1 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +61 -0
- package/dist/types.js.map +1 -0
- package/package.json +26 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Viktor "Bika" Nagy
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ligeti/step-git-notes-attestation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Publishes a Ligeti attestation envelope as a git note on a remote, and reads one back. It is the
|
|
4
|
+
git-hosting-neutral counterpart of [`@ligeti/step-gitlab-registry`](../gitlab-registry/README.md):
|
|
5
|
+
any remote git can push to — GitHub included — can hold the attestations. See
|
|
6
|
+
[`docs/attestation.md`](../../docs/attestation.md) for what the envelope is and proves.
|
|
7
|
+
|
|
8
|
+
Each attestation is one note, holding the envelope's JSON, on the commit it attests, under the
|
|
9
|
+
notes ref `refs/notes/ligeti-attestations`.
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
| Step | Purpose | Key inputs |
|
|
14
|
+
| ------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `git-notes-attestation.publish` | Publishes an attestation envelope as the commit's note on the remote's notes ref. | `repoPath`, `remote` (default `origin`), `sha`, `envelope`, `maxAgeHours`, `minRemainingHours` (optional, default 0), `replace` (optional, default false) |
|
|
16
|
+
| `git-notes-attestation.fetch` | Returns the envelope noted on a commit, or `null`. | `repoPath`, `remote` (default `origin`), `sha` |
|
|
17
|
+
|
|
18
|
+
Output of `publish` is `{ status, remote, ref, sha }`, `status` being `"published"` or
|
|
19
|
+
`"already-published"`. Output of `fetch` is `{ envelope }`, an object or `null`.
|
|
20
|
+
|
|
21
|
+
## How publishing works
|
|
22
|
+
|
|
23
|
+
1. Fetch the remote's notes ref into a private, per-run local ref (`refs/notes/ligeti-attestations-<uuid>`,
|
|
24
|
+
deleted when the step ends, even after a failure or a cancellation; a failure to delete it is logged and never replaces the step's own error), so concurrent publishers in linked worktrees of one clone never share
|
|
25
|
+
state. A remote without the ref yet means "no notes", not an error.
|
|
26
|
+
2. If the commit's note is an envelope whose `predicate.verifiedAt` is at most
|
|
27
|
+
`maxAgeHours - minRemainingHours` hours old, return `"already-published"`. The signature is not
|
|
28
|
+
checked — CI's verifier does that. A stale or unreadable note is not reported: it is replaced. With `replace: true` the freshness check is skipped and
|
|
29
|
+
any existing note is overwritten, so a note that fails verification but looks fresh can be
|
|
30
|
+
replaced.
|
|
31
|
+
3. Add the note (forcing, so a stale one is overwritten) and push the private ref to the remote's notes ref.
|
|
32
|
+
4. If the push loses a race to another publisher, go back to step 1. After 5 rejected pushes the
|
|
33
|
+
step throws.
|
|
34
|
+
|
|
35
|
+
The step declares `retry: { maxAttempts: 3, intervalSeconds: 2 }`: both steps are safe to repeat.
|
|
36
|
+
|
|
37
|
+
## Credentials and environment
|
|
38
|
+
|
|
39
|
+
The steps run plain `git` in `repoPath` with an environment built explicitly: `PATH`, `HOME` and
|
|
40
|
+
`LC_ALL=C`, the XDG variables, plus `SSH_AUTH_SOCK`, `GIT_SSH_COMMAND`, `SSH_ASKPASS`,
|
|
41
|
+
`GIT_ASKPASS` and proxy variables — what `@ligeti/step-git-worktree` passes to its
|
|
42
|
+
pushes. Prompts are disabled. Authentication is whatever
|
|
43
|
+
git already uses for the remote (an SSH agent, or a credential helper reached through `HOME`).
|
|
44
|
+
`GITHUB_TOKEN` is not passed to git. The repository needs a committer identity configured, since
|
|
45
|
+
adding a note makes a commit.
|
|
46
|
+
|
|
47
|
+
The package reads no configuration of its own.
|
package/dist/fetch.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type StepDefinition } from "@ligeti/sdk";
|
|
2
|
+
import { GitNotesFetchInput, GitNotesFetchOutput } from "./types.js";
|
|
3
|
+
export declare const gitNotesAttestationFetch: StepDefinition<typeof GitNotesFetchInput, typeof GitNotesFetchOutput>;
|
|
4
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAErE,eAAO,MAAM,wBAAwB,EAAE,cAAc,CACnD,OAAO,kBAAkB,EACzB,OAAO,mBAAmB,CAqC1B,CAAC"}
|
package/dist/fetch.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// ABOUTME: gitNotesAttestationFetch, the step that fetches refs/notes/ligeti-attestations from a remote
|
|
2
|
+
// ABOUTME: and returns the attestation envelope noted on a commit sha, or null when there is none.
|
|
3
|
+
import { defineStep } from "@ligeti/sdk";
|
|
4
|
+
import pkg from "../package.json" with { type: "json" };
|
|
5
|
+
import { notesGit, GIT_NOTES_ENV_VARS } from "./git.js";
|
|
6
|
+
import { GitNotesFetchInput, GitNotesFetchOutput } from "./types.js";
|
|
7
|
+
export const gitNotesAttestationFetch = defineStep({
|
|
8
|
+
name: "git-notes-attestation.fetch",
|
|
9
|
+
envVars: GIT_NOTES_ENV_VARS,
|
|
10
|
+
description: "Fetches the attestation notes ref from a remote and returns the envelope noted on a commit sha, or null.",
|
|
11
|
+
package: { name: pkg.name, version: pkg.version },
|
|
12
|
+
input: GitNotesFetchInput,
|
|
13
|
+
output: GitNotesFetchOutput,
|
|
14
|
+
retry: { maxAttempts: 3, intervalSeconds: 2 },
|
|
15
|
+
async run(sctx, input) {
|
|
16
|
+
const git = notesGit(input.repoPath, sctx.signal, sctx.logger);
|
|
17
|
+
let note;
|
|
18
|
+
try {
|
|
19
|
+
await git.fetchNotes(input.remote);
|
|
20
|
+
note = await git.showNote(input.sha);
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
await git.dispose();
|
|
24
|
+
}
|
|
25
|
+
if (note === null) {
|
|
26
|
+
return { envelope: null };
|
|
27
|
+
}
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = JSON.parse(note);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
throw new Error(`git-notes-attestation.fetch: the note on ${input.sha} is not valid JSON`, {
|
|
34
|
+
cause: err,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const output = GitNotesFetchOutput.safeParse({ envelope: parsed });
|
|
38
|
+
if (!output.success) {
|
|
39
|
+
throw new Error(`git-notes-attestation.fetch: the note on ${input.sha} is not a JSON object`);
|
|
40
|
+
}
|
|
41
|
+
return output.data;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,mGAAmG;AACnG,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAC9D,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,CAAC,MAAM,wBAAwB,GAGjC,UAAU,CAAC;IACb,IAAI,EAAE,6BAA6B;IACnC,OAAO,EAAE,kBAAkB;IAC3B,WAAW,EACT,0GAA0G;IAC5G,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE;IACjD,KAAK,EAAE,kBAAkB;IACzB,MAAM,EAAE,mBAAmB;IAC3B,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE;IAE7C,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK;QACnB,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,IAAmB,CAAC;QACxB,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACnC,IAAI,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC;gBAAS,CAAC;YACT,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC5B,CAAC;QACD,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,4CAA4C,KAAK,CAAC,GAAG,oBAAoB,EAAE;gBACzF,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;QACL,CAAC;QACD,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,4CAA4C,KAAK,CAAC,GAAG,uBAAuB,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freshness.d.ts","sourceRoot":"","sources":["../src/freshness.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAiBhE;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,MAAM,EACzB,GAAG,GAAE,MAAmB,GACvB,OAAO,CAOT"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// ABOUTME: Reads an attestation envelope's verifiedAt from its DSSE payload and judges whether the
|
|
2
|
+
// ABOUTME: attestation still has minRemainingHours of freshness left, as gitlab-registry does.
|
|
3
|
+
import { z } from "@ligeti/sdk";
|
|
4
|
+
const HOUR_MS = 60 * 60 * 1000;
|
|
5
|
+
const EnvelopePayload = z.object({ payload: z.string() }).loose();
|
|
6
|
+
const StatementVerifiedAt = z
|
|
7
|
+
.object({ predicate: z.object({ verifiedAt: z.string() }).loose() })
|
|
8
|
+
.loose();
|
|
9
|
+
export function verifiedAtOf(envelope) {
|
|
10
|
+
const parsedEnvelope = EnvelopePayload.safeParse(envelope);
|
|
11
|
+
if (!parsedEnvelope.success) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
let statement;
|
|
15
|
+
try {
|
|
16
|
+
statement = JSON.parse(Buffer.from(parsedEnvelope.data.payload, "base64").toString("utf8"));
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const parsedStatement = StatementVerifiedAt.safeParse(statement);
|
|
22
|
+
if (!parsedStatement.success) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const verifiedAt = new Date(parsedStatement.data.predicate.verifiedAt);
|
|
26
|
+
return Number.isNaN(verifiedAt.getTime()) ? undefined : verifiedAt;
|
|
27
|
+
}
|
|
28
|
+
export function isFreshEnough(envelope, maxAgeHours, minRemainingHours, now = Date.now()) {
|
|
29
|
+
const verifiedAt = verifiedAtOf(envelope);
|
|
30
|
+
if (verifiedAt === undefined) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const ageHours = (now - verifiedAt.getTime()) / HOUR_MS;
|
|
34
|
+
return ageHours <= maxAgeHours - minRemainingHours;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=freshness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freshness.js","sourceRoot":"","sources":["../src/freshness.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,+FAA+F;AAC/F,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,I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nB,iBAAyB,EACzB,MAAc,IAAI,CAAC,GAAG,EAAE;IAExB,MAAM,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC1C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,QAAQ,GAAG,CAAC,GAAG,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;IACxD,OAAO,QAAQ,IAAI,WAAW,GAAG,iBAAiB,CAAC;AACrD,CAAC"}
|
package/dist/git.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type StepContext } from "@ligeti/sdk";
|
|
2
|
+
export declare const GIT_NOTES_ENV_VARS: {
|
|
3
|
+
optional: string[];
|
|
4
|
+
public: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare function gitEnv(logger: StepContext["logger"], source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
7
|
+
export declare class GitError extends Error {
|
|
8
|
+
readonly stderr: string;
|
|
9
|
+
readonly exitCode: number | undefined;
|
|
10
|
+
constructor(message: string, stderr: string, exitCode: number | undefined);
|
|
11
|
+
}
|
|
12
|
+
export interface NotesGit {
|
|
13
|
+
fetchNotes(remote: string): Promise<void>;
|
|
14
|
+
showNote(sha: string): Promise<string | null>;
|
|
15
|
+
addNote(sha: string, content: string): Promise<void>;
|
|
16
|
+
pushNotes(remote: string): Promise<"pushed" | "rejected">;
|
|
17
|
+
dispose(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare function notesGit(repoPath: string, signal: AbortSignal, logger: StepContext["logger"], env?: NodeJS.ProcessEnv): NotesGit;
|
|
20
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0C,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAKvF,eAAO,MAAM,kBAAkB;;;CA+BD,CAAC;AAE/B,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAC7B,MAAM,GAAE,MAAM,CAAC,UAAwB,GACtC,MAAM,CAAC,UAAU,CAOnB;AAED,qBAAa,QAAS,SAAQ,KAAK;IAG/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;gBAFrC,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,SAAS;CAKxC;AAuCD,MAAM,WAAW,QAAQ;IACvB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;IAC1D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAC7B,GAAG,GAAE,MAAM,CAAC,UAA2B,GACtC,QAAQ,CA4DV"}
|
package/dist/git.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// ABOUTME: Runs a real `git` subprocess for the notes steps with an explicit environment, and
|
|
2
|
+
// ABOUTME: wraps the fetch, show, add and push operations on the attestation notes ref.
|
|
3
|
+
import { execFile } from "node:child_process";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import { buildSpawnEnv } from "@ligeti/sdk";
|
|
6
|
+
import { NOTES_REF } from "./types.js";
|
|
7
|
+
const GIT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
8
|
+
export const GIT_NOTES_ENV_VARS = {
|
|
9
|
+
optional: [
|
|
10
|
+
"XDG_RUNTIME_DIR",
|
|
11
|
+
"XDG_CONFIG_HOME",
|
|
12
|
+
"XDG_STATE_HOME",
|
|
13
|
+
"XDG_DATA_HOME",
|
|
14
|
+
"SSH_AUTH_SOCK",
|
|
15
|
+
"GIT_SSH_COMMAND",
|
|
16
|
+
"SSH_ASKPASS",
|
|
17
|
+
"GIT_ASKPASS",
|
|
18
|
+
"HTTP_PROXY",
|
|
19
|
+
"HTTPS_PROXY",
|
|
20
|
+
"NO_PROXY",
|
|
21
|
+
"http_proxy",
|
|
22
|
+
"https_proxy",
|
|
23
|
+
"no_proxy",
|
|
24
|
+
"ALL_PROXY",
|
|
25
|
+
"all_proxy",
|
|
26
|
+
],
|
|
27
|
+
public: [
|
|
28
|
+
"XDG_RUNTIME_DIR",
|
|
29
|
+
"XDG_CONFIG_HOME",
|
|
30
|
+
"XDG_STATE_HOME",
|
|
31
|
+
"XDG_DATA_HOME",
|
|
32
|
+
"SSH_AUTH_SOCK",
|
|
33
|
+
"GIT_SSH_COMMAND",
|
|
34
|
+
"SSH_ASKPASS",
|
|
35
|
+
"GIT_ASKPASS",
|
|
36
|
+
"NO_PROXY",
|
|
37
|
+
"no_proxy",
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
export function gitEnv(logger, source = process.env) {
|
|
41
|
+
const env = buildSpawnEnv(GIT_NOTES_ENV_VARS, { logger, source });
|
|
42
|
+
env.LC_ALL = "C";
|
|
43
|
+
env.LANG = "C";
|
|
44
|
+
env.GIT_TERMINAL_PROMPT = "0";
|
|
45
|
+
env.GIT_SSH_COMMAND ??= "ssh -o BatchMode=yes";
|
|
46
|
+
return env;
|
|
47
|
+
}
|
|
48
|
+
export class GitError extends Error {
|
|
49
|
+
stderr;
|
|
50
|
+
exitCode;
|
|
51
|
+
constructor(message, stderr, exitCode) {
|
|
52
|
+
super(message);
|
|
53
|
+
this.stderr = stderr;
|
|
54
|
+
this.exitCode = exitCode;
|
|
55
|
+
this.name = "GitError";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function runGit(repoPath, args, signal, env) {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
execFile("git", ["-C", repoPath, ...args], { env, signal, timeout: GIT_TIMEOUT_MS, maxBuffer: 64 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
61
|
+
if (error === null) {
|
|
62
|
+
resolve(stdout);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (error.name === "AbortError") {
|
|
66
|
+
reject(Object.assign(new Error(error.message, { cause: error }), { name: "AbortError" }));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
reject(new GitError(`git ${args.join(" ").slice(0, 200)} failed: ${stderr.trim()}`, stderr, typeof error.code === "number" ? error.code : undefined));
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const LS_REMOTE_NO_MATCH = 2;
|
|
74
|
+
const NO_NOTE = /no note found/i;
|
|
75
|
+
const REJECTED = /\[rejected\]|non-fast-forward|fetch first|reference already exists|cannot lock ref/i;
|
|
76
|
+
export function notesGit(repoPath, signal, logger, env = gitEnv(logger)) {
|
|
77
|
+
const localRef = `${NOTES_REF}-${randomUUID()}`;
|
|
78
|
+
return {
|
|
79
|
+
async fetchNotes(remote) {
|
|
80
|
+
try {
|
|
81
|
+
await runGit(repoPath, ["ls-remote", "--exit-code", remote, NOTES_REF], signal, env);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
if (err instanceof GitError && err.exitCode === LS_REMOTE_NO_MATCH) {
|
|
85
|
+
await runGit(repoPath, ["update-ref", "-d", localRef], signal, env);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
await runGit(repoPath, ["fetch", "--no-tags", remote, `+${NOTES_REF}:${localRef}`], signal, env);
|
|
91
|
+
},
|
|
92
|
+
async showNote(sha) {
|
|
93
|
+
try {
|
|
94
|
+
return await runGit(repoPath, ["notes", "--ref", localRef, "show", sha], signal, env);
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
if (err instanceof GitError && NO_NOTE.test(err.stderr)) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
throw err;
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
async addNote(sha, content) {
|
|
104
|
+
await runGit(repoPath, ["notes", "--ref", localRef, "add", "-f", "-m", content, sha], signal, env);
|
|
105
|
+
},
|
|
106
|
+
async pushNotes(remote) {
|
|
107
|
+
try {
|
|
108
|
+
await runGit(repoPath, ["push", remote, `${localRef}:${NOTES_REF}`], signal, env);
|
|
109
|
+
return "pushed";
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
if (err instanceof GitError && REJECTED.test(err.stderr)) {
|
|
113
|
+
return "rejected";
|
|
114
|
+
}
|
|
115
|
+
throw err;
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
async dispose() {
|
|
119
|
+
try {
|
|
120
|
+
await runGit(repoPath, ["update-ref", "-d", localRef], new AbortController().signal, env);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
logger.warn("git-notes-attestation: could not delete the private notes ref", {
|
|
124
|
+
ref: localRef,
|
|
125
|
+
error: err instanceof Error ? err.message : String(err),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=git.js.map
|
package/dist/git.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wFAAwF;AACxF,OAAO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,4 @@
|
|
|
1
|
+
export { gitNotesAttestationPublish } from "./publish.js";
|
|
2
|
+
export { gitNotesAttestationFetch } from "./fetch.js";
|
|
3
|
+
export { GitNotesPublishInput, GitNotesPublishOutput, GitNotesFetchInput, GitNotesFetchOutput, NOTES_REF, isSafeRemoteName, } from "./types.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// ABOUTME: Public entry point of @ligeti/step-git-notes-attestation: the publish and fetch steps, their
|
|
2
|
+
// ABOUTME: input/output schemas and types, and the notes ref the attestations live under.
|
|
3
|
+
export { gitNotesAttestationPublish } from "./publish.js";
|
|
4
|
+
export { gitNotesAttestationFetch } from "./fetch.js";
|
|
5
|
+
export { GitNotesPublishInput, GitNotesPublishOutput, GitNotesFetchInput, GitNotesFetchOutput, NOTES_REF, isSafeRemoteName, } from "./types.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,0FAA0F;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type StepDefinition } from "@ligeti/sdk";
|
|
2
|
+
import { GitNotesPublishInput, GitNotesPublishOutput } from "./types.js";
|
|
3
|
+
export declare const MAX_PUSH_ATTEMPTS = 5;
|
|
4
|
+
export declare const gitNotesAttestationPublish: StepDefinition<typeof GitNotesPublishInput, typeof GitNotesPublishOutput>;
|
|
5
|
+
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAI9D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAa,MAAM,YAAY,CAAC;AAEpF,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAanC,eAAO,MAAM,0BAA0B,EAAE,cAAc,CACrD,OAAO,oBAAoB,EAC3B,OAAO,qBAAqB,CAmD5B,CAAC"}
|
package/dist/publish.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// ABOUTME: gitNotesAttestationPublish, the step that publishes an attestation envelope as a git note
|
|
2
|
+
// ABOUTME: on refs/notes/ligeti-attestations of a remote, overwriting a stale note and retrying a race.
|
|
3
|
+
import { defineStep } from "@ligeti/sdk";
|
|
4
|
+
import pkg from "../package.json" with { type: "json" };
|
|
5
|
+
import { isFreshEnough } from "./freshness.js";
|
|
6
|
+
import { notesGit, GIT_NOTES_ENV_VARS } from "./git.js";
|
|
7
|
+
import { GitNotesPublishInput, GitNotesPublishOutput, NOTES_REF } from "./types.js";
|
|
8
|
+
export const MAX_PUSH_ATTEMPTS = 5;
|
|
9
|
+
function parseNote(note) {
|
|
10
|
+
if (note === null) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(note);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const gitNotesAttestationPublish = defineStep({
|
|
21
|
+
name: "git-notes-attestation.publish",
|
|
22
|
+
envVars: GIT_NOTES_ENV_VARS,
|
|
23
|
+
description: "Publishes an attestation envelope as a git note on refs/notes/ligeti-attestations of a remote, keyed by commit sha.",
|
|
24
|
+
package: { name: pkg.name, version: pkg.version },
|
|
25
|
+
input: GitNotesPublishInput,
|
|
26
|
+
output: GitNotesPublishOutput,
|
|
27
|
+
retry: { maxAttempts: 3, intervalSeconds: 2 },
|
|
28
|
+
async run(sctx, input) {
|
|
29
|
+
const { repoPath, remote, sha, envelope, maxAgeHours, replace } = input;
|
|
30
|
+
const minRemainingHours = input.minRemainingHours ?? 0;
|
|
31
|
+
const git = notesGit(repoPath, sctx.signal, sctx.logger);
|
|
32
|
+
const result = (status) => GitNotesPublishOutput.parse({ status, remote, ref: NOTES_REF, sha });
|
|
33
|
+
try {
|
|
34
|
+
for (let attempt = 1; attempt <= MAX_PUSH_ATTEMPTS; attempt++) {
|
|
35
|
+
await git.fetchNotes(remote);
|
|
36
|
+
const existing = parseNote(await git.showNote(sha));
|
|
37
|
+
if (replace !== true &&
|
|
38
|
+
existing !== undefined &&
|
|
39
|
+
isFreshEnough(existing, maxAgeHours, minRemainingHours)) {
|
|
40
|
+
sctx.logger.info("git-notes-attestation: attestation already published", { sha, remote });
|
|
41
|
+
return result("already-published");
|
|
42
|
+
}
|
|
43
|
+
await git.addNote(sha, JSON.stringify(envelope));
|
|
44
|
+
if ((await git.pushNotes(remote)) === "pushed") {
|
|
45
|
+
sctx.logger.info("git-notes-attestation: published attestation", { sha, remote });
|
|
46
|
+
return result("published");
|
|
47
|
+
}
|
|
48
|
+
sctx.logger.warn("git-notes-attestation: push rejected, refetching and retrying", {
|
|
49
|
+
sha,
|
|
50
|
+
remote,
|
|
51
|
+
attempt,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`git-notes-attestation.publish: ${remote} rejected ${NOTES_REF} as a non-fast-forward ` +
|
|
55
|
+
`${String(MAX_PUSH_ATTEMPTS)} times in a row while publishing ${sha}`);
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
await git.dispose();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,wGAAwG;AACxG,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAC9D,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEpF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC,SAAS,SAAS,CAAC,IAAmB;IACpC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAGnC,UAAU,CAAC;IACb,IAAI,EAAE,+BAA+B;IACrC,OAAO,EAAE,kBAAkB;IAC3B,WAAW,EACT,qHAAqH;IACvH,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,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,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACjD,IAAI,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;oBAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8CAA8C,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;oBAClF,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC7B,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+DAA+D,EAAE;oBAChF,GAAG;oBACH,MAAM;oBACN,OAAO;iBACR,CAAC,CAAC;YACL,CAAC;YAED,MAAM,IAAI,KAAK,CACb,kCAAkC,MAAM,aAAa,SAAS,yBAAyB;gBACrF,GAAG,MAAM,CAAC,iBAAiB,CAAC,oCAAoC,GAAG,EAAE,CACxE,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "@ligeti/sdk";
|
|
2
|
+
export declare const NOTES_REF = "refs/notes/ligeti-attestations";
|
|
3
|
+
export declare function isSafeRemoteName(name: string): boolean;
|
|
4
|
+
export declare const GitNotesPublishInput: z.ZodObject<{
|
|
5
|
+
repoPath: z.ZodString;
|
|
6
|
+
remote: z.ZodDefault<z.ZodString>;
|
|
7
|
+
sha: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
8
|
+
envelope: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
9
|
+
maxAgeHours: z.ZodNumber;
|
|
10
|
+
minRemainingHours: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
export type GitNotesPublishInput = z.infer<typeof GitNotesPublishInput>;
|
|
14
|
+
export declare const GitNotesPublishOutput: z.ZodObject<{
|
|
15
|
+
status: z.ZodEnum<{
|
|
16
|
+
published: "published";
|
|
17
|
+
"already-published": "already-published";
|
|
18
|
+
}>;
|
|
19
|
+
remote: z.ZodString;
|
|
20
|
+
ref: z.ZodString;
|
|
21
|
+
sha: z.ZodString;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type GitNotesPublishOutput = z.infer<typeof GitNotesPublishOutput>;
|
|
24
|
+
export declare const GitNotesFetchInput: z.ZodObject<{
|
|
25
|
+
repoPath: z.ZodString;
|
|
26
|
+
remote: z.ZodDefault<z.ZodString>;
|
|
27
|
+
sha: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export type GitNotesFetchInput = z.infer<typeof GitNotesFetchInput>;
|
|
30
|
+
export declare const GitNotesFetchOutput: z.ZodObject<{
|
|
31
|
+
envelope: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export type GitNotesFetchOutput = z.infer<typeof GitNotesFetchOutput>;
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,eAAO,MAAM,SAAS,mCAAmC,CAAC;AAE1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOtD;AAiBD,eAAO,MAAM,oBAAoB;;;;;;;;kBAUtB,CAAC;AACZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,eAAO,MAAM,qBAAqB;;;;;;;;kBAOvB,CAAC;AACZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,eAAO,MAAM,kBAAkB;;;;kBAMpB,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,eAAO,MAAM,mBAAmB;;kBAIrB,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// ABOUTME: Shared zod schemas for the git-notes-attestation steps: the inputs they take, the outputs
|
|
2
|
+
// ABOUTME: they return, and the notes ref an attestation envelope is kept under.
|
|
3
|
+
import { z } from "@ligeti/sdk";
|
|
4
|
+
export const NOTES_REF = "refs/notes/ligeti-attestations";
|
|
5
|
+
export function isSafeRemoteName(name) {
|
|
6
|
+
if (name.startsWith("-"))
|
|
7
|
+
return false;
|
|
8
|
+
if (/\s/.test(name))
|
|
9
|
+
return false;
|
|
10
|
+
if (name.includes("://"))
|
|
11
|
+
return false;
|
|
12
|
+
if (name.includes("@"))
|
|
13
|
+
return false;
|
|
14
|
+
if (name.includes(".."))
|
|
15
|
+
return false;
|
|
16
|
+
return /^[A-Za-z0-9._/-]+$/.test(name);
|
|
17
|
+
}
|
|
18
|
+
const ShaString = z
|
|
19
|
+
.string()
|
|
20
|
+
.regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i, "must be a 40 or 64 character hex SHA")
|
|
21
|
+
.transform((value) => value.toLowerCase());
|
|
22
|
+
const RemoteName = z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.refine(isSafeRemoteName, {
|
|
26
|
+
message: 'must be a safe remote name: no leading "-", no whitespace, no "..", and not a URL ' +
|
|
27
|
+
'(no "://" or "@")',
|
|
28
|
+
})
|
|
29
|
+
.default("origin");
|
|
30
|
+
export const GitNotesPublishInput = z
|
|
31
|
+
.object({
|
|
32
|
+
repoPath: z.string().min(1),
|
|
33
|
+
remote: RemoteName,
|
|
34
|
+
sha: ShaString,
|
|
35
|
+
envelope: z.record(z.string(), z.unknown()),
|
|
36
|
+
maxAgeHours: z.number().positive(),
|
|
37
|
+
minRemainingHours: z.number().nonnegative().optional(),
|
|
38
|
+
replace: z.boolean().optional(),
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
41
|
+
export const GitNotesPublishOutput = z
|
|
42
|
+
.object({
|
|
43
|
+
status: z.enum(["published", "already-published"]),
|
|
44
|
+
remote: z.string(),
|
|
45
|
+
ref: z.string(),
|
|
46
|
+
sha: z.string(),
|
|
47
|
+
})
|
|
48
|
+
.strict();
|
|
49
|
+
export const GitNotesFetchInput = z
|
|
50
|
+
.object({
|
|
51
|
+
repoPath: z.string().min(1),
|
|
52
|
+
remote: RemoteName,
|
|
53
|
+
sha: ShaString,
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
export const GitNotesFetchOutput = z
|
|
57
|
+
.object({
|
|
58
|
+
envelope: z.record(z.string(), z.unknown()).nullable(),
|
|
59
|
+
})
|
|
60
|
+
.strict();
|
|
61
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,iFAAiF;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,MAAM,CAAC,MAAM,SAAS,GAAG,gCAAgC,CAAC;AAE1D,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,I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,mBAAmB,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,MAAM,EAAE,UAAU;IAClB,GAAG,EAAE,SAAS;CACf,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACvD,CAAC;KACD,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ligeti/step-git-notes-attestation",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Ligeti step package: publishes and fetches gate attestation envelopes as git notes on a remote.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://gitlab.com/nagyv-projects/ligeti.git",
|
|
10
|
+
"directory": "steps/git-notes-attestation"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@ligeti/sdk": "^2.3.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@ligeti/sdk": "2.3.0",
|
|
26
|
+
"@ligeti/testing": "2.0.6"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {}
|
|
6
29
|
}
|