Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions packages/bundler-plugin-core/src/sentry/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,36 +80,3 @@ export async function deleteAllReleaseArtifacts({
throw e;
}
}

export async function updateRelease({
release,
org,
authToken,
sentryUrl,
project,
sentryHub,
customHeader,
}: {
release: string;
org: string;
authToken: string;
sentryUrl: string;
project: string;
sentryHub: Hub;
customHeader: Record<string, string>;
}): Promise<void> {
const requestUrl = `${sentryUrl}${API_PATH}/projects/${org}/${project}/releases/${release}/`;

const releasePayload = {
dateReleased: new Date().toISOString(),
};

try {
await sentryApiAxiosInstance({ authToken, customHeader }).put(requestUrl, releasePayload, {
headers: { Authorization: `Bearer ${authToken}` },
});
} catch (e) {
captureMinimalError(e, sentryHub);
throw e;
}
}
25 changes: 3 additions & 22 deletions packages/bundler-plugin-core/src/sentry/releasePipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { InternalOptions } from "../options-mapping";
import { BuildContext } from "../types";
import { createRelease, deleteAllReleaseArtifacts, updateRelease } from "./api";
import { createRelease, deleteAllReleaseArtifacts } from "./api";
import { addSpanToTransaction } from "./telemetry";

export async function createNewRelease(
Expand Down Expand Up @@ -75,34 +75,15 @@ export async function uploadSourceMaps(options: InternalOptions, ctx: BuildConte
span?.finish();
}

export async function finalizeRelease(
options: InternalOptions,
ctx: BuildContext
): Promise<string> {
export async function finalizeRelease(options: InternalOptions, ctx: BuildContext): Promise<void> {
const span = addSpanToTransaction(ctx, "function.plugin.finalize_release");

if (options.finalize) {
const { authToken, org, url, project } = options;
if (!authToken || !org || !url || !project) {
ctx.logger.warn("Missing required option. Will not clean existing artifacts.");
return Promise.resolve("nothing to do here");
}

await updateRelease({
authToken,
org,
release: options.release,
sentryUrl: url,
project,
sentryHub: ctx.hub,
customHeader: options.customHeader,
});

await ctx.cli.releases.finalize(options.release);
ctx.logger.info("Successfully finalized release.");
}

span?.finish();
return Promise.resolve("nothing to do here");
}

export async function cleanArtifacts(options: InternalOptions, ctx: BuildContext): Promise<string> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ createCjsBundles(
release: "I AM A RELEASE!",
include: outputDir,
entries: [/entrypoint1\.js/, entryPoint3Path],
dryRun: true,
} as Options
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ const outputDir = path.resolve(__dirname, "./out");
createCjsBundles({ index: entryPointPath }, outputDir, {
release: "I AM A RELEASE!",
include: outputDir,
dryRun: true,
} as Options);
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ createCjsBundles(
include: outputDir,
entries: (entrypointPath) =>
entrypointPath === entryPoint1Path || entrypointPath === entryPoint3Path,
dryRun: true,
} as Options
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ const outputDir = path.resolve(__dirname, "./out");
createCjsBundles({ entrypoint1: entryPoint1Path, entrypoint2: entryPoint2Path }, outputDir, {
release: "I AM A RELEASE!",
include: outputDir,
dryRun: true,
entries: /entrypoint1\.js/,
} as Options);
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ createCjsBundles({ entrypoint1: entryPoint1Path, entrypoint2: entryPoint2Path },
release: "I AM A RELEASE!",
include: outputDir,
entries: entryPoint1Path,
dryRun: true,
} as Options);