Skip to content

Commit 5b851df

Browse files
committed
fixes or something
1 parent 5eac851 commit 5b851df

20 files changed

Lines changed: 1218 additions & 59 deletions

.dagger/bun.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.dagger/src/better-skill-capped.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ type DeployBetterSkillCappedOptions = {
8181

8282
export async function deployBetterSkillCapped(
8383
options: DeployBetterSkillCappedOptions,
84-
): Promise<string> {
84+
): Promise<{ message: string; versionedRef: string }> {
8585
const {
8686
source,
8787
version,
@@ -124,13 +124,13 @@ export async function deployBetterSkillCapped(
124124
);
125125

126126
const fetcherImage = "ghcr.io/shepherdjerred/better-skill-capped-fetcher";
127-
await publishToGhcrMultiple({
127+
const refs = await publishToGhcrMultiple({
128128
container: fetcherContainer,
129129
imageRefs: [`${fetcherImage}:${version}`, `${fetcherImage}:latest`],
130130
username: ghcrUsername,
131131
password: ghcrPassword,
132132
});
133133
outputs.push("✓ Fetcher published to GHCR");
134134

135-
return outputs.join("\n");
135+
return { message: outputs.join("\n"), versionedRef: refs[0] ?? "" };
136136
}

.dagger/src/birmel.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,11 @@ type BirmelPublishOptions = {
287287
export async function publishBirmel(options: BirmelPublishOptions): Promise<string> {
288288
const { source, version, gitSha, registryUsername, registryPassword } = options;
289289
const image = buildBirmelImage(source, version, gitSha);
290-
const refs = await publishBirmelImageWithContainer({
290+
const result = await publishBirmelImageWithContainer({
291291
image, version, gitSha,
292292
registryAuth: { username: registryUsername, password: registryPassword },
293293
});
294-
return `Published:\n${refs.join("\n")}`;
294+
return `Published:\n${result.refs.join("\n")}`;
295295
}
296296

297297
/** Run birmel CI, smoke test, and publish. */
@@ -301,17 +301,17 @@ export async function releaseBirmel(options: BirmelPublishOptions): Promise<stri
301301
outputs.push(await checkBirmel(source));
302302
const birmelImage = buildBirmelImage(source, version, gitSha);
303303
outputs.push(await smokeTestBirmelImageWithContainer(birmelImage));
304-
const refs = await publishBirmelImageWithContainer({
304+
const publishResult = await publishBirmelImageWithContainer({
305305
image: birmelImage, version, gitSha,
306306
registryAuth: { username: registryUsername, password: registryPassword },
307307
});
308-
outputs.push(`Published:\n${refs.join("\n")}`);
308+
outputs.push(`Published:\n${publishResult.refs.join("\n")}`);
309309
return outputs.join("\n\n");
310310
}
311311

312312
export async function publishBirmelImageWithContainer(
313313
options: PublishBirmelImageWithContainerOptions,
314-
): Promise<string[]> {
314+
): Promise<{ refs: string[]; versionedRef: string }> {
315315
let image = options.image;
316316

317317
// Set up registry authentication if credentials provided
@@ -331,5 +331,5 @@ export async function publishBirmelImageWithContainer(
331331
);
332332
const latestRef = await image.publish("ghcr.io/shepherdjerred/birmel:latest");
333333

334-
return [versionRef, shaRef, latestRef];
334+
return { refs: [versionRef, shaRef, latestRef], versionedRef: versionRef };
335335
}

.dagger/src/discord-plays-pokemon.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ type DeployDiscordPlaysPokemonOptions = {
390390

391391
export async function deployDiscordPlaysPokemon(
392392
options: DeployDiscordPlaysPokemonOptions,
393-
): Promise<string> {
393+
): Promise<{ message: string; versionedRef: string }> {
394394
const {
395395
source,
396396
version,
@@ -439,5 +439,5 @@ export async function deployDiscordPlaysPokemon(
439439
outputs.push(`Docs deployed to S3\n${syncOutput}`);
440440

441441
logWithTimestamp("Deploy completed for discord-plays-pokemon");
442-
return outputs.join("\n");
442+
return { message: outputs.join("\n"), versionedRef: refs[0] ?? "" };
443443
}

.dagger/src/homelab-caddy-s3proxy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ export async function buildAndPushCaddyS3ProxyImage(
6262
return {
6363
status: "passed",
6464
message: `Image published: ${result}`,
65+
publishRef: result,
6566
};
6667
}

.dagger/src/homelab-ci-steps.ts

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { HELM_CHARTS } from "./homelab-helm.ts";
2525
import { Stage } from "./lib-types.ts";
2626
import type { StepResult, HelmBuildResult, HomelabSecrets } from "./homelab-index.ts";
2727
import { homelabTestHelm, homelabTestRenovateRegex, homelabHelmBuild } from "./homelab-index.ts";
28+
import { formatVersionWithDigest } from "./lib-ghcr.ts";
2829
import { planAll } from "./homelab-tofu.ts";
2930
import versions from "./lib-versions.ts";
3031

@@ -216,6 +217,7 @@ type PublishResults = {
216217
caddyS3ProxyPublishResult: StepResult;
217218
helmPublishResult: StepResult;
218219
syncResult: StepResult;
220+
infraVersions: Record<string, string>;
219221
};
220222

221223
type HelmPublishOptions = {
@@ -302,6 +304,7 @@ export async function runPublishPhase(
302304
status: "skipped",
303305
message: "[SKIPPED] Not prod or chart publish failed",
304306
},
307+
infraVersions: {},
305308
};
306309
}
307310

@@ -319,7 +322,7 @@ export async function runPublishPhase(
319322
haResults,
320323
depSummaryResults,
321324
dnsAuditResults,
322-
caddyS3ProxyResult,
325+
caddyS3ProxyResults,
323326
helmResult,
324327
] = await Promise.all([
325328
Promise.all([
@@ -368,23 +371,20 @@ export async function runPublishPhase(
368371
false,
369372
),
370373
]),
371-
(async (): Promise<StepResult> => {
372-
const [versioned, latest] = await Promise.all([
373-
buildAndPushCaddyS3ProxyImage(
374-
`ghcr.io/shepherdjerred/caddy-s3proxy:${chartVersion}`,
375-
ghcrUsername,
376-
ghcrPassword,
377-
false,
378-
),
379-
buildAndPushCaddyS3ProxyImage(
380-
`ghcr.io/shepherdjerred/caddy-s3proxy:latest`,
381-
ghcrUsername,
382-
ghcrPassword,
383-
false,
384-
),
385-
]);
386-
return combinePublishResults([versioned, latest]);
387-
})(),
374+
Promise.all([
375+
buildAndPushCaddyS3ProxyImage(
376+
`ghcr.io/shepherdjerred/caddy-s3proxy:${chartVersion}`,
377+
ghcrUsername,
378+
ghcrPassword,
379+
false,
380+
),
381+
buildAndPushCaddyS3ProxyImage(
382+
`ghcr.io/shepherdjerred/caddy-s3proxy:latest`,
383+
ghcrUsername,
384+
ghcrPassword,
385+
false,
386+
),
387+
]),
388388
helmBuildResult.dist
389389
? homelabHelmPublishBuilt({
390390
builtDist: helmBuildResult.dist,
@@ -401,6 +401,20 @@ export async function runPublishPhase(
401401

402402
const helmPublishResult = helmResult;
403403

404+
// Extract digests from versioned-tag results (index [0] of each pair)
405+
const infraVersions: Record<string, string> = {};
406+
const infraMapping: [string, StepResult][] = [
407+
["shepherdjerred/homelab", haResults[0]],
408+
["shepherdjerred/dependency-summary", depSummaryResults[0]],
409+
["shepherdjerred/dns-audit", dnsAuditResults[0]],
410+
["shepherdjerred/caddy-s3proxy", caddyS3ProxyResults[0]],
411+
];
412+
for (const [key, result] of infraMapping) {
413+
if (result.status === "passed" && result.publishRef !== undefined) {
414+
infraVersions[key] = formatVersionWithDigest(chartVersion, result.publishRef);
415+
}
416+
}
417+
404418
let syncResult: StepResult = {
405419
status: "skipped",
406420
message: "[SKIPPED] Not prod or chart publish failed",
@@ -413,9 +427,10 @@ export async function runPublishPhase(
413427
haPublishResult: combinePublishResults(haResults),
414428
depSummaryPublishResult: combinePublishResults(depSummaryResults),
415429
dnsAuditPublishResult: combinePublishResults(dnsAuditResults),
416-
caddyS3ProxyPublishResult: caddyS3ProxyResult,
430+
caddyS3ProxyPublishResult: combinePublishResults(caddyS3ProxyResults),
417431
helmPublishResult,
418432
syncResult,
433+
infraVersions,
419434
};
420435
}
421436

.dagger/src/homelab-dependency-summary.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,6 @@ export async function buildAndPushDependencySummaryImage(
108108
return {
109109
status: "passed",
110110
message: `Dependency-summary image published: ${result}`,
111+
publishRef: result,
111112
};
112113
}

.dagger/src/homelab-dns-audit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ export async function buildAndPushDnsAuditImage(
4545
return {
4646
status: "passed",
4747
message: `Dns-audit image published: ${result}`,
48+
publishRef: result,
4849
};
4950
}

.dagger/src/homelab-ha.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,6 @@ export async function buildAndPushHaImage(
219219
return {
220220
status: "passed",
221221
message: `Image published: ${result}`,
222+
publishRef: result,
222223
};
223224
}

.dagger/src/homelab-index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export type StepStatus = "passed" | "failed" | "skipped";
2929
export type StepResult = {
3030
status: StepStatus;
3131
message: string;
32+
publishRef?: string;
3233
};
3334

3435
export type HelmBuildResult = StepResult & {
@@ -184,7 +185,7 @@ export async function ciHomelab(
184185
env: Stage,
185186
secrets: HomelabSecrets,
186187
versionOnly = false,
187-
): Promise<string> {
188+
): Promise<{ summary: string; infraVersions: Record<string, string> }> {
188189
const source = getHomelabSource(monoRepoSource);
189190

190191
// Update image versions in versions.ts if prod
@@ -210,7 +211,10 @@ export async function ciHomelab(
210211
);
211212

212213
// Check for failures and return summary
213-
return checkForFailures(env, validation, publish);
214+
return {
215+
summary: checkForFailures(env, validation, publish),
216+
infraVersions: publish.infraVersions,
217+
};
214218
}
215219

216220
/**

0 commit comments

Comments
 (0)