Skip to content

Conversation

nevermarine
Copy link
Collaborator

Description

import libs

Why do we need it, and what problem does it solve?

What is the expected result?

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: ci
type: chore
summary: import libs

@nevermarine nevermarine added this to the v1.2.0 milestone Oct 7, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 7, 2025

Reviewer's Guide

This PR reorganizes CI image definitions by refactoring import paths, standardizing shell install workflows, cleaning up package dependency lists, and enhancing build steps with stripping and updated component versions.

Class diagram for CI image dependency and import structure changes

classDiagram
  class CIImage {
    +altPackages: list
    +packages: list
    +binaries: list
    +import: list
    +shell: steps
  }
  class VirtLauncher {
    +altLibs: list
    +binaries: list
    +packages: list
    +import: list
    +shell: steps
  }
  class Libvirt {
    +altPackages: list
    +altLibraries: list
    +packages: list
    +import: list
    +shell: steps
  }
  class Glibc {
    +altPackages: list
    +packages: list
    +patches: list
    +import: list
    +shell: steps
  }
  CIImage <|-- VirtLauncher
  CIImage <|-- Libvirt
  CIImage <|-- Glibc
  VirtLauncher --> Libvirt : imports
  VirtLauncher --> CIImage : imports other packages
  Libvirt --> Glibc : imports
  CIImage --> Glibc : imports
  Glibc --> CIImage : used by other images
Loading

Class diagram for standardized shell install workflow

classDiagram
  class ShellWorkflow {
    +beforeInstall: steps
    +install: steps
    +stripBinaries: bool
    +treeOutput: bool
  }
  class CIImage {
    +shell: ShellWorkflow
  }
  CIImage --> ShellWorkflow
  ShellWorkflow : now includes stripping and tree output
  ShellWorkflow : install steps standardized across images
Loading

File-Level Changes

Change Details Files
Refactor image import paths and PackagePath usage
  • Switch import image references to include 'packages' subdirectories
  • Adjust 'add' and 'to' mappings in import sections
  • Rename images to use the new PackagePath prefix
images/virt-launcher/werf.inc.yaml
images/libvirt/werf.inc.yaml
images/packages/glibc/werf.inc.yaml
images/packages/fuse3/werf.inc.yaml
Standardize shell install blocks and Git workflows
  • Remove SSH config boilerplate and use direct git clone
  • Introduce 'alt packages proxy' includes and cleanup steps
  • Enable CGO_ENABLED for Go builds
images/virt-launcher/werf.inc.yaml
images/packages/glibc/werf.inc.yaml
images/dvcr-artifact/werf.inc.yaml
Clean up and unify package dependency lists
  • Move libraries from altLibraries to explicit packages lists
  • Remove '-devel' and static suffixes from many dependencies
  • Add common core libraries (glibc, util-linux) across images
images/virt-launcher/werf.inc.yaml
images/virt-handler/werf.inc.yaml
images/packages/*/werf.inc.yaml
Enhance build process with stripping and version updates
  • Add executable stripping loops and 'tree' output in build steps
  • Replace install-libvirt.sh with Ninja-based install flow
  • Update glibc component version to a commit hash in versions.yml
images/libvirt/werf.inc.yaml
build/components/versions.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@nevermarine nevermarine force-pushed the chore/ci/import-libs branch from 7e06620 to 4ff0ee4 Compare October 9, 2025 15:28
@Isteb4k Isteb4k modified the milestones: v1.2.0, v1.1.1 Oct 14, 2025
@nevermarine nevermarine added e2e/run Run e2e test on cluster of PR author e2e/user/nevermarine labels Oct 15, 2025
@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Oct 15, 2025
@nevermarine nevermarine modified the milestones: v1.1.1, v1.2.0 Oct 16, 2025
Comment on lines 203 to 205
rm -rf /BINS/var
rm -rf /BINS/etc/libvirt/qemu.conf
rm -rf /BINS/etc/libvirt/virtqemud.conf

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add cleaning of other unnecessary files like (it was in script install-libvirt.sh):

# $SRC_BASE/src/conf/schemas/storagepoolcaps.rng to /usr/share/libvirt/schemas
# $SRC_BASE/src/conf/schemas/storagepool.rng to /usr/share/libvirt/schemas
# $SRC_BASE/src/conf/schemas/storagevol.rng to /usr/share/libvirt/schemas

@nevermarine nevermarine added the e2e/run Run e2e test on cluster of PR author label Oct 23, 2025
@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Oct 23, 2025
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
Signed-off-by: Maksim Fedotov <[email protected]>
@nevermarine nevermarine marked this pull request as ready for review October 23, 2025 17:31
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `images/packages/glibc/werf.inc.yaml:49-53` </location>
<code_context>
-    mkdir -p ~/.ssh && echo "StrictHostKeyChecking accept-new" > ~/.ssh/config
+    git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --revision {{ $version }} /src
+    cd /src
+    for p in /patches/*.patch ; do
+      echo -n "Apply ${p} ... "
+      git apply --ignore-space-change --ignore-whitespace ${p} && echo OK || (echo FAIL ; exit 1)
+    done

</code_context>

<issue_to_address>
**suggestion:** Patch application does not check for empty patch directory.

If /patches contains no .patch files, the loop will run with a non-existent file, causing errors. Please add a check to ensure patch files exist before attempting to apply them.

```suggestion
    cd /src
    if ls /patches/*.patch 1> /dev/null 2>&1; then
      for p in /patches/*.patch ; do
        echo -n "Apply ${p} ... "
        git apply --ignore-space-change --ignore-whitespace ${p} && echo OK || (echo FAIL ; exit 1)
      done
    else
      echo "No patch files found in /patches, skipping patch application."
    fi
```
</issue_to_address>

### Comment 2
<location> `images/packages/libfuse3/werf.inc.yaml:64-68` </location>
<code_context>
   install:
   - |
+    # Install packages
+    PKGS="{{ $builderDependencies.packages | join " " }}"
+    for pkg in $PKGS; do
+      cp -a /$pkg/. /
+      rm -rf /$pkg
+    done
+
</code_context>

<issue_to_address>
**suggestion:** Package copy loop assumes all package directories exist.

Add a check to skip packages if their directories do not exist to prevent errors during copy and removal.

```suggestion
    PKGS="{{ $builderDependencies.packages | join " " }}"
    for pkg in $PKGS; do
      if [ -d "/$pkg" ]; then
        cp -a /$pkg/. /
        rm -rf /$pkg
      fi
    done
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +49 to +53
cd /src
for p in /patches/*.patch ; do
echo -n "Apply ${p} ... "
git apply --ignore-space-change --ignore-whitespace ${p} && echo OK || (echo FAIL ; exit 1)
done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Patch application does not check for empty patch directory.

If /patches contains no .patch files, the loop will run with a non-existent file, causing errors. Please add a check to ensure patch files exist before attempting to apply them.

Suggested change
cd /src
for p in /patches/*.patch ; do
echo -n "Apply ${p} ... "
git apply --ignore-space-change --ignore-whitespace ${p} && echo OK || (echo FAIL ; exit 1)
done
cd /src
if ls /patches/*.patch 1> /dev/null 2>&1; then
for p in /patches/*.patch ; do
echo -n "Apply ${p} ... "
git apply --ignore-space-change --ignore-whitespace ${p} && echo OK || (echo FAIL ; exit 1)
done
else
echo "No patch files found in /patches, skipping patch application."
fi

Comment on lines +64 to +68
PKGS="{{ $builderDependencies.packages | join " " }}"
for pkg in $PKGS; do
cp -a /$pkg/. /
rm -rf /$pkg
done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Package copy loop assumes all package directories exist.

Add a check to skip packages if their directories do not exist to prevent errors during copy and removal.

Suggested change
PKGS="{{ $builderDependencies.packages | join " " }}"
for pkg in $PKGS; do
cp -a /$pkg/. /
rm -rf /$pkg
done
PKGS="{{ $builderDependencies.packages | join " " }}"
for pkg in $PKGS; do
if [ -d "/$pkg" ]; then
cp -a /$pkg/. /
rm -rf /$pkg
fi
done

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants