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 c392c13  Add support for building image using ARM hardware
c392c13 is described below

commit c392c13fde39bd3822a650c7840885f4cc8bcdb5
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sun Mar 20 19:30:08 2022 +0100

    Add support for building image using ARM hardware
---
 github-runner-ami/packer/files/docker-buildx.sh | 71 +++++++++++++++++++++++--
 github-runner-ami/packer/ubuntu2004.pkr.hcl     |  2 +-
 2 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/github-runner-ami/packer/files/docker-buildx.sh 
b/github-runner-ami/packer/files/docker-buildx.sh
index 6964321..b4fe86e 100644
--- a/github-runner-ami/packer/files/docker-buildx.sh
+++ b/github-runner-ami/packer/files/docker-buildx.sh
@@ -30,8 +30,71 @@ 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"
 
-apt install -y qemu qemu-user-static
 
-# make sure multi-platform support is added for self-hosted runners
-# See; 
https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images
-sudo docker run --privileged --rm tonistiigi/binfmt --install all
+## 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/ubuntu2004.pkr.hcl 
b/github-runner-ami/packer/ubuntu2004.pkr.hcl
index 46e8cf5..b1ea312 100644
--- a/github-runner-ami/packer/ubuntu2004.pkr.hcl
+++ b/github-runner-ami/packer/ubuntu2004.pkr.hcl
@@ -38,7 +38,7 @@ source "amazon-ebs" "runner_builder" {
   #access_key = ""
   #secret_key = ""
   region = var.aws_regions[0]
-  ami_name = "${var.ami_name}-${var.runner_version}-v1"
+  ami_name = "${var.ami_name}-${var.runner_version}-v3"
   ami_regions = var.aws_regions
   tag {
     key   = "Name"

Reply via email to