Skip to content
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

Update Spring cloud api version #15495

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class DeploymentFailsWithInsufficientDeploymentL0 {
"user-agent": "TFS_useragent"
}
})
.post(`/subscriptions/${MOCK_SUBSCRIPTION_ID}/resourceGroups/${MOCK_RESOURCE_GROUP_NAME}/providers/${ASC_RESOURCE_TYPE}/${this.TEST_NAME}/apps/${this.MOCK_APP_NAME}/getResourceUploadUrl?api-version=2019-05-01-preview`)
.post(`/subscriptions/${MOCK_SUBSCRIPTION_ID}/resourceGroups/${MOCK_RESOURCE_GROUP_NAME}/providers/${ASC_RESOURCE_TYPE}/${this.TEST_NAME}/apps/${this.MOCK_APP_NAME}/getResourceUploadUrl?api-version=2020-07-01`)
.once()
.reply(200,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class SetProductionNamedDeploymentSucceedsL0 {
"content-type": "application/json; charset=utf-8",
"user-agent": "TFS_useragent"
}
}).patch(`/subscriptions/${MOCK_SUBSCRIPTION_ID}/resourceGroups/${encodeURIComponent(MOCK_RESOURCE_GROUP_NAME)}/providers/${ASC_RESOURCE_TYPE}/${this.TEST_NAME}/apps/${this.MOCK_APP_NAME}?api-version=2019-05-01-preview`)
}).patch(`/subscriptions/${MOCK_SUBSCRIPTION_ID}/resourceGroups/${encodeURIComponent(MOCK_RESOURCE_GROUP_NAME)}/providers/${ASC_RESOURCE_TYPE}/${this.TEST_NAME}/apps/${this.MOCK_APP_NAME}?api-version=2020-07-01`)
.once()
.reply((uri, serializedRequestBody)=>{
let requestBody = JSON.parse(serializedRequestBody);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class SetProductionUseStagingSucceedsL0 {
"content-type": "application/json; charset=utf-8",
"user-agent": "TFS_useragent"
}
}).patch(`/subscriptions/${MOCK_SUBSCRIPTION_ID}/resourceGroups/${encodeURIComponent(MOCK_RESOURCE_GROUP_NAME)}/providers/${ASC_RESOURCE_TYPE}/${this.TEST_NAME}/apps/${this.MOCK_APP_NAME}?api-version=2019-05-01-preview`)
}).patch(`/subscriptions/${MOCK_SUBSCRIPTION_ID}/resourceGroups/${encodeURIComponent(MOCK_RESOURCE_GROUP_NAME)}/providers/${ASC_RESOURCE_TYPE}/${this.TEST_NAME}/apps/${this.MOCK_APP_NAME}?api-version=2020-07-01`)
.once()
.reply((uri, serializedRequestBody)=>{
let requestBody = JSON.parse(serializedRequestBody);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class AzureSpringCloud {
const requestUri = this._client.getRequestUri(`${this._resourceId}/apps/{appName}`, {
'{appName}': appName,
'{deploymentName}': deploymentName
}, null, '2019-05-01-preview');
}, null, '2020-07-01');
const requestBody = JSON.stringify(
{
properties: {
Expand All @@ -112,10 +112,27 @@ export class AzureSpringCloud {
console.log('Response:');
console.log(response.body);

if (response.statusCode != 200) {
console.error('Error code: ' + response.statusCode);
console.error(response.statusMessage);
let expectedStatusCodes: number[] = [200, 202];
if (!expectedStatusCodes.includes(response.statusCode)) {
tl.error('Error code: ' + response.statusCode);
tl.error(response.statusMessage);
throw Error(response.statusCode + ":" + response.statusMessage);
} else {
tl.debug('App update initiated.')
//If the operation is asynchronous, block pending its conclusion.
var operationStatusUrl = response.headers[ASYNC_OPERATION_HEADER];
if (operationStatusUrl) {
tl.debug('Awaiting operation completion.');
try {
await this.awaitOperationCompletion(operationStatusUrl);
} catch (error) {
tl.debug('Error in awaiting operation completion');
throw error;
}
} else {
tl.debug('Received async status code with no async operation. Headers: ');
tl.debug(JSON.stringify(response.headers));
}
}
}

Expand Down Expand Up @@ -170,7 +187,7 @@ export class AzureSpringCloud {

const requestUri = this._client.getRequestUri(`${this._resourceId}/apps/{appName}/getResourceUploadUrl`, {
'{appName}': appName
}, null, '2019-05-01-preview');
}, null, '2020-07-01');

const response = await this.sendRequest('POST', requestUri, null);

Expand Down
4 changes: 2 additions & 2 deletions Tasks/AzureSpringCloudV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"preview": true,
"version": {
"Major": 0,
"Minor": 185,
"Patch": 6
"Minor": 196,
"Patch": 0
},
"minimumAgentVersion": "2.104.1",
"groups": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/AzureSpringCloudV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"preview": true,
"version": {
"Major": 0,
"Minor": 185,
"Patch": 5
"Minor": 196,
yuwzho marked this conversation as resolved.
Show resolved Hide resolved
"Patch": 0
},
"minimumAgentVersion": "2.104.1",
"groups": [
Expand Down