Skip to content

Commit

Permalink
Revert "[Ubuntu] remove Docker Comose v1 (actions#9559)" (actions#9617)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil-mubarakshin authored and guicaulada committed Jun 11, 2024
1 parent 9cd2175 commit a2c5844
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 3 deletions.
21 changes: 21 additions & 0 deletions images/ubuntu/scripts/build/install-docker-compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -e
################################################################################
## File: install-docker-compose.sh
## Desc: Install Docker Compose v1
## Supply chain security: Docker Compose v1 - checksum validation
################################################################################

# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh

# Download docker-compose v1 from releases
binary_path=$(download_with_retry "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64")

# Supply chain security - Docker Compose v1
external_hash="f3f10cf3dbb8107e9ba2ea5f23c1d2159ff7321d16f0a23051d68d8e2547b323"
use_checksum_comparison "${binary_path}" "${external_hash}"

# Install docker-compose v1
install "${binary_path}" "/usr/local/bin/docker-compose"

invoke_tests "Tools" "Docker-compose v1"
1 change: 1 addition & 0 deletions images/ubuntu/scripts/docs-gen/Generate-SoftwareReport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ if (Test-IsAmd64) {
$tools.AddToolVersion("CodeQL Action Bundle", $(Get-CodeQLBundleVersion))
}
$tools.AddToolVersion("Docker Amazon ECR Credential Helper", $(Get-DockerAmazonECRCredHelperVersion))
$tools.AddToolVersion("Docker Compose v1", $(Get-DockerComposeV1Version))
$tools.AddToolVersion("Docker Compose v2", $(Get-DockerComposeV2Version))
$tools.AddToolVersion("Docker-Buildx", $(Get-DockerBuildxVersion))
$tools.AddToolVersion("Docker Client", $(Get-DockerClientVersion))
Expand Down
5 changes: 5 additions & 0 deletions images/ubuntu/scripts/docs-gen/SoftwareReport.Tools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ function Get-CMakeVersion {
return $cmakeVersion
}

function Get-DockerComposeV1Version {
$composeVersion = docker-compose -v | Get-StringPart -Part 2 | Get-StringPart -Part 0 -Delimiter ","
return $composeVersion
}

function Get-DockerComposeV2Version {
$composeVersion = docker compose version | Get-StringPart -Part 3 | Get-StringPart -Part 0 -Delimiter "v"
return $composeVersion
Expand Down
8 changes: 7 additions & 1 deletion images/ubuntu/scripts/tests/Tools.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Describe "Docker" {
}
}

It "Docker compose v2" {
It "docker compose v2" {
$version=(Get-ToolsetContent).docker.plugins | Where-Object { $_.plugin -eq 'compose' } | Select-Object -ExpandProperty version
If ($version -ne "latest") {
$(docker compose version --short) | Should -BeLike "*$version*"
Expand All @@ -105,6 +105,12 @@ Describe "Docker images" {
}
}

Describe "Docker-compose v1" {
It "docker-compose" {
"docker-compose --version"| Should -ReturnZeroExitCode
}
}

Describe "Ansible" {
It "Ansible" {
"ansible --version" | Should -ReturnZeroExitCode
Expand Down
2 changes: 1 addition & 1 deletion images/ubuntu/templates/ubuntu-20.04.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ build {
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "DOCKERHUB_LOGIN=${var.dockerhub_login}", "DOCKERHUB_PASSWORD=${var.dockerhub_password}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/install-docker.sh"]
scripts = ["${path.root}/../scripts/build/install-docker-compose.sh", "${path.root}/../scripts/build/install-docker.sh"]
}

provisioner "shell" {
Expand Down
2 changes: 1 addition & 1 deletion images/ubuntu/templates/ubuntu-22.04.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ build {
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "DOCKERHUB_LOGIN=${var.dockerhub_login}", "DOCKERHUB_PASSWORD=${var.dockerhub_password}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/install-docker.sh"]
scripts = ["${path.root}/../scripts/build/install-docker-compose.sh", "${path.root}/../scripts/build/install-docker.sh"]
}

provisioner "shell" {
Expand Down

0 comments on commit a2c5844

Please sign in to comment.