From 0e1455a44449269afe4e16797858662901ed455c Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Fri, 4 Apr 2025 11:54:29 +0200 Subject: [PATCH 01/11] Refactor: remove obsolete Dockerfiles Signed-off-by: Simone Tollardo --- .../requirements.txt => callback-requirements.txt | 0 docker-compose-kcidb.yaml | 2 +- docker-compose-lava.yaml | 2 -- docker/kcidb/Dockerfile | 13 ------------- docker/lava-callback/Dockerfile | 10 ---------- docker/pipeline/Dockerfile.production | 14 -------------- 6 files changed, 1 insertion(+), 40 deletions(-) rename docker/lava-callback/requirements.txt => callback-requirements.txt (100%) delete mode 100644 docker/kcidb/Dockerfile delete mode 100644 docker/lava-callback/Dockerfile delete mode 100644 docker/pipeline/Dockerfile.production diff --git a/docker/lava-callback/requirements.txt b/callback-requirements.txt similarity index 100% rename from docker/lava-callback/requirements.txt rename to callback-requirements.txt diff --git a/docker-compose-kcidb.yaml b/docker-compose-kcidb.yaml index f04613926..6e468357c 100644 --- a/docker-compose-kcidb.yaml +++ b/docker-compose-kcidb.yaml @@ -9,7 +9,7 @@ services: kcidb: container_name: 'kernelci-pipeline-kcidb' - image: 'ghcr.io/kernelci/staging-kernelci:pipeline' + image: 'kernelci/staging-kernelci:pipeline' env_file: ['.env'] stop_signal: 'SIGINT' networks: ['kcidb'] diff --git a/docker-compose-lava.yaml b/docker-compose-lava.yaml index cc67d40a4..8c7e9d23a 100644 --- a/docker-compose-lava.yaml +++ b/docker-compose-lava.yaml @@ -10,8 +10,6 @@ services: lava-callback: container_name: 'kernelci-pipeline-lava-callback' networks: ['lava-callback'] - build: - context: 'docker/lava-callback' env_file: ['.env'] ports: - '${LAVA_CALLBACK_PORT:-8100}:8000' diff --git a/docker/kcidb/Dockerfile b/docker/kcidb/Dockerfile deleted file mode 100644 index 43b1562c4..000000000 --- a/docker/kcidb/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -# -# Copyright (C) 2021, 2022 Collabora Limited -# Author: Guillaume Tucker - -FROM kernelci/staging-kernelci -MAINTAINER "KernelCI TSC" - -# Install kcidb -RUN pip install git+https://github.com/kernelci/kcidb.git - -# Install logspec -RUN pip install git+https://github.com/kernelci/logspec.git@3421f63da61d80d00a4497a915d19520285f5020 diff --git a/docker/lava-callback/Dockerfile b/docker/lava-callback/Dockerfile deleted file mode 100644 index f4b0f7cf2..000000000 --- a/docker/lava-callback/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM kernelci/staging-kernelci - -WORKDIR /home/kernelci/callback -COPY requirements.txt . - -USER root -RUN pip3 install -r /home/kernelci/callback/requirements.txt - -USER kernelci -WORKDIR /home/kernelci/ diff --git a/docker/pipeline/Dockerfile.production b/docker/pipeline/Dockerfile.production deleted file mode 100644 index 957efb40e..000000000 --- a/docker/pipeline/Dockerfile.production +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -# -# Copyright (C) 2023 Collabora Limited -# Author: Guillaume Tucker - -FROM kernelci/k8s:kernelci -MAINTAINER "KernelCI TSC" - -ARG git_url=https://github.com/kernelci/kernelci-pipeline.git -ARG git_rev=main -RUN git clone --depth=1 $git_url pipeline -WORKDIR pipeline -RUN git fetch origin $git_rev -RUN git checkout FETCH_HEAD From 136748faf8e8944af8ca313ec23ad91b5eb3e26f Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 3 Apr 2025 10:38:55 +0200 Subject: [PATCH 02/11] Fix: rename 'timeout' containers to 'timeout_task' to avoid conflicts with docker keyword Signed-off-by: Simone Tollardo --- config/logger.conf | 18 +++++++++--------- doc/pipeline-details.md | 2 +- docker-compose.yaml | 6 +++--- kube/aks/nodehandlers.yaml | 6 +++--- .../timeout-closing-deployment.yaml | 8 ++++---- .../timeout-holdoff-deployment.yaml | 8 ++++---- src/timeout.py | 6 +++--- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/config/logger.conf b/config/logger.conf index 3b51d3d11..4a30cf137 100644 --- a/config/logger.conf +++ b/config/logger.conf @@ -16,9 +16,9 @@ keys=root, send_kcidb, tarball, test_report, - timeout, - timeout-closing, - timeout-holdoff, + timeout-task, + timeout-task-closing, + timeout-task-holdoff, trigger [handlers] @@ -113,22 +113,22 @@ handlers=consoleHandler, timedRotatingHandler qualname=test_report propagate=0 -[logger_timeout] +[logger_timeout-task] level=DEBUG handlers=consoleHandler, timedRotatingHandler -qualname=timeout +qualname=timeout-task propagate=0 -[logger_timeout-closing] +[logger_timeout-task-closing] level=DEBUG handlers=consoleHandler, timedRotatingHandler -qualname=timeout-closing +qualname=timeout-task-closing propagate=0 -[logger_timeout-holdoff] +[logger_timeout-task-holdoff] level=DEBUG handlers=consoleHandler, timedRotatingHandler -qualname=timeout-holdoff +qualname=timeout-task-holdoff propagate=0 [logger_trigger] diff --git a/doc/pipeline-details.md b/doc/pipeline-details.md index 88ccb0b79..3b9c9535e 100644 --- a/doc/pipeline-details.md +++ b/doc/pipeline-details.md @@ -74,7 +74,7 @@ Each environment needs to have its own API token set up locally to be able to su ### Timeout -The timeout service periodically checks all nodes' state. If a node is not in "done" state, then it checks whether the maximum wait time (timeout) is over. If so, it sets the node and all its child nodes to "done" state. +The timeout-task service periodically checks all nodes' state. If a node is not in "done" state, then it checks whether the maximum wait time (timeout) is over. If so, it sets the node and all its child nodes to "done" state. If the node is in "available" state and not timed-out, it will check for holdoff time. If the holdoff reached, and all its child nodes are completed, the node state will be moved to "done", otherwise the state will be set to "closing". The parent node with "closing" state can not have any new child nodes. This will generate pub/sub event of node update. diff --git a/docker-compose.yaml b/docker-compose.yaml index ba17d85c6..a3e81d1bd 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -176,7 +176,7 @@ services: extra_hosts: - "host.docker.internal:host-gateway" - timeout: + timeout-task: <<: *base-service container_name: 'kernelci-pipeline-timeout' command: @@ -189,7 +189,7 @@ services: extra_hosts: - "host.docker.internal:host-gateway" - timeout-closing: + timeout-task-closing: <<: *base-service container_name: 'kernelci-pipeline-closing' command: @@ -202,7 +202,7 @@ services: extra_hosts: - "host.docker.internal:host-gateway" - timeout-holdoff: + timeout-task-holdoff: <<: *base-service container_name: 'kernelci-pipeline-holdoff' command: diff --git a/kube/aks/nodehandlers.yaml b/kube/aks/nodehandlers.yaml index 36c14b598..f5ff97cb3 100644 --- a/kube/aks/nodehandlers.yaml +++ b/kube/aks/nodehandlers.yaml @@ -20,7 +20,7 @@ spec: app: timeout spec: containers: - - name: timeout + - name: timeout-task image: kernelci/kernelci:pipeline@sha256:bb01424c4dedcd2ffa87cef225b09116cf874bc2b91fc63ed6d993d6fc5c43cb imagePullPolicy: Always command: @@ -68,7 +68,7 @@ spec: app: closing spec: containers: - - name: timeout + - name: timeout-task image: kernelci/kernelci:pipeline@sha256:bb01424c4dedcd2ffa87cef225b09116cf874bc2b91fc63ed6d993d6fc5c43cb imagePullPolicy: Always command: @@ -112,7 +112,7 @@ spec: app: holdoff spec: containers: - - name: timeout + - name: timeout-task image: kernelci/kernelci:pipeline@sha256:bb01424c4dedcd2ffa87cef225b09116cf874bc2b91fc63ed6d993d6fc5c43cb imagePullPolicy: Always command: diff --git a/kube/minikube/deployments/timeout-closing-deployment.yaml b/kube/minikube/deployments/timeout-closing-deployment.yaml index 6d1cc2000..f2a5fc0ee 100644 --- a/kube/minikube/deployments/timeout-closing-deployment.yaml +++ b/kube/minikube/deployments/timeout-closing-deployment.yaml @@ -6,19 +6,19 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: kernelci-pipeline-timeout-closing + name: kernelci-pipeline-timeout-task-closing spec: replicas: 1 selector: matchLabels: - app: kernelci-pipeline-timeout-closing + app: kernelci-pipeline-timeout-task-closing template: metadata: labels: - app: kernelci-pipeline-timeout-closing + app: kernelci-pipeline-timeout-task-closing spec: containers: - - name: kernelci-pipeline-timeout-closing + - name: kernelci-pipeline-timeout-task-closing image: kernelci/staging-kernelci env: - name: KCI_API_TOKEN diff --git a/kube/minikube/deployments/timeout-holdoff-deployment.yaml b/kube/minikube/deployments/timeout-holdoff-deployment.yaml index 75215e189..75eb55b56 100644 --- a/kube/minikube/deployments/timeout-holdoff-deployment.yaml +++ b/kube/minikube/deployments/timeout-holdoff-deployment.yaml @@ -1,19 +1,19 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: kernelci-pipeline-timeout-holdoff + name: kernelci-pipeline-timeout-task-holdoff spec: replicas: 1 selector: matchLabels: - app: kernelci-pipeline-timeout-holdoff + app: kernelci-pipeline-timeout-task-holdoff template: metadata: labels: - app: kernelci-pipeline-timeout-holdoff + app: kernelci-pipeline-timeout-task-holdoff spec: containers: - - name: kernelci-pipeline-timeout-holdoff + - name: kernelci-pipeline-timeout-task-holdoff image: kernelci/staging-kernelci env: - name: KCI_API_TOKEN diff --git a/src/timeout.py b/src/timeout.py index 96a751119..06d104cfd 100755 --- a/src/timeout.py +++ b/src/timeout.py @@ -104,7 +104,7 @@ def _submit_lapsed_nodes(self, lapsed_nodes, state, mode): class Timeout(TimeoutService): def __init__(self, configs, args): - super().__init__(configs, args, 'timeout') + super().__init__(configs, args, 'timeout-task') def _check_pending_nodes(self, pending_nodes): timeout_nodes = {} @@ -131,7 +131,7 @@ def _run(self, ctx): class Holdoff(TimeoutService): def __init__(self, configs, args): - super().__init__(configs, args, 'timeout-holdoff') + super().__init__(configs, args, 'timeout-task-holdoff') def _get_available_nodes(self): nodes = self._api.node.find({ @@ -176,7 +176,7 @@ def _run(self, ctx): class Closing(TimeoutService): def __init__(self, configs, args): - super().__init__(configs, args, 'timeout-closing') + super().__init__(configs, args, 'timeout-task-closing') def _get_closing_nodes(self): nodes = self._api.node.find({'state': 'closing'}) From b785b56a1e287c4666ba431aacb5ce82925b3ef8 Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 15:55:08 +0200 Subject: [PATCH 03/11] Refactor: make use of shebang in python scripts Signed-off-by: Simone Tollardo --- docker-compose-kcidb.yaml | 2 -- docker-compose-lava.yaml | 4 +--- docker-compose.yaml | 20 +++++--------------- src/lava_callback.py | 2 ++ 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/docker-compose-kcidb.yaml b/docker-compose-kcidb.yaml index 6e468357c..519b5d4a0 100644 --- a/docker-compose-kcidb.yaml +++ b/docker-compose-kcidb.yaml @@ -14,8 +14,6 @@ services: stop_signal: 'SIGINT' networks: ['kcidb'] command: - - '/usr/bin/env' - - 'python3' - './src/send_kcidb.py' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' diff --git a/docker-compose-lava.yaml b/docker-compose-lava.yaml index 8c7e9d23a..da49712b5 100644 --- a/docker-compose-lava.yaml +++ b/docker-compose-lava.yaml @@ -15,9 +15,7 @@ services: - '${LAVA_CALLBACK_PORT:-8100}:8000' # With Werkzeug development server, not suitable for a public instance command: - - '/usr/bin/env' - - 'python3' - - '/home/kernelci/pipeline/lava_callback.py' + - './src/lava_callback.py' volumes: - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' diff --git a/docker-compose.yaml b/docker-compose.yaml index a3e81d1bd..a29e5ded2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -156,9 +156,7 @@ services: <<: *base-service container_name: 'kernelci-pipeline-regression_tracker' command: - - '/usr/bin/env' - - 'python3' - - '/home/kernelci/pipeline/src/regression_tracker.py' + - './src/regression_tracker.py' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' extra_hosts: @@ -168,9 +166,7 @@ services: <<: *base-service container_name: 'kernelci-pipeline-test_report' command: - - '/usr/bin/env' - - 'python3' - - '/home/kernelci/pipeline/src/test_report.py' + - './src/test_report.py' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'loop' extra_hosts: @@ -180,9 +176,7 @@ services: <<: *base-service container_name: 'kernelci-pipeline-timeout' command: - - '/usr/bin/env' - - 'python3' - - '/home/kernelci/pipeline/src/timeout.py' + - './src/timeout.py' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--mode=timeout' @@ -193,9 +187,7 @@ services: <<: *base-service container_name: 'kernelci-pipeline-closing' command: - - '/usr/bin/env' - - 'python3' - - '/home/kernelci/pipeline/src/timeout.py' + - './src/timeout.py' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--mode=closing' @@ -206,9 +198,7 @@ services: <<: *base-service container_name: 'kernelci-pipeline-holdoff' command: - - '/usr/bin/env' - - 'python3' - - '/home/kernelci/pipeline/src/timeout.py' + - './src/timeout.py' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--mode=holdoff' diff --git a/src/lava_callback.py b/src/lava_callback.py index 792925022..fe25345f9 100755 --- a/src/lava_callback.py +++ b/src/lava_callback.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # SPDX-License-Identifier: LGPL-2.1-or-later # # Copyright (C) 2023-2025 Collabora Limited From 9ff16abbb8a024ba5d300f8fecd5dbbb4d209b90 Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 15:58:20 +0200 Subject: [PATCH 04/11] Fix: fix wrong config path for pipeline services Signed-off-by: Simone Tollardo --- docker-compose.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index a29e5ded2..d106e5254 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,6 +15,7 @@ services: stop_signal: 'SIGINT' command: - './src/monitor.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' volumes: &base-volumes @@ -32,6 +33,7 @@ services: stop_signal: 'SIGINT' entrypoint: - './src/result_summary.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--config=${CONFIG:-/home/kernelci/config/result-summary.yaml}' @@ -49,6 +51,7 @@ services: stop_signal: 'SIGINT' command: - './src/scheduler.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'loop' - '--runtimes=shell' @@ -72,6 +75,7 @@ services: #working_dir: /home/kernelci command: - './src/scheduler.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'loop' - '--runtimes=docker' @@ -91,6 +95,7 @@ services: container_name: 'kernelci-pipeline-scheduler-lava' command: - './src/scheduler.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'loop' - '--name=scheduler_lava' @@ -113,6 +118,7 @@ services: image: 'kernelci/staging-kernelci:pipeline' command: - './src/scheduler.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'loop' - '--name=scheduler_k8s' @@ -127,6 +133,7 @@ services: container_name: 'kernelci-pipeline-tarball' command: - './src/tarball.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--name=tarball' @@ -145,6 +152,7 @@ services: container_name: 'kernelci-pipeline-trigger' command: - './src/trigger.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--trees=kernelci,netdev-testing' @@ -157,6 +165,7 @@ services: container_name: 'kernelci-pipeline-regression_tracker' command: - './src/regression_tracker.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' extra_hosts: @@ -167,6 +176,7 @@ services: container_name: 'kernelci-pipeline-test_report' command: - './src/test_report.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'loop' extra_hosts: @@ -177,6 +187,7 @@ services: container_name: 'kernelci-pipeline-timeout' command: - './src/timeout.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--mode=timeout' @@ -188,6 +199,7 @@ services: container_name: 'kernelci-pipeline-closing' command: - './src/timeout.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--mode=closing' @@ -199,6 +211,7 @@ services: container_name: 'kernelci-pipeline-holdoff' command: - './src/timeout.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--mode=holdoff' @@ -210,6 +223,7 @@ services: container_name: 'kernelci-pipeline-patchset' command: - './src/patchset.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'run' - '--name=patchset' From beefb808586633ac26365d6b98c83243149d1ebd Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 16:00:15 +0200 Subject: [PATCH 05/11] Fix: add missing image specifier in 'lava-callback' and 'kcidb' services, remove useless volume mount Signed-off-by: Simone Tollardo --- docker-compose-lava.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose-lava.yaml b/docker-compose-lava.yaml index da49712b5..dffd1ea49 100644 --- a/docker-compose-lava.yaml +++ b/docker-compose-lava.yaml @@ -10,6 +10,7 @@ services: lava-callback: container_name: 'kernelci-pipeline-lava-callback' networks: ['lava-callback'] + image: 'kernelci/staging-kernelci:lava-callback' env_file: ['.env'] ports: - '${LAVA_CALLBACK_PORT:-8100}:8000' @@ -17,7 +18,7 @@ services: command: - './src/lava_callback.py' volumes: - - './src:/home/kernelci/pipeline' +# - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' - './data/ssh:/home/kernelci/data/ssh' restart: on-failure From d3cceeca54c543b21131e8004eba85f2ad7d146e Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 16:01:05 +0200 Subject: [PATCH 06/11] Docs: update docs with latest lava scheduler example Signed-off-by: Simone Tollardo --- doc/connecting-lab.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/connecting-lab.md b/doc/connecting-lab.md index 27dad46ac..c6ce09dfc 100644 --- a/doc/connecting-lab.md +++ b/doc/connecting-lab.md @@ -75,7 +75,7 @@ runtime_token="N0tAS3creTT0k3n" ### `docker-compose` file We are running all the pipeline services as docker containers. -You need to provide lab name to `--runtimes` argument to the [`scheduler-lava`](https://github.com/kernelci/kernelci-pipeline/blob/main/docker-compose.yaml#L80) +You need to provide lab name to `--runtimes` argument to the [`scheduler-lava`](https://github.com/kernelci/kernelci-pipeline/blob/main/docker-compose.yaml#L93) service in the `docker-compose.yml` file to enable the lab. For example, the following configuration adds the `lava-broonie` lab along with other labs: @@ -84,13 +84,17 @@ scheduler-lava: <<: *scheduler container_name: 'kernelci-pipeline-scheduler-lava' command: - - './pipeline/scheduler.py' + - './src/scheduler.py' + - '--yaml-config=/home/kernelci/config' - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - 'loop' + - '--name=scheduler_lava' - '--runtimes' - 'lava-collabora' - 'lava-collabora-staging' - 'lava-broonie' + extra_hosts: + - "host.docker.internal:host-gateway" ``` ### Jobs and devices specific to the lab From 82f282bed19bc4942449160f44ff6c0eeec70adb Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 17:27:13 +0200 Subject: [PATCH 07/11] Refactor: move all pipeline service to a single compose file Signed-off-by: Simone Tollardo --- callback-requirements.txt | 4 ---- docker-compose-kcidb.yaml | 37 ------------------------------------- docker-compose-lava.yaml | 28 ---------------------------- docker-compose.yaml | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 69 deletions(-) delete mode 100644 callback-requirements.txt delete mode 100644 docker-compose-kcidb.yaml delete mode 100644 docker-compose-lava.yaml diff --git a/callback-requirements.txt b/callback-requirements.txt deleted file mode 100644 index 0ede9cef3..000000000 --- a/callback-requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -uwsgi==2.0.22 -uvicorn==0.30.1 -fastapi==0.111.0 -pyjwt==2.8.0 diff --git a/docker-compose-kcidb.yaml b/docker-compose-kcidb.yaml deleted file mode 100644 index 519b5d4a0..000000000 --- a/docker-compose-kcidb.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -# -# Copyright (C) 2023 Collabora Limited -# Author: Guillaume Tucker - -version: '3' - -services: - - kcidb: - container_name: 'kernelci-pipeline-kcidb' - image: 'kernelci/staging-kernelci:pipeline' - env_file: ['.env'] - stop_signal: 'SIGINT' - networks: ['kcidb'] - command: - - './src/send_kcidb.py' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' - - 'run' - - '--name=pipeline_kcidb' - volumes: - - './config:/home/kernelci/config' - - './data/kcidb:/home/kernelci/data/kcidb' - - './logs:/home/kernelci/logs' - restart: on-failure - postgres: - container_name: 'kernelci-pipeline-postgres-proxy' - image: 'gcr.io/cloud-sql-connectors/cloud-sql-proxy:latest' - command: 'kernelci-production:us-central1:postgresql2 -c/home/kernelci/data/kcidb/kernelci-production-ci-kernelci.json -a0.0.0.0' - networks: ['kcidb'] - volumes: - - './data/kcidb:/home/kernelci/data/kcidb' - restart: on-failure - -networks: - kcidb: - driver: bridge diff --git a/docker-compose-lava.yaml b/docker-compose-lava.yaml deleted file mode 100644 index dffd1ea49..000000000 --- a/docker-compose-lava.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -# -# Copyright (C) 2023 Collabora Limited -# Author: Guillaume Tucker - -version: '3' - -services: - - lava-callback: - container_name: 'kernelci-pipeline-lava-callback' - networks: ['lava-callback'] - image: 'kernelci/staging-kernelci:lava-callback' - env_file: ['.env'] - ports: - - '${LAVA_CALLBACK_PORT:-8100}:8000' - # With Werkzeug development server, not suitable for a public instance - command: - - './src/lava_callback.py' - volumes: -# - './src:/home/kernelci/pipeline' - - './config:/home/kernelci/config' - - './data/ssh:/home/kernelci/data/ssh' - restart: on-failure - -networks: - lava-callback: - driver: bridge diff --git a/docker-compose.yaml b/docker-compose.yaml index d106e5254..b4fbab511 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -234,3 +234,41 @@ services: - './data/src:/home/kernelci/data/src' - './data/output:/home/kernelci/data/output' - './logs:/home/kernelci/logs' + + lava-callback: + <<: *base-service + container_name: 'kernelci-pipeline-lava-callback' + image: 'kernelci/staging-kernelci:lava-callback' + ports: + - '${LAVA_CALLBACK_PORT:-8100}:8000' + # With Werkzeug development server, not suitable for a public instance + command: + - './src/lava_callback.py' + volumes: +# - './src:/home/kernelci/pipeline' + - './config:/home/kernelci/config' + - './data/ssh:/home/kernelci/data/ssh' + + kcidb: + <<: *base-service + container_name: 'kernelci-pipeline-kcidb' + command: + - './src/send_kcidb.py' + - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - 'run' + - '--name=pipeline_kcidb' + volumes: +# - './src:/home/kernelci/pipeline' + - './config:/home/kernelci/config' + - './data/kcidb:/home/kernelci/data/kcidb' + - './logs:/home/kernelci/logs' + + postgres: + container_name: 'kernelci-pipeline-postgres-proxy' + image: 'gcr.io/cloud-sql-connectors/cloud-sql-proxy:latest' + command: + - 'kernelci-production:us-central1:postgresql2' + - '-c/home/kernelci/data/kcidb/kernelci-production-ci-kernelci.json' + - '-a0.0.0.0' + volumes: + - './data/kcidb:/home/kernelci/data/kcidb' From f6dbed0f5fb06471584608add32027f5aa2d4db5 Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 17:29:06 +0200 Subject: [PATCH 08/11] Fix: remove deprecated 'version' in compose files Signed-off-by: Simone Tollardo --- docker-compose-production.yaml | 2 -- docker-compose.yaml | 2 -- 2 files changed, 4 deletions(-) diff --git a/docker-compose-production.yaml b/docker-compose-production.yaml index 5cd0bc350..27a41a87e 100644 --- a/docker-compose-production.yaml +++ b/docker-compose-production.yaml @@ -3,8 +3,6 @@ # Copyright (C) 2023 Collabora Limited # Author: Guillaume Tucker -version: '3' - services: lava-callback: diff --git a/docker-compose.yaml b/docker-compose.yaml index b4fbab511..e122ff69b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,8 +4,6 @@ # Author: Guillaume Tucker # Author: Jeny Sadadia -version: '3' - services: monitor: &base-service From 6e9f15d9738d72cf750c9ae83735a3e340b54d4f Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 18:40:50 +0200 Subject: [PATCH 09/11] Refactor: improve compose readability Signed-off-by: Simone Tollardo --- docker-compose.yaml | 112 +++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 70 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index e122ff69b..6ccd93974 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,6 +4,12 @@ # Author: Guillaume Tucker # Author: Jeny Sadadia +x-config-arg: &config-arg + --yaml-config=/home/kernelci/config + +x-setting-arg: &setting-arg + --settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml} + services: monitor: &base-service @@ -13,11 +19,10 @@ services: stop_signal: 'SIGINT' command: - './src/monitor.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - volumes: &base-volumes -# - './src:/home/kernelci/pipeline' + volumes: - './config:/home/kernelci/config' - './logs:/home/kernelci/logs' extra_hosts: @@ -25,46 +30,36 @@ services: restart: on-failure result_summary: + <<: *base-service container_name: 'kernelci-pipeline-result-summary' - image: 'kernelci/staging-kernelci:pipeline' - env_file: ['.env'] - stop_signal: 'SIGINT' - entrypoint: + command: - './src/result_summary.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - '--config=${CONFIG:-/home/kernelci/config/result-summary.yaml}' volumes: -# - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' - './data/output:/home/kernelci/data/output' - './logs:/home/kernelci/logs' - #restart: on-failure scheduler: &scheduler + <<: *base-service container_name: 'kernelci-pipeline-scheduler' - image: 'kernelci/staging-kernelci:pipeline' - env_file: ['.env'] - stop_signal: 'SIGINT' command: - './src/scheduler.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'loop' - '--runtimes=shell' - '--name=scheduler' volumes: -# - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' - './data/output:/home/kernelci/data/output' - './data/k8s-credentials/.kube:/home/kernelci/.kube' - './data/k8s-credentials/.config/gcloud:/home/kernelci/.config/gcloud' - './data/k8s-credentials/.azure:/home/kernelci/.azure' - './logs:/home/kernelci/logs' - extra_hosts: - - "host.docker.internal:host-gateway" - restart: on-failure scheduler-docker: <<: *scheduler @@ -73,28 +68,25 @@ services: #working_dir: /home/kernelci command: - './src/scheduler.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'loop' - '--runtimes=docker' - '--name=scheduler_docker' volumes: -# - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' - './data/output:/home/kernelci/data/output' - './.docker-env:/home/kernelci/.docker-env' - '/var/run/docker.sock:/var/run/docker.sock' # Docker-in-Docker - './logs:/home/kernelci/logs' - extra_hosts: - - "host.docker.internal:host-gateway" scheduler-lava: <<: *scheduler container_name: 'kernelci-pipeline-scheduler-lava' command: - './src/scheduler.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'loop' - '--name=scheduler_lava' - '--runtimes' @@ -107,126 +99,105 @@ services: - 'lava-cip' - 'lava-pengutronix' - 'lava-kontron' - extra_hosts: - - "host.docker.internal:host-gateway" scheduler-k8s: <<: *scheduler container_name: 'kernelci-pipeline-scheduler-k8s' - image: 'kernelci/staging-kernelci:pipeline' command: - './src/scheduler.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'loop' - '--name=scheduler_k8s' - '--runtimes' - 'k8s-gke-eu-west4' - 'k8s-all' - extra_hosts: - - "host.docker.internal:host-gateway" tarball: <<: *base-service container_name: 'kernelci-pipeline-tarball' command: - './src/tarball.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - '--name=tarball' volumes: -# - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' - './data/ssh:/home/kernelci/data/ssh' - './data/src:/home/kernelci/data/src' - './data/output:/home/kernelci/data/output' - './logs:/home/kernelci/logs' - extra_hosts: - - "host.docker.internal:host-gateway" trigger: <<: *base-service container_name: 'kernelci-pipeline-trigger' command: - './src/trigger.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - '--trees=kernelci,netdev-testing' - '--name=trigger' - extra_hosts: - - "host.docker.internal:host-gateway" regression_tracker: <<: *base-service container_name: 'kernelci-pipeline-regression_tracker' command: - './src/regression_tracker.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - extra_hosts: - - "host.docker.internal:host-gateway" test_report: <<: *base-service container_name: 'kernelci-pipeline-test_report' command: - './src/test_report.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'loop' - extra_hosts: - - "host.docker.internal:host-gateway" timeout-task: <<: *base-service container_name: 'kernelci-pipeline-timeout' command: - './src/timeout.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - '--mode=timeout' - extra_hosts: - - "host.docker.internal:host-gateway" timeout-task-closing: <<: *base-service container_name: 'kernelci-pipeline-closing' command: - './src/timeout.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - '--mode=closing' - extra_hosts: - - "host.docker.internal:host-gateway" timeout-task-holdoff: <<: *base-service container_name: 'kernelci-pipeline-holdoff' command: - './src/timeout.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - '--mode=holdoff' - extra_hosts: - - "host.docker.internal:host-gateway" patchset: <<: *base-service container_name: 'kernelci-pipeline-patchset' command: - './src/patchset.py' - - '--yaml-config=/home/kernelci/config' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - '--name=patchset' volumes: -# - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' - './data/ssh:/home/kernelci/data/ssh' - './data/src:/home/kernelci/data/src' @@ -242,8 +213,9 @@ services: # With Werkzeug development server, not suitable for a public instance command: - './src/lava_callback.py' + - *config-arg + - *setting-arg volumes: -# - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' - './data/ssh:/home/kernelci/data/ssh' @@ -252,11 +224,11 @@ services: container_name: 'kernelci-pipeline-kcidb' command: - './src/send_kcidb.py' - - '--settings=${KCI_SETTINGS:-/home/kernelci/config/kernelci.toml}' + - *config-arg + - *setting-arg - 'run' - '--name=pipeline_kcidb' volumes: -# - './src:/home/kernelci/pipeline' - './config:/home/kernelci/config' - './data/kcidb:/home/kernelci/data/kcidb' - './logs:/home/kernelci/logs' From 5f0ecd885947c3df9bb70fb946148bbcdf9e2e84 Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 18:50:47 +0200 Subject: [PATCH 10/11] Revert "Fix: rename 'timeout' containers to 'timeout_task' to avoid conflicts with docker keyword" This reverts commit 5030564c7bd04a3c02881455991c2b6fce9e27df. Signed-off-by: Simone Tollardo --- config/logger.conf | 18 +++++++++--------- doc/pipeline-details.md | 2 +- docker-compose.yaml | 6 +++--- kube/aks/nodehandlers.yaml | 6 +++--- .../timeout-closing-deployment.yaml | 8 ++++---- .../timeout-holdoff-deployment.yaml | 8 ++++---- src/timeout.py | 6 +++--- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/config/logger.conf b/config/logger.conf index 4a30cf137..3b51d3d11 100644 --- a/config/logger.conf +++ b/config/logger.conf @@ -16,9 +16,9 @@ keys=root, send_kcidb, tarball, test_report, - timeout-task, - timeout-task-closing, - timeout-task-holdoff, + timeout, + timeout-closing, + timeout-holdoff, trigger [handlers] @@ -113,22 +113,22 @@ handlers=consoleHandler, timedRotatingHandler qualname=test_report propagate=0 -[logger_timeout-task] +[logger_timeout] level=DEBUG handlers=consoleHandler, timedRotatingHandler -qualname=timeout-task +qualname=timeout propagate=0 -[logger_timeout-task-closing] +[logger_timeout-closing] level=DEBUG handlers=consoleHandler, timedRotatingHandler -qualname=timeout-task-closing +qualname=timeout-closing propagate=0 -[logger_timeout-task-holdoff] +[logger_timeout-holdoff] level=DEBUG handlers=consoleHandler, timedRotatingHandler -qualname=timeout-task-holdoff +qualname=timeout-holdoff propagate=0 [logger_trigger] diff --git a/doc/pipeline-details.md b/doc/pipeline-details.md index 3b9c9535e..88ccb0b79 100644 --- a/doc/pipeline-details.md +++ b/doc/pipeline-details.md @@ -74,7 +74,7 @@ Each environment needs to have its own API token set up locally to be able to su ### Timeout -The timeout-task service periodically checks all nodes' state. If a node is not in "done" state, then it checks whether the maximum wait time (timeout) is over. If so, it sets the node and all its child nodes to "done" state. +The timeout service periodically checks all nodes' state. If a node is not in "done" state, then it checks whether the maximum wait time (timeout) is over. If so, it sets the node and all its child nodes to "done" state. If the node is in "available" state and not timed-out, it will check for holdoff time. If the holdoff reached, and all its child nodes are completed, the node state will be moved to "done", otherwise the state will be set to "closing". The parent node with "closing" state can not have any new child nodes. This will generate pub/sub event of node update. diff --git a/docker-compose.yaml b/docker-compose.yaml index 6ccd93974..e295f5cb3 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -158,7 +158,7 @@ services: - *setting-arg - 'loop' - timeout-task: + timeout: <<: *base-service container_name: 'kernelci-pipeline-timeout' command: @@ -168,7 +168,7 @@ services: - 'run' - '--mode=timeout' - timeout-task-closing: + timeout-closing: <<: *base-service container_name: 'kernelci-pipeline-closing' command: @@ -178,7 +178,7 @@ services: - 'run' - '--mode=closing' - timeout-task-holdoff: + timeout-holdoff: <<: *base-service container_name: 'kernelci-pipeline-holdoff' command: diff --git a/kube/aks/nodehandlers.yaml b/kube/aks/nodehandlers.yaml index f5ff97cb3..36c14b598 100644 --- a/kube/aks/nodehandlers.yaml +++ b/kube/aks/nodehandlers.yaml @@ -20,7 +20,7 @@ spec: app: timeout spec: containers: - - name: timeout-task + - name: timeout image: kernelci/kernelci:pipeline@sha256:bb01424c4dedcd2ffa87cef225b09116cf874bc2b91fc63ed6d993d6fc5c43cb imagePullPolicy: Always command: @@ -68,7 +68,7 @@ spec: app: closing spec: containers: - - name: timeout-task + - name: timeout image: kernelci/kernelci:pipeline@sha256:bb01424c4dedcd2ffa87cef225b09116cf874bc2b91fc63ed6d993d6fc5c43cb imagePullPolicy: Always command: @@ -112,7 +112,7 @@ spec: app: holdoff spec: containers: - - name: timeout-task + - name: timeout image: kernelci/kernelci:pipeline@sha256:bb01424c4dedcd2ffa87cef225b09116cf874bc2b91fc63ed6d993d6fc5c43cb imagePullPolicy: Always command: diff --git a/kube/minikube/deployments/timeout-closing-deployment.yaml b/kube/minikube/deployments/timeout-closing-deployment.yaml index f2a5fc0ee..6d1cc2000 100644 --- a/kube/minikube/deployments/timeout-closing-deployment.yaml +++ b/kube/minikube/deployments/timeout-closing-deployment.yaml @@ -6,19 +6,19 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: kernelci-pipeline-timeout-task-closing + name: kernelci-pipeline-timeout-closing spec: replicas: 1 selector: matchLabels: - app: kernelci-pipeline-timeout-task-closing + app: kernelci-pipeline-timeout-closing template: metadata: labels: - app: kernelci-pipeline-timeout-task-closing + app: kernelci-pipeline-timeout-closing spec: containers: - - name: kernelci-pipeline-timeout-task-closing + - name: kernelci-pipeline-timeout-closing image: kernelci/staging-kernelci env: - name: KCI_API_TOKEN diff --git a/kube/minikube/deployments/timeout-holdoff-deployment.yaml b/kube/minikube/deployments/timeout-holdoff-deployment.yaml index 75eb55b56..75215e189 100644 --- a/kube/minikube/deployments/timeout-holdoff-deployment.yaml +++ b/kube/minikube/deployments/timeout-holdoff-deployment.yaml @@ -1,19 +1,19 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: kernelci-pipeline-timeout-task-holdoff + name: kernelci-pipeline-timeout-holdoff spec: replicas: 1 selector: matchLabels: - app: kernelci-pipeline-timeout-task-holdoff + app: kernelci-pipeline-timeout-holdoff template: metadata: labels: - app: kernelci-pipeline-timeout-task-holdoff + app: kernelci-pipeline-timeout-holdoff spec: containers: - - name: kernelci-pipeline-timeout-task-holdoff + - name: kernelci-pipeline-timeout-holdoff image: kernelci/staging-kernelci env: - name: KCI_API_TOKEN diff --git a/src/timeout.py b/src/timeout.py index 06d104cfd..96a751119 100755 --- a/src/timeout.py +++ b/src/timeout.py @@ -104,7 +104,7 @@ def _submit_lapsed_nodes(self, lapsed_nodes, state, mode): class Timeout(TimeoutService): def __init__(self, configs, args): - super().__init__(configs, args, 'timeout-task') + super().__init__(configs, args, 'timeout') def _check_pending_nodes(self, pending_nodes): timeout_nodes = {} @@ -131,7 +131,7 @@ def _run(self, ctx): class Holdoff(TimeoutService): def __init__(self, configs, args): - super().__init__(configs, args, 'timeout-task-holdoff') + super().__init__(configs, args, 'timeout-holdoff') def _get_available_nodes(self): nodes = self._api.node.find({ @@ -176,7 +176,7 @@ def _run(self, ctx): class Closing(TimeoutService): def __init__(self, configs, args): - super().__init__(configs, args, 'timeout-task-closing') + super().__init__(configs, args, 'timeout-closing') def _get_closing_nodes(self): nodes = self._api.node.find({'state': 'closing'}) From fc674bb8efba257daabf23dc7764be3bd413e894 Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Wed, 14 May 2025 18:48:20 +0200 Subject: [PATCH 11/11] Replace docker subnet ip with docker gateway hostname Signed-off-by: Simone Tollardo --- config/pipeline.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/pipeline.yaml b/config/pipeline.yaml index 16dd246ad..65b92b0da 100644 --- a/config/pipeline.yaml +++ b/config/pipeline.yaml @@ -6,7 +6,7 @@ api: docker-host: - url: http://172.17.0.1:8001 + url: http://host.docker.internal:8001 staging: url: https://staging.kernelci.org:9000 @@ -22,9 +22,9 @@ storage: docker-host: storage_type: ssh - host: 172.17.0.1 + host: host.docker.internal port: 8022 - base_url: http://172.17.0.1:8002/ + base_url: http://host.docker.internal:8002/ production-azure: &azure-files storage_type: azure