This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-ci-infra.git


The following commit(s) were added to refs/heads/main by this push:
     new d3600b6  Migrate to latest docker and docker-compose
d3600b6 is described below

commit d3600b6c5a7ae880b3f74fa868a1ad45a6ab1afd
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Aug 21 09:01:18 2023 +0200

    Migrate to latest docker and docker-compose
---
 github-runner-ami/packer/files/docker-buildx.sh  | 100 -----------------------
 github-runner-ami/packer/files/docker-compose.sh |  34 --------
 github-runner-ami/packer/files/docker.sh         |  38 +++++++++
 github-runner-ami/packer/ubuntu2004.pkr.hcl      |   3 +-
 4 files changed, 39 insertions(+), 136 deletions(-)

diff --git a/github-runner-ami/packer/files/docker-buildx.sh 
b/github-runner-ami/packer/files/docker-buildx.sh
deleted file mode 100644
index f05b342..0000000
--- a/github-runner-ami/packer/files/docker-buildx.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-set -exu -o pipefail
-
-architecture=$(uname -m)
-if [[ ${architecture} == "x86_64" ]] ; then
-    # Well. Docker compose got it right, but docker buildx didn't ¯\_(ツ)_/¯
-    architecture="amd64"
-fi
-# Hard-code docker buildx version
-buildx_version="v0.8.2"
-buildx_binary="buildx-${buildx_version}.$(uname -s)-${architecture}"
-plugins_dir="/home/runner/.docker/cli-plugins"
-sudo -u runner mkdir -pv "${plugins_dir}"
-sudo -u runner curl -L 
"https://github.com/docker/buildx/releases/download/${buildx_version}/${buildx_binary}";
 -o "${plugins_dir}/docker-buildx"
-sudo -u runner chmod a+x "${plugins_dir}/docker-buildx"
-
-
-## Support for multi-platform builds
-## See; 
https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images
-## We do not need installing qemu support for public runners as we are 
currently starting ARM instances to
-## build the images for ARM
-# apt install -y qemu qemu-user-static
-# sudo docker run --privileged --rm tonistiigi/binfmt --install all
-
-
-## Alternatively support builds with ARM instance launched on demand
-# Needed Launch arm instances and make the docker engine available via 
forwarded SSH connection
-apt-get install -y autossh
-# The runner role has to have the following policies enabled:
-# RunInstancesPolicy:
-#{
-#    "Version": "2012-10-17",
-#     "Statement": [
-#        {
-#            "Sid": "VisualEditor0",
-#            "Effect": "Allow",
-#            "Action": [
-#                "ec2:AuthorizeSecurityGroupIngress",
-#                "ec2:TerminateInstances",
-#                "ec2:CreateTags",
-#                "ec2:RunInstances",
-#                "ec2:RevokeSecurityGroupIngress"
-#            ],
-#            "Resource": [
-#                "arn:aws:ec2:us-east-2:827901512104:subnet/*",
-#                "arn:aws:ec2:us-east-2:827901512104:instance/*",
-#                "arn:aws:ec2:us-east-2:827901512104:security-group/*",
-#                "arn:aws:ec2:us-east-2:827901512104:network-interface/*",
-#                "arn:aws:ec2:us-east-2:827901512104:volume/*",
-#                "arn:aws:ec2:us-east-2::image/*"
-#            ]
-#        },
-#        {
-#            "Sid": "VisualEditor1",
-#            "Effect": "Allow",
-#            "Action": [
-#                "ec2:DescribeInstances",
-#                "ec2:DescribeInstanceStatus"
-#            ],
-#            "Resource": "*"
-#        }
-#    ]
-#}
-#
-# InstanceConnectPolicy:
-# {
-#    "Version": "2012-10-17",
-#    "Statement": [
-#        {
-#            "Effect": "Allow",
-#            "Action": [
-#                "ec2-instance-connect:SendSSHPublicKey"
-#            ],
-#            "Resource": [
-#                "arn:aws:ec2:us-east-2:827901512104:instance/*"
-#            ],
-#            "Condition": {
-#                "StringEquals": {
-#                    "ec2:osuser": "ec2-user"
-#                }
-#            }
-#        }
-#    ]
-# }
diff --git a/github-runner-ami/packer/files/docker-compose.sh 
b/github-runner-ami/packer/files/docker-compose.sh
deleted file mode 100644
index 6731124..0000000
--- a/github-runner-ami/packer/files/docker-compose.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -exu -o pipefail
-
-# 
https://github.com/actions/virtual-environments/blob/525f79f479cca77aef4e0a680548b65534c64a18/images/linux/scripts/installers/docker-compose.sh
-
-# disabled installing latest released version until 
https://github.com/docker/compose/issues/8742
-# is solved (docker v2 breaks network management required to get kerberos 
integration working
-# Switching temporary to latest released docker v2
-
-#URL=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | 
jq -r '.assets[].browser_download_url | 
select(endswith("docker-compose-linux-x86_64"))')
-#curl --fail -L "$URL" -o /usr/local/bin/docker-compose
-#chmod +x /usr/local/bin/docker-compose
-
-# Hard-code docker-compose 1.29.2
-curl -L 
"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname
 -s)-$(uname -m)" -o /usr/local/bin/docker-compose
-chmod +x /usr/local/bin/docker-compose
diff --git a/github-runner-ami/packer/files/docker.sh 
b/github-runner-ami/packer/files/docker.sh
new file mode 100644
index 0000000..d988914
--- /dev/null
+++ b/github-runner-ami/packer/files/docker.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -exu -o pipefail
+
+for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; 
do sudo apt-get remove $pkg; done
+
+sudo apt-get update
+sudo apt-get install ca-certificates curl gnupg
+
+sudo install -m 0755 -d /etc/apt/keyrings
+curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor 
-o /etc/apt/keyrings/docker.gpg
+sudo chmod a+r /etc/apt/keyrings/docker.gpg
+
+echo \
+  "deb [arch="$(dpkg --print-architecture)" 
signed-by=/etc/apt/keyrings/docker.gpg] 
https://download.docker.com/linux/debian \
+  "$(. /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 docker-ce docker-ce-cli containerd.io 
docker-buildx-plugin docker-compose-plugin
diff --git a/github-runner-ami/packer/ubuntu2004.pkr.hcl 
b/github-runner-ami/packer/ubuntu2004.pkr.hcl
index 4ef1ef0..40e49a8 100644
--- a/github-runner-ami/packer/ubuntu2004.pkr.hcl
+++ b/github-runner-ami/packer/ubuntu2004.pkr.hcl
@@ -146,12 +146,11 @@ build {
       "./files/install-nodejs.sh",
       "./files/install-github-cli.sh",
       "./files/install-subversion.sh",
-      "./files/docker-compose.sh",
+      "./files/docker.sh",
       "./files/configure_kernel.sh",
       "./files/git.sh",
       "./files/runner_bootstrap.sh",
       "./files/create-hostedtools-cache.sh",
-      "./files/docker-buildx.sh",
       "./files/regctl.sh",
       "./files/cleanup.sh",
     ]

Reply via email to