Skip to content

Commit c4a30e0

Browse files
yuwzhoEzzhevNikita
andauthored
Update Spring cloud api version (#15495)
* update Spring Cloud api version to 2020-07-01 * update-version * Update version * Update task.json Co-authored-by: Nikita Ezzhev <[email protected]>
1 parent 81b6f32 commit c4a30e0

File tree

6 files changed

+30
-13
lines changed

6 files changed

+30
-13
lines changed

Tasks/AzureSpringCloudV0/Tests/DeploymentToStagingSucceedsL0.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class DeploymentFailsWithInsufficientDeploymentL0 {
135135
"user-agent": "TFS_useragent"
136136
}
137137
})
138-
.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`)
138+
.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`)
139139
.once()
140140
.reply(200,
141141
{

Tasks/AzureSpringCloudV0/Tests/SetProductionNamedDeploymentSucceedsL0.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class SetProductionNamedDeploymentSucceedsL0 {
119119
"content-type": "application/json; charset=utf-8",
120120
"user-agent": "TFS_useragent"
121121
}
122-
}).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`)
122+
}).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`)
123123
.once()
124124
.reply((uri, serializedRequestBody)=>{
125125
let requestBody = JSON.parse(serializedRequestBody);

Tasks/AzureSpringCloudV0/Tests/SetProductionUseStagingSucceedsL0.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class SetProductionUseStagingSucceedsL0 {
119119
"content-type": "application/json; charset=utf-8",
120120
"user-agent": "TFS_useragent"
121121
}
122-
}).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`)
122+
}).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`)
123123
.once()
124124
.reply((uri, serializedRequestBody)=>{
125125
let requestBody = JSON.parse(serializedRequestBody);

Tasks/AzureSpringCloudV0/deploymentProvider/azure-arm-spring-cloud.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class AzureSpringCloud {
9898
const requestUri = this._client.getRequestUri(`${this._resourceId}/apps/{appName}`, {
9999
'{appName}': appName,
100100
'{deploymentName}': deploymentName
101-
}, null, '2019-05-01-preview');
101+
}, null, '2020-07-01');
102102
const requestBody = JSON.stringify(
103103
{
104104
properties: {
@@ -112,10 +112,27 @@ export class AzureSpringCloud {
112112
console.log('Response:');
113113
console.log(response.body);
114114

115-
if (response.statusCode != 200) {
116-
console.error('Error code: ' + response.statusCode);
117-
console.error(response.statusMessage);
115+
let expectedStatusCodes: number[] = [200, 202];
116+
if (!expectedStatusCodes.includes(response.statusCode)) {
117+
tl.error('Error code: ' + response.statusCode);
118+
tl.error(response.statusMessage);
118119
throw Error(response.statusCode + ":" + response.statusMessage);
120+
} else {
121+
tl.debug('App update initiated.')
122+
//If the operation is asynchronous, block pending its conclusion.
123+
var operationStatusUrl = response.headers[ASYNC_OPERATION_HEADER];
124+
if (operationStatusUrl) {
125+
tl.debug('Awaiting operation completion.');
126+
try {
127+
await this.awaitOperationCompletion(operationStatusUrl);
128+
} catch (error) {
129+
tl.debug('Error in awaiting operation completion');
130+
throw error;
131+
}
132+
} else {
133+
tl.debug('Received async status code with no async operation. Headers: ');
134+
tl.debug(JSON.stringify(response.headers));
135+
}
119136
}
120137
}
121138

@@ -170,7 +187,7 @@ export class AzureSpringCloud {
170187

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

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

Tasks/AzureSpringCloudV0/task.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"preview": true,
1313
"version": {
1414
"Major": 0,
15-
"Minor": 185,
16-
"Patch": 6
15+
"Minor": 198,
16+
"Patch": 0
1717
},
1818
"minimumAgentVersion": "2.104.1",
1919
"groups": [

Tasks/AzureSpringCloudV0/task.loc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"preview": true,
1919
"version": {
2020
"Major": 0,
21-
"Minor": 185,
22-
"Patch": 5
21+
"Minor": 198,
22+
"Patch": 0
2323
},
2424
"minimumAgentVersion": "2.104.1",
2525
"groups": [
@@ -235,4 +235,4 @@
235235
"Nopackagefoundwithspecifiedpattern": "ms-resource:loc.messages.Nopackagefoundwithspecifiedpattern",
236236
"MorethanonepackagematchedwithspecifiedpatternPleaserestrainthesearchpattern": "ms-resource:loc.messages.MorethanonepackagematchedwithspecifiedpatternPleaserestrainthesearchpattern"
237237
}
238-
}
238+
}

0 commit comments

Comments
 (0)