|
8 | 8 |
|
9 | 9 | import { InternalOptions } from "../options-mapping"; |
10 | 10 | import { BuildContext } from "../types"; |
11 | | -import { createRelease, deleteAllReleaseArtifacts } from "./api"; |
| 11 | +import { createRelease } from "./api"; |
12 | 12 | import { addSpanToTransaction } from "./telemetry"; |
13 | 13 |
|
14 | 14 | export async function createNewRelease( |
@@ -86,40 +86,31 @@ export async function finalizeRelease(options: InternalOptions, ctx: BuildContex |
86 | 86 | span?.finish(); |
87 | 87 | } |
88 | 88 |
|
89 | | -export async function cleanArtifacts(options: InternalOptions, ctx: BuildContext): Promise<string> { |
| 89 | +export async function cleanArtifacts(options: InternalOptions, ctx: BuildContext): Promise<void> { |
90 | 90 | const span = addSpanToTransaction(ctx, "function.plugin.clean_artifacts"); |
91 | 91 |
|
92 | 92 | if (options.cleanArtifacts) { |
93 | 93 | // TODO: pull these checks out of here and simplify them |
94 | 94 | if (options.authToken === undefined) { |
95 | 95 | ctx.logger.warn('Missing "authToken" option. Will not clean existing artifacts.'); |
96 | | - return Promise.resolve("nothing to do here"); |
| 96 | + return; |
97 | 97 | } else if (options.org === undefined) { |
98 | 98 | ctx.logger.warn('Missing "org" option. Will not clean existing artifacts.'); |
99 | | - return Promise.resolve("nothing to do here"); |
| 99 | + return; |
100 | 100 | } else if (options.url === undefined) { |
101 | 101 | ctx.logger.warn('Missing "url" option. Will not clean existing artifacts.'); |
102 | | - return Promise.resolve("nothing to do here"); |
| 102 | + return; |
103 | 103 | } else if (options.project === undefined) { |
104 | 104 | ctx.logger.warn('Missing "project" option. Will not clean existing artifacts.'); |
105 | | - return Promise.resolve("nothing to do here"); |
| 105 | + return; |
106 | 106 | } |
107 | 107 |
|
108 | | - await deleteAllReleaseArtifacts({ |
109 | | - authToken: options.authToken, |
110 | | - org: options.org, |
111 | | - release: options.release, |
112 | | - sentryUrl: options.url, |
113 | | - project: options.project, |
114 | | - sentryHub: ctx.hub, |
115 | | - customHeader: options.customHeader, |
116 | | - }); |
| 108 | + await ctx.cli.releases.execute(["releases", "files", options.release, "delete", "--all"], true); |
117 | 109 |
|
118 | 110 | ctx.logger.info("Successfully cleaned previous artifacts."); |
119 | 111 | } |
120 | 112 |
|
121 | 113 | span?.finish(); |
122 | | - return Promise.resolve("nothing to do here"); |
123 | 114 | } |
124 | 115 |
|
125 | 116 | // TODO: Stuff we worry about later: |
|
0 commit comments