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

File Transforms - Tight substitute for system prefix variables #10894

Merged
merged 5 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"loc.friendlyName": "Azure Database for MySQL deployment",
"loc.helpMarkDown": "[More Information](https://aka.ms/mysqlazuredeployreadme)",
"loc.helpMarkDown": "[Learn more about this task](https://aka.ms/mysqlazuredeployreadme)",
"loc.description": "Run your scripts and make changes to your Azure Database for MySQL",
"loc.instanceNameFormat": "Execute Azure MySQL : $(TaskNameSelector)",
"loc.group.displayName.target": "DB Details",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/AzureMysqlDeploymentV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 0,
"Patch": 28
"Minor": 156,
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "1.100.0",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/AzureMysqlDeploymentV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 0,
"Patch": 28
"Minor": 156,
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "1.100.0",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureRmWebAppDeploymentV4/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 4,
"Minor": 155,
"Minor": 156,
"Patch": 0
},
"releaseNotes": "What's new in version 4.*<br />Supports Zip Deploy, Run From Package, War Deploy [Details here](https://aka.ms/appServiceDeploymentMethods)<br />Supports App Service Environments<br />Improved UI for discovering different App service types supported by the task<br/>Run From Package is the preferred deployment method, which makes files in wwwroot folder read-only<br/>Click [here](https://aka.ms/azurermwebdeployreadme) for more information.",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureRmWebAppDeploymentV4/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 4,
"Minor": 155,
"Minor": 156,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down
10 changes: 8 additions & 2 deletions Tasks/Common/webdeployment-common-v2/Tests/L1JsonVarSub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var envVarObject = jsonSubUtil.createEnvTree([
{ name: 'user.profile.name.first', value: 'firstName', secret: false},
{ name: 'user.profile', value: 'replace_all', secret: false},
{ name: 'constructor.name', value: 'newConstructorName', secret: false},
{ name: 'constructor.valueOf', value: 'constructorNewValue', secret: false}
{ name: 'constructor.valueOf', value: 'constructorNewValue', secret: false},
{ name: 'systemsettings.appurl', value: 'https://dev.azure.com/helloworld', secret: false}
]);

var jsonObject = {
Expand All @@ -34,6 +35,9 @@ var jsonObject = {
'constructor': {
'name': 'myconstructorname',
'valueOf': 'myconstructorvalue'
},
'systemsettings': {
'appurl': 'https://helloworld.visualstudio.com'
}
}
// Method to be checked for JSON variable substitution
Expand All @@ -42,7 +46,9 @@ jsonSubUtil.substituteJsonVariable(jsonObject, envVarObject);
if(typeof jsonObject['user.profile'] === 'object') {
console.log('JSON - eliminating object variables validated');
}
if(jsonObject['data']['ConnectionString'] === 'database_connection' && jsonObject['data']['userName'] === 'db_admin') {
if(jsonObject['data']['ConnectionString'] === 'database_connection'
&& jsonObject['data']['userName'] === 'db_admin'
&& jsonObject['systemsettings']['appurl'] == 'https://dev.azure.com/helloworld') {
console.log('JSON - simple string change validated');
}
if(jsonObject['system']['debug'] === 'no_change') {
Expand Down
10 changes: 8 additions & 2 deletions Tasks/Common/webdeployment-common-v2/Tests/L1JsonVarSubV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var envVarObject = jsonSubUtil.createEnvTree([
{ name: 'profile.enabled', value: 'false', secret: false},
{ name: 'profile.version', value: '1173', secret: false},
{ name: 'profile.somefloat', value: '97.75', secret: false},
{ name: 'profile.preimum_level', value: '{"suaggar": "V4", "rok": "V5", "asranja": { "type" : "V6"}}', secret: false}
{ name: 'profile.preimum_level', value: '{"suaggar": "V4", "rok": "V5", "asranja": { "type" : "V6"}}', secret: false},
{ name: 'systemsettings.appurl', value: 'https://dev.azure.com/helloworld', secret: false}
]);

var jsonObject = {
Expand Down Expand Up @@ -52,13 +53,18 @@ var jsonObject = {
"enabled": true,
"version": 2,
"somefloat": 2.3456
},
'systemsettings': {
'appurl': 'https://helloworld.visualstudio.com'
}

}
// Method to be checked for JSON variable substitution
jsonSubUtil.substituteJsonVariableV2(jsonObject, envVarObject);

if(jsonObject['data']['ConnectionString'] === 'database_connection' && jsonObject['data']['userName'] === 'db_admin') {
if(jsonObject['data']['ConnectionString'] === 'database_connection'
&& jsonObject['data']['userName'] === 'db_admin'
&& jsonObject['systemsettings']['appurl'] == 'https://dev.azure.com/helloworld') {
console.log('JSON - simple string change validated');
}
if(jsonObject['system']['debug'] === 'no_change') {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Common/webdeployment-common-v2/variableutility.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import tl = require('azure-pipelines-task-lib');

export function isPredefinedVariable(variable: string): boolean {
var predefinedVarPrefix = ['agent.', 'azure_http_user_agent', 'build.', 'common.', 'release.', 'system', 'tf_'];
var predefinedVarPrefix = ['agent.', 'azure_http_user_agent', 'build.', 'common.', 'release.', 'system.', 'tf_'];
for(let varPrefix of predefinedVarPrefix) {
if(variable.toLowerCase().startsWith(varPrefix)) {
return true;
Expand Down
4 changes: 2 additions & 2 deletions Tasks/FileTransformV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
],
"version": {
"Major": 1,
"Minor": 153,
"Patch": 1
"Minor": 156,
"Patch": 0
},
"instanceNameFormat": "File Transform: $(Package)",
"groups": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/FileTransformV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
],
"version": {
"Major": 1,
"Minor": 153,
"Patch": 1
"Minor": 156,
"Patch": 0
},
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
"groups": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"loc.friendlyName": "IIS web app deploy",
"loc.helpMarkDown": "[More information](https://go.microsoft.com/fwlink/?linkid=866789)",
"loc.helpMarkDown": "[Learn more about this task](https://go.microsoft.com/fwlink/?linkid=866789)",
"loc.description": "Deploy a website or web application using Web Deploy",
"loc.instanceNameFormat": "Deploy IIS Website/App: $(WebDeployPackage)",
"loc.group.displayName.FileTransformsAndVariableSubstitution": "File Transforms & Variable Substitution Options",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/IISWebAppDeploymentOnMachineGroupV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 0,
"Patch": 58
"Minor": 156,
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "2.104.1",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/IISWebAppDeploymentOnMachineGroupV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 0,
"Patch": 58
"Minor": 156,
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "2.104.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"loc.friendlyName": "MySQL database deploy",
"loc.helpMarkDown": "[More Information](https://aka.ms/mysql-deployment-on-machine-group)",
"loc.helpMarkDown": "[Learn more about this task](https://aka.ms/mysql-deployment-on-machine-group)",
"loc.description": "Run scripts and make changes to a MySQL Database",
"loc.instanceNameFormat": "Deploy Using : $(TaskNameSelector)",
"loc.input.label.TaskNameSelector": "Deploy MySql Using",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/MysqlDeploymentOnMachineGroupV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 1,
"Patch": 2
"Minor": 156,
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "1.100.0",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/MysqlDeploymentOnMachineGroupV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 1,
"Patch": 2
"Minor": 156,
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "1.100.0",
Expand Down