Skip to content

Commit 295fa19

Browse files
lforstLms24
andauthored
feat: Deprecate and noop cleanArtifacts (#525)
Co-authored-by: Lukas Stracke <[email protected]>
1 parent 5bd855d commit 295fa19

File tree

9 files changed

+10
-23
lines changed

9 files changed

+10
-23
lines changed

Diff for: packages/bundler-plugin-core/src/index.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ interface SentryUnpluginFactoryOptions {
5454
* release creation pipeline:
5555
*
5656
* 1. Create a new release
57-
* 2. Delete already uploaded artifacts for this release (if `cleanArtifacts` is enabled)
58-
* 3. Upload sourcemaps based on `include` and source-map-specific options
59-
* 4. Associate a range of commits with the release (if `setCommits` is specified)
60-
* 5. Finalize the release (unless `finalize` is disabled)
61-
* 6. Add deploy information to the release (if `deploy` is specified)
57+
* 2. Upload sourcemaps based on `include` and source-map-specific options
58+
* 3. Associate a range of commits with the release (if `setCommits` is specified)
59+
* 4. Finalize the release (unless `finalize` is disabled)
60+
* 5. Add deploy information to the release (if `deploy` is specified)
6261
*
6362
* This release creation pipeline relies on Sentry CLI to execute the different steps.
6463
*/
@@ -261,7 +260,6 @@ export function sentryUnpluginFactory({
261260
logger,
262261
releaseName: options.release.name,
263262
shouldCreateRelease: options.release.create,
264-
shouldCleanArtifacts: options.release.cleanArtifacts,
265263
shouldFinalizeRelease: options.release.finalize,
266264
include: options.release.uploadLegacySourcemaps,
267265
setCommitsOption: options.release.setCommits,

Diff for: packages/bundler-plugin-core/src/options-mapping.ts

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export function normalizeUserOptions(userOptions: UserOptions) {
2626
create: userOptions.release?.create ?? true,
2727
finalize: userOptions.release?.finalize ?? true,
2828
vcsRemote: userOptions.release?.vcsRemote ?? process.env["SENTRY_VSC_REMOTE"] ?? "origin",
29-
cleanArtifacts: userOptions.release?.cleanArtifacts ?? false,
3029
},
3130
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
3231
reactComponentAnnotation: userOptions.reactComponentAnnotation,

Diff for: packages/bundler-plugin-core/src/plugins/release-management.ts

-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ interface ReleaseManagementPluginOptions {
1010
logger: Logger;
1111
releaseName: string;
1212
shouldCreateRelease: boolean;
13-
shouldCleanArtifacts: boolean;
1413
shouldFinalizeRelease: boolean;
1514
include?: string | IncludeEntry | Array<string | IncludeEntry>;
1615
setCommitsOption?: SentryCliCommitsOptions;
@@ -36,7 +35,6 @@ export function releaseManagementPlugin({
3635
dist,
3736
setCommitsOption,
3837
shouldCreateRelease,
39-
shouldCleanArtifacts,
4038
shouldFinalizeRelease,
4139
deployOptions,
4240
handleRecoverableError,
@@ -54,13 +52,6 @@ export function releaseManagementPlugin({
5452
await cliInstance.releases.new(releaseName);
5553
}
5654

57-
if (shouldCleanArtifacts) {
58-
await cliInstance.releases.execute(
59-
["releases", "files", releaseName, "delete", "--all"],
60-
true
61-
);
62-
}
63-
6455
if (include) {
6556
const normalizedInclude = arrayify(include)
6657
.map((includeItem) =>

Diff for: packages/bundler-plugin-core/src/sentry/telemetry.ts

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export function setTelemetryDataOnHub(options: NormalizedOptions, hub: Hub, bund
7474
hub.setTag("inject-build-information", !!options._experiments.injectBuildInformation);
7575

7676
// Optional release pipeline steps
77-
hub.setTag("clean-artifacts", release.cleanArtifacts);
7877
if (release.setCommits) {
7978
hub.setTag("set-commits", release.setCommits.auto === true ? "auto" : "manual");
8079
} else {

Diff for: packages/bundler-plugin-core/src/types.ts

+5
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ export interface Options {
212212
* Remove all previously uploaded artifacts for this release on Sentry before the upload.
213213
*
214214
* Defaults to `false`.
215+
*
216+
* @deprecated `cleanArtifacts` is deprecated and currently doesn't do anything. Historically it was needed
217+
* since uploading the same artifacts twice was not allowed. Nowadays, when uploading artifacts with the same name
218+
* more than once to the same release on Sentry, Sentry will prefer the most recent artifact for source mapping.
215219
*/
220+
// TODO(v3): Remove this option
216221
cleanArtifacts?: boolean;
217222

218223
/**

Diff for: packages/bundler-plugin-core/test/option-mappings.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ describe("normalizeUserOptions()", () => {
2020
name: "my-release",
2121
finalize: true,
2222
inject: true,
23-
cleanArtifacts: false,
2423
create: true,
2524
vcsRemote: "origin",
2625
uploadLegacySourcemaps: "./out",
@@ -62,7 +61,6 @@ describe("normalizeUserOptions()", () => {
6261
finalize: true,
6362
create: true,
6463
inject: true,
65-
cleanArtifacts: false,
6664
uploadLegacySourcemaps: {
6765
ext: ["js", "map", ".foo"],
6866
ignore: ["./files"],

Diff for: packages/bundler-plugin-core/test/sentry/telemetry.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,13 @@ describe("addPluginOptionTagsToHub", () => {
104104
normalizeUserOptions({
105105
...defaultOptions,
106106
release: {
107-
cleanArtifacts: true,
108107
finalize: true,
109108
},
110109
}),
111110
mockedHub as unknown as Hub,
112111
"rollup"
113112
);
114113

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

Diff for: packages/dev-utils/src/generate-documentation-table.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ errorHandler: (err) => {
232232
name: "cleanArtifacts",
233233
type: "boolean",
234234
fullDescription:
235-
"Remove all previously uploaded artifacts for this release on Sentry before the upload.\n\nDefaults to `false`.",
235+
"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.",
236236
},
237237
{
238238
name: "uploadLegacySourcemaps",

Diff for: packages/playground/vite.config.smallNodeApp.js

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export default defineConfig({
2323
debug: true,
2424
release: "0.0.14",
2525
include: "out/vite-smallNodeApp",
26-
cleanArtifacts: true,
2726
// ignore: ["out/*", "!out/vite-smallNodeApp/index.js.map"],
2827
ignore: ["!out/vite-smallNodeApp/index.js.map"],
2928
ignoreFile: ".sentryignore",

0 commit comments

Comments
 (0)