From 28524b0f38d85a2c6a301b112783a1ea1b12daab Mon Sep 17 00:00:00 2001 From: Kavitha Ramalingam Date: Mon, 21 Oct 2024 21:13:46 +0530 Subject: [PATCH] GNOI Cold Reboot --- azure-pipelines.yml | 32 +++++++------- dockers/docker-framework/Dockerfile.j2 | 34 ++++++++++++++ dockers/docker-framework/framework.sh | 4 ++ dockers/docker-framework/start.sh | 5 +++ dockers/docker-framework/supervisord.conf | 54 +++++++++++++++++++++++ 5 files changed, 113 insertions(+), 16 deletions(-) create mode 100644 dockers/docker-framework/Dockerfile.j2 create mode 100755 dockers/docker-framework/framework.sh create mode 100755 dockers/docker-framework/start.sh create mode 100644 dockers/docker-framework/supervisord.conf diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b72aa967cc2e..3956a7c94448 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -295,22 +295,22 @@ stages: MGMT_BRANCH: $(BUILD_BRANCH) TEST_SET: onboarding_t1 - - job: onboarding_elastictest_dualtor - displayName: "onboarding dualtor testcases by Elastictest - optional" - timeoutInMinutes: 240 - continueOnError: true - pool: sonic-ubuntu-1c - steps: - - template: .azure-pipelines/run-test-elastictest-template.yml@sonic-mgmt - parameters: - TOPOLOGY: dualtor - STOP_ON_FAILURE: "False" - RETRY_TIMES: 0 - MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM) - MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM) - KVM_IMAGE_BRANCH: $(BUILD_BRANCH) - MGMT_BRANCH: $(BUILD_BRANCH) - TEST_SET: onboarding_dualtor +# - job: onboarding_elastictest_dualtor +# displayName: "onboarding dualtor testcases by Elastictest - optional" +# timeoutInMinutes: 240 +# continueOnError: true +# pool: sonic-ubuntu-1c +# steps: +# - template: .azure-pipelines/run-test-elastictest-template.yml@sonic-mgmt +# parameters: +# TOPOLOGY: dualtor +# STOP_ON_FAILURE: "False" +# RETRY_TIMES: 0 +# MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM) +# MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM) +# KVM_IMAGE_BRANCH: $(BUILD_BRANCH) +# MGMT_BRANCH: $(BUILD_BRANCH) +# TEST_SET: onboarding_dualtor # - job: wan_elastictest # displayName: "kvmtest-wan by Elastictest" diff --git a/dockers/docker-framework/Dockerfile.j2 b/dockers/docker-framework/Dockerfile.j2 new file mode 100644 index 000000000000..c9c71d402e84 --- /dev/null +++ b/dockers/docker-framework/Dockerfile.j2 @@ -0,0 +1,34 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} + +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -f -y \ + libdbus-1-3 \ + libdbus-c++-1-0v5 + +{% if docker_framework_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_framework_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_framework_debs.split(' ')) }} +{%- endif %} + +RUN apt-get clean -y && \ + apt-get autoclean - && \ + apt-get autoremove -y && \ + rm -rf /debs /var/lib/apt/lists/* /tmp/* ~/.cache/ + +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] +# COPY ["git_commits", "/usr"] + + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-framework/framework.sh b/dockers/docker-framework/framework.sh new file mode 100755 index 000000000000..68e72417fd2a --- /dev/null +++ b/dockers/docker-framework/framework.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + + +exec /usr/local/bin/framework --logtostderr diff --git a/dockers/docker-framework/start.sh b/dockers/docker-framework/start.sh new file mode 100755 index 000000000000..1235a4e5a671 --- /dev/null +++ b/dockers/docker-framework/start.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status diff --git a/dockers/docker-framework/supervisord.conf b/dockers/docker-framework/supervisord.conf new file mode 100644 index 000000000000..05ca0f4bc272 --- /dev/null +++ b/dockers/docker-framework/supervisord.conf @@ -0,0 +1,54 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +loglevel=warn +nodaemon=true + +[eventlistener:dependent-startup] +command=python3 -m supervisord_dependent_startup --log-level warn +autostart=true +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog +startretries=0 +exitcodes=0,3 +events=PROCESS_STATE +buffer_size=50 + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener --container-name framework +events=PROCESS_STATE_EXITED +autostart=true +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n -iNONE +priority=1 +autostart=false +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true + +[program:start] +command=/usr/bin/start.sh +priority=2 +autostart=false +autorestart=false +startsecs=0 +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running + +[program:rebootbackend] +command=/usr/bin/rebootbackend +priority=3 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=start:exited