Skip to content

Commit c34866b

Browse files
authored
Update AzureContainerAppsV0 with latest changes (#17776)
* Update AzureContainerAppsV0 with latest changes * Update package-lock.json using node 10.x and npm 6.x * Resolve review feedback * Add missing reference to 'os'
1 parent fab6e7a commit c34866b

20 files changed

+633
-901
lines changed

Tasks/AzureContainerAppsV0/README.md

Lines changed: 188 additions & 88 deletions
Large diffs are not rendered by default.

Tasks/AzureContainerAppsV0/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"loc.input.label.acrName": "Azure Container Registry name",
1414
"loc.input.help.acrName": "The name of the Azure Container Registry that the runnable application image will be pushed to.",
1515
"loc.input.label.acrUsername": "Azure Container Registry username",
16-
"loc.input.help.acrUsername": "The username used to authenticate push requests to the provided Azure Contrainer Registry. If not provided, an access token will be generated via 'az acr login' and provided to 'docker login' to authenticate the requests.",
16+
"loc.input.help.acrUsername": "The username used to authenticate push requests to the provided Azure Container Registry. If not provided, an access token will be generated via 'az acr login' and provided to 'docker login' to authenticate the requests.",
1717
"loc.input.label.acrPassword": "Azure Container Registry password",
18-
"loc.input.help.acrPassword": "The password used to authenticate push requests to the provided Azure Contrainer Registry. If not provided, an access token will be generated via 'az acr login' and provided to 'docker login' to authenticate the requests.",
18+
"loc.input.help.acrPassword": "The password used to authenticate push requests to the provided Azure Container Registry. If not provided, an access token will be generated via 'az acr login' and provided to 'docker login' to authenticate the requests.",
1919
"loc.input.label.dockerfilePath": "Dockerfile path",
2020
"loc.input.help.dockerfilePath": "Relative path to the Dockerfile in the provided application source that should be used to build the image that is then pushed to ACR and deployed to the Container App. If not provided, this task will check if there is a file named 'Dockerfile' at the root of the provided application source and use that to build the image. Otherwise, the Oryx++ Builder will be used to create the image.",
2121
"loc.input.label.imageToBuild": "Docker image to build",
@@ -32,6 +32,12 @@
3232
"loc.input.help.runtimeStack": "The platform version stack that the application runs in when deployed to the Azure Container App. This should be provided in the form of <platform>:<version>. If not provided, this value is determined by Oryx based on the contents of the provided application. Please view the following document for more information on the supported runtime stacks for Oryx: https://github.com/microsoft/Oryx/blob/main/doc/supportedRuntimeVersions.md",
3333
"loc.input.label.targetPort": "Application target port",
3434
"loc.input.help.targetPort": "The designated port for the application to run on. If not provided, this value is 80 for Python applications, and 8080 for all other supposed platforms.",
35+
"loc.input.label.location": "Location of the Container App",
36+
"loc.input.help.location": "The location that the Container App (and other created resources) will be deployed to.",
37+
"loc.input.label.environmentVariables": "Environment variables",
38+
"loc.input.help.environmentVariables": "A list of environment variable(s) for the container. Space-separated values in 'key=value' format. Empty string to clear existing values. Prefix value with 'secretref:' to reference a secret.",
39+
"loc.input.label.disableTelemetry": "Disable telemetry",
40+
"loc.input.help.disableTelemetry": "If set to 'true', no telemetry will be collected by this Azure DevOps Task. If set to 'false', or if this argument is not provided, telemetry will be sent to Microsoft about the Container App build and deploy scenario targeted by this Azure DevOps Task.",
3541
"loc.messages.AcrAccessTokenAuthFailed": "Unable to authenticate against ACR instance '%s.azurecr.io' with access token.",
3642
"loc.messages.AcrAccessTokenLoginMessage": "Logging in to Azure Container Registry using access token to be generated via Azure CLI.",
3743
"loc.messages.AcrUsernamePasswordAuthFailed": "Unable to authenticate against ACR instance '%s.azurecr.io' with username/password.",
@@ -54,7 +60,8 @@
5460
"loc.messages.ErrorCodeFormat": "Error Code: [%s]",
5561
"loc.messages.ErrorMessageFormat": "Error: %s",
5662
"loc.messages.FoundAppSourceDockerfileMessage": "Found existing Dockerfile in provided application source at path '%s'; image will be built from this Dockerfile.",
57-
"loc.messages.InvalidArgumentsMessage": "Either appSourcePath or imageToDeploy must be provided, but not both.",
63+
"loc.messages.MissingAcrNameMessage": "The acrName argument must also be provided if the appSourcePath argument is provided.",
64+
"loc.messages.MissingImageToDeployMessage": "The argument imageToDeploy must be provided if neither appSourcePath nor acrName are provided.",
5865
"loc.messages.PackCliInstallFailed": "Unable to install pack CLI.",
5966
"loc.messages.PushImageToAcrFailed": "Unable to push image '%s' to ACR.",
6067
"loc.messages.SetDefaultBuilderFailed": "Unable to set the Oryx++ Builder as the default builder."

Tasks/AzureContainerAppsV0/Tests/L0.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ describe('AzureContainerAppsV0 Suite', function () {
2727

2828
runValidations(() => {
2929
assert(tr.failed, 'AzureContainerAppsV0 task should have failed when neither appSourcePath or imageToDeploy arguments are provided.');
30-
assert(tr.stdout.includes('InvalidArgumentsMessage'), 'AzureContainerAppsV0 task should have failed when neither appSourcePath or imageToDeploy arguments are provided.');
30+
assert(tr.stdout.includes('MissingImageToDeployMessage'), 'AzureContainerAppsV0 task should have failed when neither appSourcePath or imageToDeploy arguments are provided.');
3131
}, tr, done);
3232
});
3333

34-
it('Fails for both appSourcePath and imageToDeploy arguments', (done: Done) => {
34+
it('Fails for appSourcePath provided without acrName', (done: Done) => {
3535
this.timeout(5000);
3636

37-
const tp: string = path.join(__dirname, 'L0FailsForBothAppSourcePathAndImageToDeploy.js');
37+
const tp: string = path.join(__dirname, 'L0FailsForAppSourcePathWithoutAcrName.js');
3838
const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
3939

4040
tr.run();
4141

4242
runValidations(() => {
43-
assert(tr.failed, 'AzureContainerAppsV0 task should have failed when both appSourcePath and imageToDeploy arguments are provided.');
44-
assert(tr.stdout.includes('InvalidArgumentsMessage'), 'AzureContainerAppsV0 task should have failed when both appSourcePath and imageToDeploy arguments are provided.');
43+
assert(tr.failed, 'AzureContainerAppsV0 task should have failed when appSourcePath is provided without acrName.');
44+
assert(tr.stdout.includes('MissingAcrNameMessage'), 'AzureContainerAppsV0 task should have failed when appSourcePath is provided without acrName.');
4545
}, tr, done);
4646
});
4747

@@ -59,20 +59,6 @@ describe('AzureContainerAppsV0 Suite', function () {
5959
}, tr, done);
6060
});
6161

62-
it('Fails for no ACR name argument', (done: Done) => {
63-
this.timeout(5000);
64-
65-
const tp: string = path.join(__dirname, 'L0FailsForNoAcrNameArgument.js');
66-
const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
67-
68-
tr.run();
69-
70-
runValidations(() => {
71-
assert(tr.failed, 'AzureContainerAppsV0 task should have failed when no ACR name argument is provided.');
72-
assert(tr.stdout.includes('Input required: acrName'), 'AzureContainerAppsV0 task should have failed when no ACR name argument is provided.');
73-
}, tr, done);
74-
});
75-
7662
it('Succeeds for appSourcePath with bare minimum arguments', (done: Done) => {
7763
this.timeout(5000);
7864

@@ -105,11 +91,9 @@ describe('AzureContainerAppsV0 Suite', function () {
10591

10692
runValidations(() => {
10793
assert(tr.succeeded, 'AzureContainerAppsV0 task should have succeeded when the minimum required arguments are provided.');
108-
assert(tr.stdout.includes('AcrAccessTokenLoginMessage'), 'AzureContainerAppsV0 task should use ACR access token for minimum imageToDeploy run.');
10994
assert(tr.stdout.includes('DefaultImageToBuildMessage'), 'AzureContainerAppsV0 task should set the default build image for minimum imageToDeploy run.');
11095
assert(tr.stdout.includes('DefaultContainerAppNameMessage'), 'AzureContainerAppsV0 task should set the default Container App name for minimum imageToDeploy run.');
11196
assert(tr.stdout.includes('DefaultResourceGroupMessage'), 'AzureContainerAppsV0 task should set the default resource group for minimum imageToDeploy run.');
112-
assert(tr.stdout.includes('DefaultTargetPortMessage'), 'AzureContainerAppsV0 task should set the default target port for minimum imageToDeploy run.');
11397
}, tr, done);
11498
});
11599

Tasks/AzureContainerAppsV0/Tests/L0FailsForBothAppSourcePathAndImageToDeploy.ts renamed to Tasks/AzureContainerAppsV0/Tests/L0FailsForAppSourcePathWithoutAcrName.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
77
// Set required arguments for the test
88
tmr.setInput('cwd', '/fakecwd');
99
tmr.setInput('appSourcePath', '/samplepath');
10-
tmr.setInput('imageToDeploy', 'imagetodeploy');
10+
tmr.setInput('disableTelemetry', 'true');
1111

1212
const tl = require('azure-pipelines-task-lib/mock-task');
1313
const tlClone = Object.assign({}, tl);

Tasks/AzureContainerAppsV0/Tests/L0FailsForNeitherAppSourcePathOrImageToDeploy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
66

77
// Set required arguments for the test
88
tmr.setInput('cwd', '/fakecwd');
9+
tmr.setInput('disableTelemetry', 'true');
910

1011
const tl = require('azure-pipelines-task-lib/mock-task');
1112
const tlClone = Object.assign({}, tl);

Tasks/AzureContainerAppsV0/Tests/L0FailsForNoAcrNameArgument.ts

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

Tasks/AzureContainerAppsV0/Tests/L0FailsForNoServiceConnectionArgument.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
77

88
// Set required arguments for the test
99
tmr.setInput('cwd', '/fakecwd');
10-
tmr.setInput('appSourcePath', '/samplepath');
10+
tmr.setInput('imageToDeploy', 'imageToDeploy');
11+
tmr.setInput('disableTelemetry', 'true');
1112

1213
const tl = require('azure-pipelines-task-lib/mock-task');
1314
const tlClone = Object.assign({}, tl);
@@ -32,6 +33,9 @@ tmr.registerMock('./src/Utility', {
3233
return {
3334
setAzureCliDynamicInstall: function() {
3435
return;
36+
},
37+
isNullOrEmpty(str: string): boolean {
38+
return str === null || str === undefined || str === "";
3539
}
3640
};
3741
}

Tasks/AzureContainerAppsV0/Tests/L0SucceedsForAcrCredentials.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ tmr.setInput('acrName', 'sampletestacr');
1212
tmr.setInput('acrUsername', 'acrtestusername');
1313
tmr.setInput('acrPassword', 'acrtestpassword');
1414
tmr.setInput('appSourcePath', '/samplepath');
15+
tmr.setInput('disableTelemetry', 'true');
1516

1617
const tl = require('azure-pipelines-task-lib/mock-task');
1718
const tlClone = Object.assign({}, tl);
@@ -36,6 +37,9 @@ tmr.registerMock('./src/Utility', {
3637
return {
3738
setAzureCliDynamicInstall: function() {
3839
return;
40+
},
41+
isNullOrEmpty(str: string): boolean {
42+
return str === null || str === undefined || str === "";
3943
}
4044
};
4145
}

Tasks/AzureContainerAppsV0/Tests/L0SucceedsForMinimumAppSourcePathArguments.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ tmr.setInput('cwd', '/fakecwd');
1010
tmr.setInput('connectedServiceNameARM', 'test-connectedServiceNameARM');
1111
tmr.setInput('acrName', 'sampletestacr');
1212
tmr.setInput('appSourcePath', '/samplepath');
13+
tmr.setInput('disableTelemetry', 'true');
1314

1415
const tl = require('azure-pipelines-task-lib/mock-task');
1516
const tlClone = Object.assign({}, tl);
@@ -34,6 +35,9 @@ tmr.registerMock('./src/Utility', {
3435
return {
3536
setAzureCliDynamicInstall: function() {
3637
return;
38+
},
39+
isNullOrEmpty(str: string): boolean {
40+
return str === null || str === undefined || str === "";
3741
}
3842
};
3943
}

Tasks/AzureContainerAppsV0/Tests/L0SucceedsForMinimumImageToDeployArguments.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
88
// Set required arguments for the test
99
tmr.setInput('cwd', '/fakecwd');
1010
tmr.setInput('connectedServiceNameARM', 'test-connectedServiceNameARM');
11-
tmr.setInput('acrName', 'sampletestacr');
1211
tmr.setInput('imageToDeploy', 'imagetodeploy');
12+
tmr.setInput('disableTelemetry', 'true');
1313

1414
const tl = require('azure-pipelines-task-lib/mock-task');
1515
const tlClone = Object.assign({}, tl);
@@ -34,6 +34,9 @@ tmr.registerMock('./src/Utility', {
3434
return {
3535
setAzureCliDynamicInstall: function() {
3636
return;
37+
},
38+
isNullOrEmpty(str: string): boolean {
39+
return str === null || str === undefined || str === "";
3740
}
3841
};
3942
}

0 commit comments

Comments
 (0)