@livingdata/pipex 0.0.7 → 0.0.8
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.
|
@@ -114,6 +114,7 @@ export class PipelineRunner {
|
|
|
114
114
|
this.reporter.result(workspace.id, stepRef, result);
|
|
115
115
|
if (result.exitCode === 0 || step.allowFailure) {
|
|
116
116
|
await workspace.commitArtifact(artifactId);
|
|
117
|
+
await workspace.linkArtifact(step.id, artifactId);
|
|
117
118
|
stepArtifacts.set(step.id, artifactId);
|
|
118
119
|
state.setStep(step.id, artifactId, currentFingerprint);
|
|
119
120
|
await state.save();
|
|
@@ -135,6 +136,7 @@ export class PipelineRunner {
|
|
|
135
136
|
const artifacts = await workspace.listArtifacts();
|
|
136
137
|
if (artifacts.includes(cached.artifactId)) {
|
|
137
138
|
stepArtifacts.set(step.id, cached.artifactId);
|
|
139
|
+
await workspace.linkArtifact(step.id, cached.artifactId);
|
|
138
140
|
this.reporter.state(workspace.id, 'STEP_SKIPPED', stepRef, { artifactId: cached.artifactId, reason: 'cached' });
|
|
139
141
|
return true;
|
|
140
142
|
}
|
package/dist/engine/workspace.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { access, mkdir, readdir, rename, rm } from 'node:fs/promises';
|
|
1
|
+
import { access, mkdir, readdir, rename, rm, symlink } from 'node:fs/promises';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
/**
|
|
@@ -159,6 +159,19 @@ export class Workspace {
|
|
|
159
159
|
async commitArtifact(artifactId) {
|
|
160
160
|
await rename(this.stagingPath(artifactId), this.artifactPath(artifactId));
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Creates a symlink from `step-artifacts/{stepId}` to the committed artifact.
|
|
164
|
+
* Replaces any existing symlink for the same step.
|
|
165
|
+
* @param stepId - Step identifier
|
|
166
|
+
* @param artifactId - Committed artifact identifier
|
|
167
|
+
*/
|
|
168
|
+
async linkArtifact(stepId, artifactId) {
|
|
169
|
+
const dir = join(this.root, 'step-artifacts');
|
|
170
|
+
await mkdir(dir, { recursive: true });
|
|
171
|
+
const linkPath = join(dir, stepId);
|
|
172
|
+
await rm(linkPath, { force: true });
|
|
173
|
+
await symlink(join('..', 'artifacts', artifactId), linkPath);
|
|
174
|
+
}
|
|
162
175
|
/**
|
|
163
176
|
* Discards a staging artifact (on execution failure).
|
|
164
177
|
* @param artifactId - Artifact identifier
|