Skip to content

feat: Deprecate and noop cleanArtifacts #525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 18, 2024
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
10 changes: 4 additions & 6 deletions packages/bundler-plugin-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ interface SentryUnpluginFactoryOptions {
* release creation pipeline:
*
* 1. Create a new release
* 2. Delete already uploaded artifacts for this release (if `cleanArtifacts` is enabled)
* 3. Upload sourcemaps based on `include` and source-map-specific options
* 4. Associate a range of commits with the release (if `setCommits` is specified)
* 5. Finalize the release (unless `finalize` is disabled)
* 6. Add deploy information to the release (if `deploy` is specified)
* 2. Upload sourcemaps based on `include` and source-map-specific options
* 3. Associate a range of commits with the release (if `setCommits` is specified)
* 4. Finalize the release (unless `finalize` is disabled)
* 5. Add deploy information to the release (if `deploy` is specified)
*
* This release creation pipeline relies on Sentry CLI to execute the different steps.
*/
Expand Down Expand Up @@ -261,7 +260,6 @@ export function sentryUnpluginFactory({
logger,
releaseName: options.release.name,
shouldCreateRelease: options.release.create,
shouldCleanArtifacts: options.release.cleanArtifacts,
shouldFinalizeRelease: options.release.finalize,
include: options.release.uploadLegacySourcemaps,
setCommitsOption: options.release.setCommits,
Expand Down
1 change: 0 additions & 1 deletion packages/bundler-plugin-core/src/options-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export function normalizeUserOptions(userOptions: UserOptions) {
create: userOptions.release?.create ?? true,
finalize: userOptions.release?.finalize ?? true,
vcsRemote: userOptions.release?.vcsRemote ?? process.env["SENTRY_VSC_REMOTE"] ?? "origin",
cleanArtifacts: userOptions.release?.cleanArtifacts ?? false,
},
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
reactComponentAnnotation: userOptions.reactComponentAnnotation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ interface ReleaseManagementPluginOptions {
logger: Logger;
releaseName: string;
shouldCreateRelease: boolean;
shouldCleanArtifacts: boolean;
shouldFinalizeRelease: boolean;
include?: string | IncludeEntry | Array<string | IncludeEntry>;
setCommitsOption?: SentryCliCommitsOptions;
Expand All @@ -36,7 +35,6 @@ export function releaseManagementPlugin({
dist,
setCommitsOption,
shouldCreateRelease,
shouldCleanArtifacts,
shouldFinalizeRelease,
deployOptions,
handleRecoverableError,
Expand All @@ -54,13 +52,6 @@ export function releaseManagementPlugin({
await cliInstance.releases.new(releaseName);
}

if (shouldCleanArtifacts) {
await cliInstance.releases.execute(
["releases", "files", releaseName, "delete", "--all"],
true
);
}

if (include) {
const normalizedInclude = arrayify(include)
.map((includeItem) =>
Expand Down
1 change: 0 additions & 1 deletion packages/bundler-plugin-core/src/sentry/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export function setTelemetryDataOnHub(options: NormalizedOptions, hub: Hub, bund
hub.setTag("inject-build-information", !!options._experiments.injectBuildInformation);

// Optional release pipeline steps
hub.setTag("clean-artifacts", release.cleanArtifacts);
if (release.setCommits) {
hub.setTag("set-commits", release.setCommits.auto === true ? "auto" : "manual");
} else {
Expand Down
5 changes: 5 additions & 0 deletions packages/bundler-plugin-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ export interface Options {
* Remove all previously uploaded artifacts for this release on Sentry before the upload.
*
* Defaults to `false`.
*
* @deprecated `cleanArtifacts` is deprecated and currently doesn't do anything. Historically it was needed
* since uploading the same artifacts twice was not allowed. Nowadays, when uploading artifacts with the same name
* more than once to the same release on Sentry, Sentry will prefer the most recent artifact for source mapping.
*/
// TODO(v3): Remove this option
cleanArtifacts?: boolean;

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/bundler-plugin-core/test/option-mappings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe("normalizeUserOptions()", () => {
name: "my-release",
finalize: true,
inject: true,
cleanArtifacts: false,
create: true,
vcsRemote: "origin",
uploadLegacySourcemaps: "./out",
Expand Down Expand Up @@ -62,7 +61,6 @@ describe("normalizeUserOptions()", () => {
finalize: true,
create: true,
inject: true,
cleanArtifacts: false,
uploadLegacySourcemaps: {
ext: ["js", "map", ".foo"],
ignore: ["./files"],
Expand Down
2 changes: 0 additions & 2 deletions packages/bundler-plugin-core/test/sentry/telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@ describe("addPluginOptionTagsToHub", () => {
normalizeUserOptions({
...defaultOptions,
release: {
cleanArtifacts: true,
finalize: true,
},
}),
mockedHub as unknown as Hub,
"rollup"
);

expect(mockedHub.setTag).toHaveBeenCalledWith("clean-artifacts", true);
expect(mockedHub.setTag).toHaveBeenCalledWith("finalize-release", true);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/dev-utils/src/generate-documentation-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ errorHandler: (err) => {
name: "cleanArtifacts",
type: "boolean",
fullDescription:
"Remove all previously uploaded artifacts for this release on Sentry before the upload.\n\nDefaults to `false`.",
"Remove all previously uploaded artifacts for this release on Sentry before the upload.\n\nDefaults to `false`.\n\n**Deprecation Notice:** `cleanArtifacts` is deprecated and will does currently not do anything. Historically it was needed since uploading the same artifacts twice was not allowed. Nowadays, when uploading artifacts with the same name more than once to the same release on Sentry, Sentry will prefer the most recent artifact for source mapping.",
},
{
name: "uploadLegacySourcemaps",
Expand Down
1 change: 0 additions & 1 deletion packages/playground/vite.config.smallNodeApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default defineConfig({
debug: true,
release: "0.0.14",
include: "out/vite-smallNodeApp",
cleanArtifacts: true,
// ignore: ["out/*", "!out/vite-smallNodeApp/index.js.map"],
ignore: ["!out/vite-smallNodeApp/index.js.map"],
ignoreFile: ".sentryignore",
Expand Down
Loading