@deployfoundation/foundation-deploy 0.1.1 → 0.1.2
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.
|
@@ -70,10 +70,16 @@ async function unpackReleaseSkills(ctx, release) {
|
|
|
70
70
|
const key = release.manifest?.skills.key ?? skillsKey(release.version);
|
|
71
71
|
const dir = mkdtempSync(join(tmpdir(), "foundation-skills-"));
|
|
72
72
|
const tarball = join(dir, "skills.tar.gz");
|
|
73
|
-
const contents = join(dir, "skills");
|
|
74
|
-
mkdirSync(contents, { recursive: true });
|
|
75
73
|
await awsMutate(ctx, ["s3", "cp", `s3://${release.bucket}/${key}`, tarball]);
|
|
76
|
-
await
|
|
74
|
+
return await extractSkillsTarball(tarball, dir, { dryRun: ctx.dryRun });
|
|
75
|
+
}
|
|
76
|
+
async function extractSkillsTarball(tarball, dir, opts = {}) {
|
|
77
|
+
const contents = join(dir, "skills");
|
|
78
|
+
await run(["tar", "-xzf", tarball, "-C", dir], { dryRun: opts.dryRun });
|
|
79
|
+
if (opts.dryRun !== true && !existsSync(contents))
|
|
80
|
+
throw new Error(`${tarball} has no top-level skills/ directory`);
|
|
81
|
+
if (opts.dryRun === true)
|
|
82
|
+
mkdirSync(contents, { recursive: true });
|
|
77
83
|
return contents;
|
|
78
84
|
}
|
|
79
85
|
|
package/package.json
CHANGED
|
@@ -83,11 +83,32 @@ export async function unpackReleaseSkills(
|
|
|
83
83
|
const key = release.manifest?.skills.key ?? skillsKey(release.version);
|
|
84
84
|
const dir = mkdtempSync(join(tmpdir(), "foundation-skills-"));
|
|
85
85
|
const tarball = join(dir, "skills.tar.gz");
|
|
86
|
-
const contents = join(dir, "skills");
|
|
87
|
-
mkdirSync(contents, { recursive: true });
|
|
88
86
|
// `awsMutate` rather than a plain read, only so a dry run prints the copy
|
|
89
87
|
// instead of performing it.
|
|
90
88
|
await awsMutate(ctx, ["s3", "cp", `s3://${release.bucket}/${key}`, tarball]);
|
|
91
|
-
await
|
|
89
|
+
return await extractSkillsTarball(tarball, dir, { dryRun: ctx.dryRun });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Unpack a release's `skills.tar.gz` and return the directory holding the
|
|
94
|
+
* skills themselves.
|
|
95
|
+
*
|
|
96
|
+
* `release-build` runs `tar -czf skills.tar.gz skills`, so the archive's top
|
|
97
|
+
* level is a `skills/` directory. It is extracted INTO `dir`, landing at
|
|
98
|
+
* `dir/skills`. v0.1.0 and v0.1.1 extracted into `dir/skills` instead, which
|
|
99
|
+
* produced `dir/skills/skills/…` and synced every product skill to
|
|
100
|
+
* `s3://…/skills/skills/`, one level below where the agent looks — so a release
|
|
101
|
+
* deploy silently shipped no product skills at all.
|
|
102
|
+
*/
|
|
103
|
+
export async function extractSkillsTarball(
|
|
104
|
+
tarball: string,
|
|
105
|
+
dir: string,
|
|
106
|
+
opts: { dryRun?: boolean } = {},
|
|
107
|
+
): Promise<string> {
|
|
108
|
+
const contents = join(dir, "skills");
|
|
109
|
+
await run(["tar", "-xzf", tarball, "-C", dir], { dryRun: opts.dryRun });
|
|
110
|
+
if (opts.dryRun !== true && !existsSync(contents))
|
|
111
|
+
throw new Error(`${tarball} has no top-level skills/ directory`);
|
|
112
|
+
if (opts.dryRun === true) mkdirSync(contents, { recursive: true });
|
|
92
113
|
return contents;
|
|
93
114
|
}
|