Skip to content

Create GCU Container#25868

Draft
xincunli-sonic wants to merge 3 commits intosonic-net:masterfrom
xincunli-sonic:xincun/gcu-container
Draft

Create GCU Container#25868
xincunli-sonic wants to merge 3 commits intosonic-net:masterfrom
xincunli-sonic:xincun/gcu-container

Conversation

@xincunli-sonic
Copy link
Contributor

@xincunli-sonic xincunli-sonic commented Mar 4, 2026

Why I did it

Introduce a dedicated docker-gcu container that provisions GCU in an isolated
Python venv (/opt/gcu-venv) using --system-site-packages to reuse system C-extensions
(swsscommon, sonic-py-common) while keeping GCU and its Python deps independently
versioned and deployable without a full SONiC image rebuild.

Work item tracking
  • Microsoft ADO (number only):

How I did it

  • Added dockers/docker-gcu/ with Dockerfile.j2, supervisord.conf, docker-init.sh
  • Added rules/docker-gcu.mk gated on INCLUDE_GCU=y
  • Wheel artifact sourced from sonic-utilities submodule build (SONIC_GCU_PY3)

How to verify it

  1. Build: make target/docker-gcu.gz
  2. Run on a SONiC device and confirm supervisorctl status gcu-setup shows EXITED (0)
  3. Confirm supervisorctl status gcu-healthcheck shows EXITED (0)
  4. Confirm /opt/gcu-venv/bin/config apply-patch works with an empty patch

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

Signed-off-by: Xincun Li <stli@microsoft.com>
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@xincunli-sonic xincunli-sonic marked this pull request as draft March 4, 2026 01:28
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…and duplicate PACKAGE_NAME

- rules/docker-gcu.mk: replace _DEPENDS/_INSTALLS/_WHLS with _PYTHON_WHEELS
  so slave.mk correctly exports the docker_gcu_whls Jinja2 variable
- dockers/docker-gcu/Dockerfile.j2: fix docker_sonic_gcu_whls -> docker_gcu_whls
  (variable name is derived from container stem 'docker-gcu', not 'docker-sonic-gcu')
- src/gcu-watchdog/Cargo.toml: remove empty [lib] section that caused
  Cargo to look for src/lib.rs which does not exist
- rules/docker-gcu-watchdog.mk: remove duplicate _PACKAGE_NAME = gcu_watchdog
  (underscore form on line 21 was overridden by the hyphen form below)

Signed-off-by: Xincun Li <stli@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Two bugs caused 'COPY watchdog/ ./' to fail at docker build time:

1. Symlink vs real directory: Docker's COPY does not follow symlinks that
   point to absolute paths outside the build context root.  The previous
   'ln -sfn  ...' created such a symlink, so
   Docker reported '/watchdog: not found'.  Changed to 'cp -a' to place a
   real copy of the Rust source inside the build context.

2. Wrong Make target name: the prerequisite rule was attached to the bare
   target 'docker-gcu-watchdog.gz', but slave.mk's actual Docker image
   target is 'target/docker-gcu-watchdog.gz'.  These are distinct Make
   targets, so the copy rule never fired.  Changed to use
   \/\ which resolves to the correct
   prefixed path.

Also add dockers/docker-gcu-watchdog/.gitignore to exclude the generated
watchdog/ copy from git tracking.

Signed-off-by: Xincun Li <stli@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants