1import * as GCP from "@/GCP";
2import * as Effect from "effect/Effect";
3
4export const MARKER_OBJECT = "marker.txt";
5
6/**
7 * Effect-native Cloud Run Job whose `run` entry writes a Storage object.
8 * Deployed from {@link ../Job.test.ts}.
9 */
10export default class MarkerJob extends GCP.Run.Job<MarkerJob>()(
11 "MarkerJob",
12 {
13 main: import.meta.url,
14 location: "us-central1",
15 },
16 Effect.gen(function* () {
17 const bucket = yield* GCP.Storage.Bucket("JobRunMarker", {
18 forceDestroy: true,
19 });
20 const putObject = yield* GCP.Storage.PutObject(bucket);
21 return {
22 run: putObject({ name: MARKER_OBJECT, body: "ran" }).pipe(
23 Effect.asVoid,
24 Effect.orDie,
25 ),
26 };
27 }).pipe(Effect.provide(GCP.Storage.PutObjectHttp)),
28) {}