From 2c3bf406dc3335d076698201be742f9c96ef4fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Wed, 4 Oct 2023 15:01:13 +0200 Subject: [PATCH] ci: Create a function to install docker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will be re-used in other tests as well. Signed-off-by: Fabiano FidĂȘncio --- tests/common.bash | 18 ++++++++++++++++++ tests/integration/docker/gha-run.sh | 16 +--------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/common.bash b/tests/common.bash index a111445749..34c59e0528 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -547,6 +547,24 @@ EOF sudo systemctl enable --now crio } +function install_docker() { + # Add Docker's official GPG key + sudo apt-get update + sudo apt-get -y install ca-certificates curl gnupg + sudo install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + sudo chmod a+r /etc/apt/keyrings/docker.gpg + + # Add the repository to Apt sources: + echo \ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update + + sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin +} + # Convert architecture to the name used by golang function arch_to_golang() { local arch="$(uname -m)" diff --git a/tests/integration/docker/gha-run.sh b/tests/integration/docker/gha-run.sh index cab3401ea1..0a01006684 100755 --- a/tests/integration/docker/gha-run.sh +++ b/tests/integration/docker/gha-run.sh @@ -16,21 +16,7 @@ source "${docker_dir}/../../common.bash" function install_dependencies() { info "Installing the dependencies needed for running the docker smoke test" - # Add Docker's official GPG key: - sudo apt-get update - sudo apt-get -y install ca-certificates curl gnupg - sudo install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg - sudo chmod a+r /etc/apt/keyrings/docker.gpg - - # Add the repository to Apt sources: - echo \ - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ - "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - sudo apt-get update - - sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + install_docker } function run() {