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

Exclude DockerComposeV0 compatibility attributes when custom path is specified #19907

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
645 changes: 319 additions & 326 deletions Tasks/DockerComposeV0/Tests/L0.ts

Large diffs are not rendered by default.

56 changes: 47 additions & 9 deletions Tasks/DockerComposeV0/Tests/L0Linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,26 @@ let a: any = <any>{
"code": 0,
"stdout": "sucessfully built the service images"
},
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml build" :{
"code": 0,
"stdout": "sucessfully built the service images"
},
"docker-compose-userdefined -f /tmp/tempdir/100/docker-compose.yml build" :{
"code": 0,
"stdout": "sucessfully built the service images"
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml config" :{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
},
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml config" :{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
},
"docker-compose-userdefined -f /tmp/tempdir/100/docker-compose.yml config" :{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
},
"docker push 100_web": {
"code": 0,
"stdout": "sucessfully pushed 100_web"
Expand All @@ -64,39 +80,61 @@ let a: any = <any>{
"code": 0,
"stdout": "sucessfully ran services"
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/.docker-compose.12345.yml config":{
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml up": {
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n image: ajgtestacr1.azurecr.io/100_web\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
"stdout": "sucessfully ran services"
},
"docker push ajgtestacr1.azurecr.io/100_web":{
"code": 0,
"stdout": "successfully pushed with qualified image"
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/docker-compose.override.yml config":{
"docker-compose -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/docker-compose.override.yml up -d":{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n image: ajgtestacr1.azurecr.io/100_web\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
"stdout": "successfully ran up command"
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/docker-compose.override.yml up -d":{
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/docker-compose.override.yml up -d":{
"code": 0,
"stdout": "successfully ran up command"
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml up -d":{
"code": 0,
"stdout": "successfully ran up command"
},
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml up -d":{
"code": 0,
"stdout": "successfully ran up command"
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml build --pull --parallel" :{
"code": 0,
"stdout": "sucessfully built the service images"
},
"docker-compose-userdefined -f /tmp/tempdir/100/docker-compose.yml build" :{
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml build --pull --parallel" :{
"code": 0,
"stdout": "sucessfully built the service images"
}, "docker-compose-userdefined -f /tmp/tempdir/100/docker-compose.yml config" :{
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml pull service1 service2" :{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
}, "docker-compose -f /tmp/tempdir/100/docker-compose.yml pull service1 service2" :{
"stdout": "successfully pulled the passed service images"
},
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml pull service1 service2" :{
"code": 0,
"stdout": "successfully pulled the passed service images"
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/.docker-compose.12345.yml config":{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n image: ajgtestacr1.azurecr.io/100_web\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
},
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/.docker-compose.12345.yml config":{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n image: ajgtestacr1.azurecr.io/100_web\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
},
"docker-compose -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/docker-compose.override.yml config":{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n image: ajgtestacr1.azurecr.io/100_web\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
},
"docker compose --compatibility -f /tmp/tempdir/100/docker-compose.yml -f /tmp/tempdir/100/docker-compose.override.yml config":{
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: /tmp/tempdir/100\n image: ajgtestacr1.azurecr.io/100_web\n ports:\n - 5000:5000/tcp\n volumes:\n - /tmp/tempdir/100:/code:rw\nversion: '2.0'"
}
},
"exist": {
Expand Down
66 changes: 49 additions & 17 deletions Tasks/DockerComposeV0/Tests/L0Windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ process.env["SYSTEM_DEFAULTWORKINGDIRECTORY"] = DefaultWorkingDirectory;
process.env["SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"] = "https://abc.visualstudio.com/";
process.env["SYSTEM_SERVERTYPE"] = "hosted";
process.env['AGENT_TEMPDIRECTORY'] = '.';
process.env["ENDPOINT_AUTH_dockerhubendpoint"] = "{\"parameters\":{\"username\":\"test\", \"password\":\"regpassword\", \"email\":\"test@microsoft.com\",\"registry\":\"https://index.docker.io/v1/\"},\"scheme\":\"UsernamePassword\"}";
process.env["ENDPOINT_AUTH_dockerhubendpoint"] = "{\"parameters\": {\"username\":\"test\", \"password\":\"regpassword\", \"email\":\"test@microsoft.com\",\"registry\":\"https://index.docker.io/v1/\"},\"scheme\":\"UsernamePassword\"}";
process.env["ENDPOINT_AUTH_SCHEME_AzureRMSpn"] = "ServicePrincipal";
process.env["ENDPOINT_AUTH_PARAMETER_AzureRMSpn_SERVICEPRINCIPALID"] = "spId";
process.env["ENDPOINT_AUTH_PARAMETER_AzureRMSpn_SERVICEPRINCIPALKEY"] = "spKey";
Expand All @@ -48,11 +48,27 @@ let a: any = <any>{
"docker-compose": true
},
"exec": {
"docker-compose -f F:\\dir2\\docker-compose.yml build" :{
"docker-compose -f F:\\dir2\\docker-compose.yml build" : {
"code": 0,
"stdout": "sucessfully built the service images"
},
"docker-compose -f F:\\dir2\\docker-compose.yml config" :{
"docker compose --compatibility -f F:\\dir2\\docker-compose.yml build" : {
"code": 0,
"stdout": "sucessfully built the service images"
},
"docker-compose-userdefined -f F:\\dir2\\docker-compose.yml build" : {
"code": 0,
"stdout": "sucessfully built the service images"
},
"docker-compose -f F:\\dir2\\docker-compose.yml config" : {
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: C:\\docketest\n ports:\n - 5000:5000/tcp\n volumes:\n - C:\\docketest:/code:rw\nversion: '2.0'"
},
"docker compose --compatibility -f F:\\dir2\\docker-compose.yml config" : {
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: C:\\docketest\n ports:\n - 5000:5000/tcp\n volumes:\n - C:\\docketest:/code:rw\nversion: '2.0'"
},
"docker-compose-userdefined -f F:\\dir2\\docker-compose.yml config" : {
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: C:\\docketest\n ports:\n - 5000:5000/tcp\n volumes:\n - C:\\docketest:/code:rw\nversion: '2.0'"
},
Expand All @@ -64,39 +80,55 @@ let a: any = <any>{
"code": 0,
"stdout": "sucessfully ran services"
},
"docker-compose -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\.docker-compose.12345.yml config":{
"docker-compose -f F:\\dir2\\docker-compose.yml build --pull --parallel" : {
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: F:\\dir2\n image: ajgtestacr1.azurecr.io/dir2_web\n ports:\n - 5000:5000/tcp\n volumes:\n - F:\\dir2:/code:rw\nversion: '2.0'"
"stdout": "sucessfully built the service images"
},
"docker push ajgtestacr1.azurecr.io/dir2_web":{
"docker compose --compatibility -f F:\\dir2\\docker-compose.yml build --pull --parallel" : {
"code": 0,
"stdout": "successfully pushed with qualified image"
"stdout": "sucessfully built the service images"
},
"docker-compose -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\.docker-compose.12345.yml config": {
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: F:\\dir2\n image: ajgtestacr1.azurecr.io/dir2_web\n ports:\n - 5000:5000/tcp\n volumes:\n - F:\\dir2:/code:rw\nversion: '2.0'"
},
"docker-compose -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\docker-compose.override.yml config":{
"docker compose --compatibility -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\.docker-compose.12345.yml config": {
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: F:\\dir2\n image: ajgtestacr1.azurecr.io/dir2_web\n ports:\n - 5000:5000/tcp\n volumes:\n - F:\\dir2:/code:rw\nversion: '2.0'"
},
"docker-compose -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\docker-compose.override.yml up -d":{
"docker push ajgtestacr1.azurecr.io/dir2_web": {
"code": 0,
"stdout": "successfully pushed with qualified image"
},
"docker-compose -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\docker-compose.override.yml up -d": {
"code": 0,
"stdout": "successfully ran up command"
},
"docker-compose -f F:\\dir2\\docker-compose.yml up -d":{
"docker compose --compatibility -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\docker-compose.override.yml up -d": {
"code": 0,
"stdout": "successfully ran up command"
},
"docker-compose -f F:\\dir2\\docker-compose.yml build --pull --parallel" :{
"docker-compose -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\docker-compose.override.yml config": {
"code": 0,
"stdout": "sucessfully built the service images"
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: F:\\dir2\n image: ajgtestacr1.azurecr.io/dir2_web\n ports:\n - 5000:5000/tcp\n volumes:\n - F:\\dir2:/code:rw\nversion: '2.0'"
},
"docker-compose-userdefined -f F:\\dir2\\docker-compose.yml config" :{
"docker compose --compatibility -f F:\\dir2\\docker-compose.yml -f F:\\dir2\\docker-compose.override.yml config": {
"code": 0,
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: C:\\docketest\n ports:\n - 5000:5000/tcp\n volumes:\n - C:\\docketest:/code:rw\nversion: '2.0'"
"stdout": "services:\n redis:\n image: redis:alpine\n web:\n build:\n context: F:\\dir2\n image: ajgtestacr1.azurecr.io/dir2_web\n ports:\n - 5000:5000/tcp\n volumes:\n - F:\\dir2:/code:rw\nversion: '2.0'"
},
"docker-compose-userdefined -f F:\\dir2\\docker-compose.yml build" :{
"docker-compose -f F:\\dir2\\docker-compose.yml up -d": {
"code": 0,
"stdout": "sucessfully built the service images"
"stdout": "successfully ran up command"
},
"docker compose --compatibility -f F:\\dir2\\docker-compose.yml up -d": {
"code": 0,
"stdout": "successfully ran up command"
},
"docker-compose -f F:\\dir2\\docker-compose.yml pull service1 service2" : {
"code": 0,
"stdout": "successfully pulled the passed service images"
},
"docker-compose -f F:\\dir2\\docker-compose.yml pull service1 service2" :{
"docker compose --compatibility -f F:\\dir2\\docker-compose.yml pull service1 service2" : {
"code": 0,
"stdout": "successfully pulled the passed service images"
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DockerComposeV0/dockercomposeconnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class DockerComposeConnection extends ContainerConnection {
public createComposeCommand(): tr.ToolRunner {
var command = tl.tool(this.dockerComposePath);

if (this.useDockerComposeV2) {
if (this.useDockerComposeV2 && !tl.getInput('dockerComposePath')) {
command.arg("compose");
command.arg("--compatibility");
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DockerComposeV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 240,
"Patch": 0
"Patch": 2
},
"demands": [],
"preview": "false",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DockerComposeV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 240,
"Patch": 0
"Patch": 2
},
"demands": [],
"preview": "false",
Expand Down
4 changes: 2 additions & 2 deletions _generated/DockerComposeV0.versionmap.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Default|0.240.0
Node20_229_2|0.240.1
Default|0.240.2
Node20_229_2|0.240.3
Loading