Skip to content

Commit

Permalink
feat: Deprecate and noop cleanArtifacts (#525)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Stracke <[email protected]>
  • Loading branch information
lforst and Lms24 committed Apr 18, 2024
1 parent 5bd855d commit 295fa19
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 23 deletions.
10 changes: 4 additions & 6 deletions packages/bundler-plugin-core/src/index.ts
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
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
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
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
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
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
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
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
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

0 comments on commit 295fa19

Please sign in to comment.