From 856267126f4dae181dd03e57d93db79158e902f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sch=C3=BCtz?= Date: Thu, 13 Jan 2022 14:26:36 +0100 Subject: [PATCH] Support for private IPs, dns-name-label no longer required --- action.yml | 6 +++++- src/main.ts | 5 ++++- src/taskparameters.ts | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index d0197a33..96fdc8c1 100644 --- a/action.yml +++ b/action.yml @@ -34,7 +34,7 @@ inputs: default: 1 dns-name-label: description: 'The DNS Name Label for Container with Public IP' - required: true + required: false environment-variables: description: 'List of environment variables for the container. Space-seperated in "key=value" format' required: false @@ -119,6 +119,10 @@ inputs: secure-environment-variables: description: 'List of secure environment variables for the container. Space seperated values in "key=value" format' default: '' + network-profile-id: + description: 'ID or name of the network profile' + required: false + default: '' outputs: app-url: description: 'URL of the Deployed Application' diff --git a/src/main.ts b/src/main.ts index d75485d1..a6209246 100644 --- a/src/main.ts +++ b/src/main.ts @@ -54,7 +54,10 @@ async function main() { "osType": taskParams.osType, "restartPolicy": taskParams.restartPolicy, "type": "Microsoft.ContainerInstance/containerGroups", - "name": taskParams.containerName + "name": taskParams.containerName, + "networkProfile": taskParams.networkProfileId ? { + "id": taskParams.networkProfileId + } : undefined, } let containerDeploymentResult = await client.containerGroups.createOrUpdate(taskParams.resourceGroup, taskParams.containerName, containerGroupInstance); if(containerDeploymentResult.provisioningState == "Succeeded") { diff --git a/src/taskparameters.ts b/src/taskparameters.ts index 6568aef7..2fddc999 100644 --- a/src/taskparameters.ts +++ b/src/taskparameters.ts @@ -30,6 +30,7 @@ export class TaskParameters { private _restartPolicy: ContainerInstanceManagementModels.ContainerGroupRestartPolicy; private _volumes: Array; private _volumeMounts: Array; + private _networkProfileId: string; private _subscriptionId: string; @@ -45,7 +46,7 @@ export class TaskParameters { }); } this._cpu = parseFloat(core.getInput('cpu')); - this._dnsNameLabel = core.getInput('dns-name-label', { required: true }); + this._dnsNameLabel = core.getInput('dns-name-label'); this._diagnostics = {} let logType = core.getInput('log-type'); let logAnalyticsWorkspace = core.getInput('log-analytics-workspace'); @@ -116,6 +117,7 @@ export class TaskParameters { let afsAccountName = core.getInput('azure-file-volume-account-name'); let afsShareName = core.getInput('azure-file-volume-share-name'); this._getVolumes(gitRepoVolumeUrl, afsShareName, afsAccountName); + this._networkProfileId = core.getInput('network-profile-id'); } private _getDiagnostics(logAnalyticsWorkspace: string, logAnalyticsWorkspaceKey: string, logType: string) { @@ -323,4 +325,8 @@ export class TaskParameters { return this._subscriptionId; } + public get networkProfileId() { + return this._networkProfileId; + } + }