Skip to content

Commit 27a985a

Browse files
velimir-jankovicDjordje Marjanovic
andauthored
AppCenterDistributeV3: Removed abort request as it doesn't exist anymore in new upload flow. (#15418)
* Removed abort request as it doesn't exist anymore in new upload flow. * Bumped minor version. * Fixed minor version to match current sprint. * Fixing unit tests. * Removed outdated test. Co-authored-by: Djordje Marjanovic <[email protected]>
1 parent 93113ec commit 27a985a

File tree

7 files changed

+8
-230
lines changed

7 files changed

+8
-230
lines changed

Tasks/AppCenterDistributeV3/Tests/L0.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,6 @@ describe('AppCenterDistribute L0 Suite', function () {
252252
assert(tr.succeeded, 'task should have succeeded');
253253
});
254254

255-
it('Negative path: failed when HTTP status is not 2xx', function () {
256-
this.timeout(defaultTimeout);
257-
258-
let tp = path.join(__dirname, 'L0FailsHttpStatusNot2xx.js');
259-
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
260-
261-
tr.run();
262-
assert(tr.succeeded, 'task should have succeeded');
263-
});
264-
265255
it('Positive path: publish silent update', function () {
266256
this.timeout(defaultTimeout);
267257

Tasks/AppCenterDistributeV3/Tests/L0EmptyBuildVersionDoesntAppearInBody.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ nock('https://example.test')
2323
.post('/v0.1/apps/testuser/testapp/uploads/releases', body => body.build_version)
2424
.reply(404, {
2525
upload_id: 1,
26-
upload_url: 'https://example.upload.test/release_upload'
26+
upload_url: 'https://example.upload.test/uploads/releases'
2727
});
2828

2929
//begin symbol upload

Tasks/AppCenterDistributeV3/Tests/L0FailsHttpStatusNot2xx.ts

Lines changed: 0 additions & 176 deletions
This file was deleted.

Tasks/AppCenterDistributeV3/Tests/UnitTests/TestHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const assertByExitCode = {
1919

2020
export function basicSetup() {
2121

22-
const uploadDomain = 'https://example.upload.test/release_upload';
22+
const uploadDomain = 'https://example.upload.test/uploads/releases';
2323
const assetId = "00000000-0000-0000-0000-000000000123";
2424
const uploadId = 7;
2525

Tasks/AppCenterDistributeV3/appcenterdistribute.ts

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -212,33 +212,6 @@ function uploadRelease(releaseUploadParams: UploadInfo, file: string): Promise<a
212212
});
213213
}
214214

215-
function abortReleaseUpload(apiServer: string, apiVersion: string, appSlug: string, upload_id: string, token: string, userAgent: string): Q.Promise<void> {
216-
tl.debug("-- Aborting release...");
217-
let defer = Q.defer<void>();
218-
let patchReleaseUrl: string = `${apiServer}/${apiVersion}/apps/${appSlug}/release_uploads/${upload_id}`;
219-
tl.debug(`---- url: ${patchReleaseUrl}`);
220-
let headers = {
221-
"X-API-Token": token,
222-
"User-Agent": userAgent,
223-
"internal-request-source": "VSTS"
224-
};
225-
226-
let abortedBody = { "status": "aborted" };
227-
228-
request.patch({ url: patchReleaseUrl, headers: headers, json: abortedBody }, (err, res, body) => {
229-
responseHandler(defer, err, res, body, () => {
230-
231-
const { message } = body;
232-
if (err) {
233-
defer.reject(`Failed to abort release upload: ${message}`);
234-
}
235-
defer.resolve();
236-
});
237-
})
238-
239-
return defer.promise;
240-
}
241-
242215
function patchRelease(apiServer: string, apiVersion: string, appSlug: string, upload_id: string, token: string, userAgent: string): Q.Promise<void> {
243216
tl.debug("-- Finishing uploading release...");
244217
let defer = Q.defer<void>();
@@ -659,20 +632,11 @@ async function run() {
659632
let uploadInfo: UploadInfo = await beginReleaseUpload(effectiveApiServer, effectiveApiVersion, appSlug, apiToken, userAgent, buildVersion);
660633
const uploadId = uploadInfo.id;
661634
let releaseId: string;
662-
try {
663635

664-
// Perform the upload
665-
await uploadRelease(uploadInfo, app);
666-
await patchRelease(effectiveApiServer, effectiveApiVersion, appSlug, uploadId, apiToken, userAgent);
667-
releaseId = await loadReleaseIdUntilSuccess(effectiveApiServer, effectiveApiVersion, appSlug, uploadId, apiToken, userAgent);
668-
} catch (error) {
669-
try {
670-
return abortReleaseUpload(effectiveApiServer, effectiveApiVersion, appSlug, uploadId, apiToken, userAgent);
671-
} catch (abortError) {
672-
tl.debug("---- Failed to abort release upload");
673-
}
674-
throw error;
675-
}
636+
await uploadRelease(uploadInfo, app);
637+
await patchRelease(effectiveApiServer, effectiveApiVersion, appSlug, uploadId, apiToken, userAgent);
638+
releaseId = await loadReleaseIdUntilSuccess(effectiveApiServer, effectiveApiVersion, appSlug, uploadId, apiToken, userAgent);
639+
676640
await updateRelease(effectiveApiServer, effectiveApiVersion, appSlug, releaseId, releaseNotes, apiToken, userAgent);
677641

678642
await Q.all(destinationIds.map(destinationId => {

Tasks/AppCenterDistributeV3/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 3,
16-
"Minor": 186,
16+
"Minor": 195,
1717
"Patch": 0
1818
},
1919
"releaseNotes": "Added support for forwarding Android mapping to App Center Diagnostics. Added missing descriptions.",

Tasks/AppCenterDistributeV3/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 3,
16-
"Minor": 186,
16+
"Minor": 195,
1717
"Patch": 0
1818
},
1919
"releaseNotes": "ms-resource:loc.releaseNotes",

0 commit comments

Comments
 (0)