Skip to contentSkip to conversation

Switch to self-built container images for lava test jobs

PATCH Superseded Jan Kiszka 2 participants 7 messages Nov 13, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

cover Switch to self-built container images for lava test jobs

Saves bits (and money), speeds up test job starts, avoids current snapshot.d.o issues.

Jan

Jan Kiszka (2):
ci: Add scheduled job to build lavacli container
ci: Switch test job container to self-built one

 .gitlab-ci.yml             | 14 +++++++++++++-
 ci/Dockerfile.lavacli      | 17 +++++++++++++++++
 ci/gitlab-ci-base.yml      |  2 +-
 scripts/install-lavacli.sh | 23 -----------------------
 4 files changed, 31 insertions(+), 25 deletions(-)
 create mode 100644 ci/Dockerfile.lavacli
 delete mode 100755 scripts/install-lavacli.sh
Signature · 1 line
2.43.0
author
#6 lore raw

PATCH 2/2 ci: Switch test job container to self-built one

From: Jan Kiszka <[email protected]>

Speeds up a the start of test jobs, avoids access to snapshot.d.o (as used by kas-isar containers).

---
 ci/gitlab-ci-base.yml      |  2 +-
 scripts/install-lavacli.sh | 23 -----------------------
 2 files changed, 1 insertion(+), 24 deletions(-)
 delete mode 100755 scripts/install-lavacli.sh
ci/gitlab-ci-base.yml +1 -1
index a40dbcb..853d929 100644
@@ -93,12 +93,12 @@ default:
 
 .test:
   stage: test
+  image: $CONTAINER_REGISTRY/xenomai/xenomai-lava-container/lavacli
   tags:
     - lava
   before_script:
     - !reference [.common-config, script]
   script:
-    - scripts/install-lavacli.sh
     - scripts/run-lava-tests.sh ${TARGET}
   variables:
     BUILD_JOB_NAME: "build-${BUILD_IDENTIFIER}:${TARGET}"
scripts/install-lavacli.sh deleted +0 -23
deleted file mode 100755
index ae61497..0000000
@@ -1,23 +0,0 @@
-#!/bin/sh
-#
-# Xenomai Real-Time System
-#
-# Copyright (c) Siemens AG, 2019
-#
-# Authors:
-#  Quirin Gylstorff <[email protected]>
-#
-# SPDX-License-Identifier: MIT
-#
-# check if Debian 10 or later. If not use the pip version
-# of lavacli. The apt version from stretch-backports cannot communicate
-# with the lava master on Debian 10.
-os_version_id=$(sed -nr 's/VERSION_ID="([0-9]+)"/\1/p' /etc/os-release)
-sudo apt-get update
-sudo apt-get install -y jq xmlstarlet
-if [ "${os_version_id}" -ge "10" ]; then
-    sudo apt-get install -y lavacli
-else
-    sudo pip3 install wheel
-    sudo pip3 install lavacli
-fi
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/2 ci: Add scheduled job to build lavacli container

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

We want to switch to self-built Debian containers with lavacli pre-installed. That will speed-up the start of test jobs and avoid the manual installation of lavacli in each of them. To keep that container up to date, prepare a pipeline job that will be scheduled once a month to perform a build and deployment to gitlab.com (source.denx.de lacks a container registry).

---
 .gitlab-ci.yml        | 14 +++++++++++++-
 ci/Dockerfile.lavacli | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 ci/Dockerfile.lavacli
.gitlab-ci.yml +13 -1
index b8945bc..37d2a6d 100644
@@ -15,6 +15,7 @@ variables:
 
 stages:
   - parent
+  - build
 
 .parent:
   stage: parent
@@ -56,4 +57,15 @@ xenomai-3/next-long-term:
     include:
       - local: '/ci/xenomai_3_next_long_term.yml'
   rules:
-  - if: $CI_PIPELINE_SOURCE == "schedule"
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $ONLY_RUN == $CI_JOB_NAME'
+
+lavacli-container:
+  image: quay.io/buildah/stable
+  stage: build
+  before_script:
+    - buildah login -u "$CONTAINER_DEPLOY_TOKEN_USER" --password $CONTAINER_DEPLOY_TOKEN_PWD $CONTAINER_REGISTRY
+  script:
+    - buildah build -f ci/Dockerfile.lavacli -t $CONTAINER_REGISTRY/xenomai/xenomai-lava-container/lavacli .
+    - buildah push $CONTAINER_REGISTRY/xenomai/xenomai-lava-container/lavacli
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $ONLY_RUN == $CI_JOB_NAME'
ci/Dockerfile.lavacli new file +17 -0
new file mode 100644
index 0000000..5d5725b
@@ -0,0 +1,17 @@
+#
+# Xenomai Real-Time System
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Jan Kiszka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+FROM debian:stable
+
+ARG DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update && \
+    apt-get install -y sudo gettext-base jq xmlstarlet lavacli
Signature · 1 line
2.43.0
author
#2 lore raw

Re: [xenomai-images][PATCH 1/2] ci: Add scheduled job to build lavacli container

Quoted 58 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

We want to switch to self-built Debian containers with lavacli pre-installed. That will speed-up the start of test jobs and avoid the manual installation of lavacli in each of them. To keep that container up to date, prepare a pipeline job that will be scheduled once a month to perform a build and deployment to gitlab.com (source.denx.de lacks a container registry).

---
 .gitlab-ci.yml        | 14 +++++++++++++-
 ci/Dockerfile.lavacli | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 ci/Dockerfile.lavacli
.gitlab-ci.yml +13 -1
index b8945bc..37d2a6d 100644
@@ -15,6 +15,7 @@ variables:
 
 stages:
   - parent
+  - build
 
 .parent:
   stage: parent
@@ -56,4 +57,15 @@ xenomai-3/next-long-term:
     include:
       - local: '/ci/xenomai_3_next_long_term.yml'
   rules:
-  - if: $CI_PIPELINE_SOURCE == "schedule"
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $ONLY_RUN == $CI_JOB_NAME'
+
+lavacli-container:
+  image: quay.io/buildah/stable
+  stage: build
+  before_script:
+    - buildah login -u "$CONTAINER_DEPLOY_TOKEN_USER" --password $CONTAINER_DEPLOY_TOKEN_PWD $CONTAINER_REGISTRY
+  script:
+    - buildah build -f ci/Dockerfile.lavacli -t $CONTAINER_REGISTRY/xenomai/xenomai-lava-container/lavacli .
+    - buildah push $CONTAINER_REGISTRY/xenomai/xenomai-lava-container/lavacli
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $ONLY_RUN == $CI_JOB_NAME'
ci/Dockerfile.lavacli new file +7 -0
new file mode 100644
index 0000000..5d5725b
@@ -0,0 +1,17 @@
+#
+# Xenomai Real-Time System
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Jan Kiszka <[email protected]>

ci/Dockerfile.lavacli line 17

Quoted 10 lines
ci/Dockerfile.lavacli new file +10 -0
+#
+# SPDX-License-Identifier: MIT
+#
+
+FROM debian:stable
+
+ARG DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update && \
+    apt-get install -y sudo gettext-base jq xmlstarlet lavacli

We also needed curl - added in next now.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#3 lore raw

Re: [xenomai-images][PATCH 1/2] ci: Add scheduled job to build lavacli container

In reply to Jan Kiszka
Quoted 30 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

We want to switch to self-built Debian containers with lavacli pre-installed. That will speed-up the start of test jobs and avoid the manual installation of lavacli in each of them. To keep that container up to date, prepare a pipeline job that will be scheduled once a month to perform a build and deployment to gitlab.com (source.denx.de lacks a container registry).

---
 .gitlab-ci.yml        | 14 +++++++++++++-
 ci/Dockerfile.lavacli | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 ci/Dockerfile.lavacli
.gitlab-ci.yml +1 -0
index b8945bc..37d2a6d 100644
@@ -15,6 +15,7 @@ variables:
 
 stages:
   - parent
+  - build
 
 .parent:
   stage: parent
@@ -56,4 +57,15 @@ xenomai-3/next-long-term:
     include:

.gitlab-ci.yml xenomai-3/next-long-term: · line 66

Quoted 10 lines
.gitlab-ci.yml +7 -1
       - local: '/ci/xenomai_3_next_long_term.yml'
   rules:
-  - if: $CI_PIPELINE_SOURCE == "schedule"
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $ONLY_RUN == $CI_JOB_NAME'
+
+lavacli-container:
+  image: quay.io/buildah/stable
+  stage: build
+  before_script:
+    - buildah login -u "$CONTAINER_DEPLOY_TOKEN_USER" --password $CONTAINER_DEPLOY_TOKEN_PWD $CONTAINER_REGISTRY

Where are those CONTAINER_ variables coming from?

Using them as cmdline arguments can easily leak them by enabling something like CI_DEBUG_TRACE.

We break the "fork and re-use CI configuration" workflow even more now.

Quoted 30 lines
.gitlab-ci.yml +5 -0
+  script:
+    - buildah build -f ci/Dockerfile.lavacli -t $CONTAINER_REGISTRY/xenomai/xenomai-lava-container/lavacli .
+    - buildah push $CONTAINER_REGISTRY/xenomai/xenomai-lava-container/lavacli
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $ONLY_RUN == $CI_JOB_NAME'
ci/Dockerfile.lavacli new file +17 -0
new file mode 100644
index 0000000..5d5725b
@@ -0,0 +1,17 @@
+#
+# Xenomai Real-Time System
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Jan Kiszka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+FROM debian:stable
+
+ARG DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update && \
+    apt-get install -y sudo gettext-base jq xmlstarlet lavacli
Signature · 1 line
2.43.0
author
#4 lore raw

Re: [xenomai-images][PATCH 1/2] ci: Add scheduled job to build lavacli container

Quoted 44 lines · Florian Bezdeka
Quoted 30 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

We want to switch to self-built Debian containers with lavacli pre-installed. That will speed-up the start of test jobs and avoid the manual installation of lavacli in each of them. To keep that container up to date, prepare a pipeline job that will be scheduled once a month to perform a build and deployment to gitlab.com (source.denx.de lacks a container registry).

---
 .gitlab-ci.yml        | 14 +++++++++++++-
 ci/Dockerfile.lavacli | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 ci/Dockerfile.lavacli
.gitlab-ci.yml +1 -0
index b8945bc..37d2a6d 100644
@@ -15,6 +15,7 @@ variables:
 
 stages:
   - parent
+  - build
 
 .parent:
   stage: parent
@@ -56,4 +57,15 @@ xenomai-3/next-long-term:
     include:

.gitlab-ci.yml xenomai-3/next-long-term: · line 66

Quoted 10 lines
.gitlab-ci.yml +7 -1
       - local: '/ci/xenomai_3_next_long_term.yml'
   rules:
-  - if: $CI_PIPELINE_SOURCE == "schedule"
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $ONLY_RUN == $CI_JOB_NAME'
+
+lavacli-container:
+  image: quay.io/buildah/stable
+  stage: build
+  before_script:
+    - buildah login -u "$CONTAINER_DEPLOY_TOKEN_USER" --password $CONTAINER_DEPLOY_TOKEN_PWD $CONTAINER_REGISTRY

Where are those CONTAINER_ variables coming from?

Quoted 3 lines

Using them as cmdline arguments can easily leak them by enabling something like CI_DEBUG_TRACE.

They are masked vars in your gitlab-ci project if you want to build that container. No difference here to other credentials BTW.

Quoted 1 line

We break the "fork and re-use CI configuration" workflow even more now.

Only if you actually trigger this part of the pipeline. It requires a dedicated schedule for ONLY_RUN variable set.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#5 lore raw

Re: [xenomai-images][PATCH 1/2] ci: Add scheduled job to build lavacli container

Quoted 45 lines · Jan Kiszka
Quoted 44 lines · Florian Bezdeka
Quoted 30 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

We want to switch to self-built Debian containers with lavacli pre-installed. That will speed-up the start of test jobs and avoid the manual installation of lavacli in each of them. To keep that container up to date, prepare a pipeline job that will be scheduled once a month to perform a build and deployment to gitlab.com (source.denx.de lacks a container registry).

---
 .gitlab-ci.yml        | 14 +++++++++++++-
 ci/Dockerfile.lavacli | 17 +++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 ci/Dockerfile.lavacli
.gitlab-ci.yml +1 -0
index b8945bc..37d2a6d 100644
@@ -15,6 +15,7 @@ variables:
 
 stages:
   - parent
+  - build
 
 .parent:
   stage: parent
@@ -56,4 +57,15 @@ xenomai-3/next-long-term:
     include:

.gitlab-ci.yml xenomai-3/next-long-term: · line 66

Quoted 10 lines
.gitlab-ci.yml +7 -1
       - local: '/ci/xenomai_3_next_long_term.yml'
   rules:
-  - if: $CI_PIPELINE_SOURCE == "schedule"
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $ONLY_RUN == $CI_JOB_NAME'
+
+lavacli-container:
+  image: quay.io/buildah/stable
+  stage: build
+  before_script:
+    - buildah login -u "$CONTAINER_DEPLOY_TOKEN_USER" --password $CONTAINER_DEPLOY_TOKEN_PWD $CONTAINER_REGISTRY

Where are those CONTAINER_ variables coming from?

Quoted 6 lines
Quoted 3 lines

Using them as cmdline arguments can easily leak them by enabling something like CI_DEBUG_TRACE.

They are masked vars in your gitlab-ci project if you want to build that container. No difference here to other credentials BTW.

Then the documentation is missing. See tests/README.md.

Quoted 11 lines
Quoted 2 lines

We break the "fork and re-use CI configuration" workflow even more now.

Only if you actually trigger this part of the pipeline. It requires a dedicated schedule for ONLY_RUN variable set.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center