This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch add-docker-buildx-plugin in repository https://gitbox.apache.org/repos/asf/airflow-ci-infra.git
commit ac35f8062333b77301501f466b0dba885a09d8cf Author: Jarek Potiuk <[email protected]> AuthorDate: Thu Jan 20 19:42:47 2022 +0100 Add Docker Buildx plugin --- .gitignore | 2 ++ .../variables.pkrvars.hcl => files/docker-buildx.sh} | 19 +++++++++++++------ github-runner-ami/packer/ubuntu2004.pkr.hcl | 3 ++- github-runner-ami/packer/vars/variables.pkrvars.hcl | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index f9f8225..27d454c 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,5 @@ override.tf.json session-manager-plugin.* # End of https://www.toptal.com/developers/gitignore/api/terraform +github-runner-ami/packer/session-manager-plugin.deb +github-runner-ami/packer/session-manager-plugin.rpm diff --git a/github-runner-ami/packer/vars/variables.pkrvars.hcl b/github-runner-ami/packer/files/docker-buildx.sh similarity index 58% copy from github-runner-ami/packer/vars/variables.pkrvars.hcl copy to github-runner-ami/packer/files/docker-buildx.sh index 5356f0b..ff318b8 100644 --- a/github-runner-ami/packer/vars/variables.pkrvars.hcl +++ b/github-runner-ami/packer/files/docker-buildx.sh @@ -1,3 +1,4 @@ +#!/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 @@ -14,10 +15,16 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +set -exu -o pipefail -vpc_id = "vpc-d73487bd" -ami_name = "airflow-runner-ami" -aws_regions = ["eu-central-1", "us-east-2"] -packer_role_arn = "arn:aws:iam::827901512104:role/packer-role" -runner_version = "2.286.1-airflow1" -session_manager_instance_profile_name = "packer_ssm_instance_profile" +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.7.1" +buildx_binary="buildx-${buildx_version}.$(uname -s)-${architecture}" +plugins_dir="${HOME}/.docker/cli-plugins" +mkdir -pv "${plugins_dir}" +curl -L "https://github.com/docker/buildx/releases/download/${buildx_version}/${buildx_binary}" -o "${plugins_dir}/${buildx_binary}" diff --git a/github-runner-ami/packer/ubuntu2004.pkr.hcl b/github-runner-ami/packer/ubuntu2004.pkr.hcl index 152afd6..1d62fa0 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}-v4" + ami_name = "${var.ami_name}-${var.runner_version}" ami_regions = var.aws_regions tag { key = "Name" @@ -140,6 +140,7 @@ build { "./files/install-nodejs.sh", "./files/install-github-cli.sh", "./files/docker-compose.sh", + "./files/docker-buildx.sh", "./files/git.sh", "./files/runner_bootstrap.sh", "./files/cleanup.sh", diff --git a/github-runner-ami/packer/vars/variables.pkrvars.hcl b/github-runner-ami/packer/vars/variables.pkrvars.hcl index 5356f0b..01d6ed9 100644 --- a/github-runner-ami/packer/vars/variables.pkrvars.hcl +++ b/github-runner-ami/packer/vars/variables.pkrvars.hcl @@ -19,5 +19,5 @@ vpc_id = "vpc-d73487bd" ami_name = "airflow-runner-ami" aws_regions = ["eu-central-1", "us-east-2"] packer_role_arn = "arn:aws:iam::827901512104:role/packer-role" -runner_version = "2.286.1-airflow1" +runner_version = "2.286.1-airflow" session_manager_instance_profile_name = "packer_ssm_instance_profile"
