You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by as...@apache.org on 2021/04/22 16:17:59 UTC

[airflow-ci-infra] 01/01: Fix runner AMI so it

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

ash pushed a commit to branch fix-runner-ami
in repository https://gitbox.apache.org/repos/asf/airflow-ci-infra.git

commit 818b9ae21884163f76c26aea9bf81694458d16a3
Author: Ash Berlin-Taylor <as...@firemirror.com>
AuthorDate: Thu Apr 22 17:16:17 2021 +0100

    Fix runner AMI so it
    
    - Update to the latest runner version
    - Install the vector.toml config file
    - Install stop-runner-if-no-job in to correct path
    - Don't enable actions.runner service at boot (do it slightly later in
      user data)
---
 github-runner-ami/packer/files/install-dependencies.sh | 5 +++--
 github-runner-ami/packer/files/install-files.sh        | 4 +++-
 github-runner-ami/packer/files/runner_bootstrap.sh     | 5 ++++-
 github-runner-ami/packer/ubuntu2004.pkr.hcl            | 8 ++++++--
 github-runner-ami/packer/vars/variables.pkrvars.hcl    | 2 +-
 5 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/github-runner-ami/packer/files/install-dependencies.sh b/github-runner-ami/packer/files/install-dependencies.sh
index 0b20557..a62a85c 100644
--- a/github-runner-ami/packer/files/install-dependencies.sh
+++ b/github-runner-ami/packer/files/install-dependencies.sh
@@ -17,7 +17,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-export DEBIAN_FRONTEND=noninteractive
 
 debconf-set-selections <<EOF
 iptables-persistent iptables-persistent/autosave_done boolean true
@@ -25,8 +24,10 @@ iptables-persistent iptables-persistent/autosave_v4 boolean false
 iptables-persistent iptables-persistent/autosave_v6 boolean false
 EOF
 
+export DEBIAN_FRONTEND=noninteractive
+
 apt-get update
-apt-get install -y --no-install-recommends \
+apt-get install -yq --no-install-recommends -o Dpkg::Options::="--force-confold" \
             awscli \
             build-essential \
             docker.io \
diff --git a/github-runner-ami/packer/files/install-files.sh b/github-runner-ami/packer/files/install-files.sh
index b99e472..9c726f6 100644
--- a/github-runner-ami/packer/files/install-files.sh
+++ b/github-runner-ami/packer/files/install-files.sh
@@ -18,10 +18,12 @@
 
 set -eu -o pipefail
 
-mkdir /etc/iptables/
+mkdir /etc/iptables/ /etc/vector
 
 install --owner root --mode=0644 --target-directory "/etc/systemd/system/" "/tmp/etc-systemd-system/"*
 install --owner root --mode=0755 --target-directory "/usr/local/sbin" "/tmp/usr-local-sbin/"*
+install --owner root --mode=0755 --target-directory "/usr/local/bin" "/tmp/usr-local-bin/"*
 install --owner root --mode=0644 --target-directory "/etc/iptables" "/tmp/etc-iptables/"*
 install --owner root --mode=0644 --target-directory "/etc/cron.d" "/tmp/etc-cron.d/"*
 install --owner root --mode=0644 --target-directory "/etc/sudoers.d" "/tmp/etc-sudoers.d/"*
+install --owner root --mode=0644 --target-directory "/etc/vector/" "/tmp/etc-vector/"*
diff --git a/github-runner-ami/packer/files/runner_bootstrap.sh b/github-runner-ami/packer/files/runner_bootstrap.sh
index 0b258a7..132d870 100644
--- a/github-runner-ami/packer/files/runner_bootstrap.sh
+++ b/github-runner-ami/packer/files/runner_bootstrap.sh
@@ -39,4 +39,7 @@ install --owner root --mode 0755 /tmp/runner-supervisor /opt/runner-supervisor/b
 
 systemctl enable iptables.service
 systemctl enable vector.service
-systemctl enable actions.runner.service
+
+# We don't enable actions.runner.service here, but instead in the user-data
+# script, as otherwise it would happen to early, before we have had a chance to
+# drop the AWS_DEFAULT_REGION in to /etc/environment
diff --git a/github-runner-ami/packer/ubuntu2004.pkr.hcl b/github-runner-ami/packer/ubuntu2004.pkr.hcl
index 93f8799..aa39896 100644
--- a/github-runner-ami/packer/ubuntu2004.pkr.hcl
+++ b/github-runner-ami/packer/ubuntu2004.pkr.hcl
@@ -89,7 +89,7 @@ build {
   # in to place with the approriate permissions via install-files.sh provisioner step
   provisioner "shell" {
     inline = [
-      "mkdir -p /tmp/etc-systemd-system /tmp/usr-local-sbin /tmp/etc-sudoers.d /tmp/etc-iptables /tmp/etc-cron.d"
+      "mkdir -p /tmp/etc-systemd-system /tmp/usr-local-sbin /tmp/usr-local-bin /tmp/etc-sudoers.d /tmp/etc-iptables /tmp/etc-cron.d /tmp/etc-vector"
     ]
   }
   provisioner "file" {
@@ -105,7 +105,7 @@ build {
     source      = "./files/runner-cleanup-workdir.sh"
   }
   provisioner "file" {
-    destination = "/tmp/usr-local-sbin/stop-runner-if-no-job.sh"
+    destination = "/tmp/usr-local-bin/stop-runner-if-no-job.sh"
     source      = "./files/stop-runner-if-no-job.sh"
   }
   provisioner "file" {
@@ -132,6 +132,10 @@ build {
     destination = "/tmp/runner-supervisor"
     source      = "./files/runner-supervisor.py"
   }
+  provisioner "file" {
+    destination = "/tmp/etc-vector/vector.toml"
+    source      = "./files/vector.toml"
+  }
   provisioner "shell" {
     scripts = [
       "./files/install-files.sh",
diff --git a/github-runner-ami/packer/vars/variables.pkrvars.hcl b/github-runner-ami/packer/vars/variables.pkrvars.hcl
index 2680fdd..9789e77 100644
--- a/github-runner-ami/packer/vars/variables.pkrvars.hcl
+++ b/github-runner-ami/packer/vars/variables.pkrvars.hcl
@@ -20,6 +20,6 @@ ami_name = "airflow-runner-ami"
 aws_region = "eu-central-1"
 subnet_id = "subnet-72ed3c0e"
 packer_role_arn = "arn:aws:iam::827901512104:role/packer-role"
-runner_version = "2.277.1-airflow3"
+runner_version = "2.278.0-airflow2"
 kms_key_arn = "arn:aws:kms:eu-central-1:827901512104:key/48a58710-7ac6-4f88-995f-758a6a450faa"
 session_manager_instance_profile_name = "packer_ssm_instance_profile"