Skip to content

Commit

Permalink
Merge pull request #4248 from Microsoft/users/jikuma/dockertaskchange…
Browse files Browse the repository at this point in the history
…sM116

docker compose linux issue fixed and default values changed
  • Loading branch information
jikuma authored May 8, 2017
2 parents 58f39ae + 5260124 commit 129c4b1
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"loc.friendlyName": "Docker",
"loc.helpMarkDown": "[More Information](http://aka.ms/dockertoolsforvsts)",
"loc.description": "Build, push or run Docker images, or run a Docker command",
"loc.helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=848006)",
"loc.description": "Build, push or run Docker images, or run a Docker command. Task can be used with Docker or Azure Container registry.",
"loc.instanceNameFormat": "$(action)",
"loc.group.displayName.advanced": "Advanced Options",
"loc.input.label.containerregistrytype": "Container Registry Type",
Expand Down
1 change: 1 addition & 0 deletions Tasks/Docker/containerbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function run(connection: ContainerConnection): any {
});

var imageName = tl.getInput("imageName", true);
imageName = imageUtils.changeDefaultImageNameToLowerCase(imageName);
var qualifyImageName = tl.getBoolInput("qualifyImageName");
if (qualifyImageName) {
imageName = connection.qualifyImageName(imageName);
Expand Down
18 changes: 18 additions & 0 deletions Tasks/Docker/containerimageutils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use strict";
import * as tl from "vsts-task-lib/task";

export function hasRegistryComponent(imageName: string): boolean {
var periodIndex = imageName.indexOf("."),
Expand All @@ -18,3 +19,20 @@ export function imageNameWithoutTag(imageName: string): string {
endIndex = imageName.indexOf(":", endIndex);
return endIndex < 0 ? imageName : imageName.substr(0, endIndex);
}

export function changeDefaultImageNameToLowerCase(imageName: string): string {

if(imageName === getDefaultImage())
{
return imageName.toLowerCase();
}

return imageName;
}

function getDefaultImage() : string {
var repositoryName = tl.getVariable('build.repository.name');
var buildId = tl.getVariable('build.buildId');

return repositoryName + ":" + buildId;
}
8 changes: 4 additions & 4 deletions Tasks/Docker/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "E28912F1-0114-4464-802A-A3A35437FD16",
"name": "Docker",
"friendlyName": "Docker",
"description": "Build, push or run Docker images, or run a Docker command",
"description": "Build, push or run Docker images, or run a Docker command. Task can be used with Docker or Azure Container registry.",
"helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=848006)",
"category": "Build",
"visibility": [
Expand All @@ -13,7 +13,7 @@
"version": {
"Major": 0,
"Minor": 2,
"Patch": 3
"Patch": 4
},
"demands": [],
"preview": "true",
Expand Down Expand Up @@ -97,7 +97,7 @@
"name": "defaultContext",
"type": "boolean",
"label": "Use Default Build Context",
"defaultValue": "false",
"defaultValue": "true",
"visibleRule": "action = Build an image",
"helpMarkDown": "Set the build context to the directory that contains the Docker file."
},
Expand All @@ -121,7 +121,7 @@
"name": "qualifyImageName",
"type": "boolean",
"label": "Qualify Image Name",
"defaultValue": "false",
"defaultValue": "true",
"visibleRule": "action = Build an image || action = Push an image || action = Run an image",
"helpMarkDown": "Qualify the image name with the Docker registry connection's hostname if not otherwise specified."
},
Expand Down
6 changes: 3 additions & 3 deletions Tasks/Docker/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 0,
"Minor": 2,
"Patch": 3
"Patch": 4
},
"demands": [],
"preview": "true",
Expand Down Expand Up @@ -97,7 +97,7 @@
"name": "defaultContext",
"type": "boolean",
"label": "ms-resource:loc.input.label.defaultContext",
"defaultValue": "false",
"defaultValue": "true",
"visibleRule": "action = Build an image",
"helpMarkDown": "ms-resource:loc.input.help.defaultContext"
},
Expand All @@ -121,7 +121,7 @@
"name": "qualifyImageName",
"type": "boolean",
"label": "ms-resource:loc.input.label.qualifyImageName",
"defaultValue": "false",
"defaultValue": "true",
"visibleRule": "action = Build an image || action = Push an image || action = Run an image",
"helpMarkDown": "ms-resource:loc.input.help.qualifyImageName"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"loc.friendlyName": "Docker Compose",
"loc.helpMarkDown": "[More Information](http://aka.ms/dockertoolsforvsts)",
"loc.description": "Build, push or run multi-container Docker applications",
"loc.helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=848006)",
"loc.description": "Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.",
"loc.instanceNameFormat": "$(action)",
"loc.group.displayName.advanced": "Advanced Options",
"loc.input.label.containerregistrytype": "Container Registry Type",
Expand Down
16 changes: 8 additions & 8 deletions Tasks/DockerCompose/dockercompose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ if (nopIfNoDockerComposeFile && !tl.exist(dockerFile)) {
var action = tl.getInput("action", true);
/* tslint:disable:no-var-requires */
return require({
"Build services": "./dockerComposeBuild",
"Push services": "./dockerComposePush",
"Run services": "./dockerComposeUp",
"Run a specific service": "./dockerComposeRun",
"Lock services": "./dockerComposeLock",
"Write service image digests": "./dockerComposeDigests",
"Combine configuration": "./dockerComposeConfig",
"Run a Docker Compose command": "./dockerComposeCommand"
"Build services": "./dockercomposebuild",
"Push services": "./dockercomposepush",
"Run services": "./dockercomposeup",
"Run a specific service": "./dockercomposerun",
"Lock services": "./dockercomposelock",
"Write service image digests": "./dockercomposedigests",
"Combine configuration": "./dockercomposeconfig",
"Run a Docker Compose command": "./dockercomposecommand"
}[action]).run(connection);
/* tslint:enable:no-var-requires */
})
Expand Down
8 changes: 4 additions & 4 deletions Tasks/DockerCompose/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "6975E2D1-96D3-4AFC-8A41-498B5D34EA19",
"name": "DockerCompose",
"friendlyName": "Docker Compose",
"description": "Build, push or run multi-container Docker applications",
"description": "Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.",
"helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=848006)",
"category": "Build",
"visibility": [
Expand All @@ -12,8 +12,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 3,
"Patch": 7
"Minor": 4,
"Patch": 0
},
"demands": [],
"preview": "true",
Expand Down Expand Up @@ -98,7 +98,7 @@
"name": "qualifyImageNames",
"type": "boolean",
"label": "Qualify Image Names",
"defaultValue": "false",
"defaultValue": "true",
"helpMarkDown": "Qualify image names for built services with the Docker registry connection's hostname if not otherwise specified."
},
{
Expand Down
6 changes: 3 additions & 3 deletions Tasks/DockerCompose/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 3,
"Patch": 7
"Minor": 4,
"Patch": 0
},
"demands": [],
"preview": "true",
Expand Down Expand Up @@ -98,7 +98,7 @@
"name": "qualifyImageNames",
"type": "boolean",
"label": "ms-resource:loc.input.label.qualifyImageNames",
"defaultValue": "false",
"defaultValue": "true",
"helpMarkDown": "ms-resource:loc.input.help.qualifyImageNames"
},
{
Expand Down

0 comments on commit 129c4b1

Please sign in to comment.