public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Cedric Hombourger' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: ubely@ilbers.de, Cedric Hombourger <cedric.hombourger@siemens.com>
Subject: [PATCH v2 2/2] ci: add ci_setup script to ease provisioning of the test container
Date: Fri, 21 Mar 2025 12:01:00 +0100	[thread overview]
Message-ID: <20250321110100.3367400-3-cedric.hombourger@siemens.com> (raw)
In-Reply-To: <20250321110100.3367400-1-cedric.hombourger@siemens.com>

Our CONTRIBUTING guide lists several manual steps to be done prior
to running avocado: introduce a ci_setup script that we will use
as entry-point to the kas container. This will help developers
reproduce the CI environment they should use to validate their
changes prior to submitting them.

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
 CONTRIBUTING.md     |  9 +--------
 scripts/ci_setup.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 8 deletions(-)
 create mode 100755 scripts/ci_setup.sh

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 06f09aed..b4fa64ff 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -98,19 +98,12 @@ Plan merges to `master` so that both fit the two-week window; short extensions s
           meta:
           meta-isar:
     EOF
-    kas/kas-container shell kas.yml
+    kas/kas-container --entrypoint /work/scripts/ci_setup.sh shell kas.yml
     ```
 
     In kas shell:
 
     ```
-    wget -q http://deb.isar-build.org/debian-isar.key -O- |gpg --dearmor \
-        |sudo dd of=/etc/apt/trusted.gpg.d/debian-isar.gpg
-    echo "deb [signed-by=/etc/apt/trusted.gpg.d/debian-isar.gpg] \
-        http://deb.isar-build.org/debian-isar bookworm-isar main" \
-        |sudo tee /etc/apt/sources.list.d/10-isar_build.list
-    sudo apt-get update
-    sudo apt-get install -y avocado qemu-system-arm qemu-system-x86
     cd /work/isar/testsuite
     avocado run citest.py -t dev --max-parallel-tasks=1
     ```
diff --git a/scripts/ci_setup.sh b/scripts/ci_setup.sh
new file mode 100755
index 00000000..f373d1c0
--- /dev/null
+++ b/scripts/ci_setup.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Script to setup a container for CI builds
+#
+# Cedric Hombourger <cedric.hombourger@siemens.com>
+# Copyright (c) Siemens AG, 2025
+# SPDX-License-Identifier: MIT
+
+gpg_key=/etc/apt/trusted.gpg.d/debian-isar.gpg
+[ -f "${gpg_key}" ] || {
+    wget -q http://deb.isar-build.org/debian-isar.key -O- \
+    | gpg --dearmor \
+    | sudo dd of="${gpg_key}"
+}
+
+list=/etc/apt/sources.list.d/10-isar_build.list
+[ -f "${list}" ] || {
+    echo "deb [signed-by=/etc/apt/trusted.gpg.d/debian-isar.gpg] \
+        http://deb.isar-build.org/debian-isar bookworm-isar main" \
+    | sudo tee /etc/apt/sources.list.d/10-isar_build.list
+}
+
+tools="avocado qemu-system-aarch64 qemu-system-arm qemu-system-i386 qemu-system-x86_64"
+need_install=0
+for tool in ${tools}; do
+    which "${tool}" || need_install=1
+done
+[ "${need_install}" = "0" ] || {
+    sudo apt-get update
+    sudo apt-get install -y avocado qemu-system-arm qemu-system-x86
+}
+
+exec /container-entrypoint ${*}
-- 
2.39.5

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250321110100.3367400-3-cedric.hombourger%40siemens.com.

  parent reply	other threads:[~2025-03-21 11:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21  8:48 [PATCH] CONTRIBUTING: refine steps for running CI tests prior to submission 'Cedric Hombourger' via isar-users
2025-03-21 11:00 ` [PATCH v2 0/2] refine steps for running CI " 'Cedric Hombourger' via isar-users
2025-03-21 11:00   ` [PATCH v2 1/2] CONTRIBUTING: refine steps for running CI tests " 'Cedric Hombourger' via isar-users
2025-03-21 11:01   ` 'Cedric Hombourger' via isar-users [this message]
2025-03-27 10:33   ` [PATCH v2 0/2] refine steps for running CI " Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250321110100.3367400-3-cedric.hombourger@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=ubely@ilbers.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox