Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Handle fetching IBM MQ libraries in CI package build jobs outside of CMake#21862

Open
Ferroin wants to merge 3 commits intonetdata:masterfrom
Ferroin:ibm-mq-local
Open

Handle fetching IBM MQ libraries in CI package build jobs outside of CMake#21862
Ferroin wants to merge 3 commits intonetdata:masterfrom
Ferroin:ibm-mq-local

Conversation

@Ferroin
Copy link
Member

@Ferroin Ferroin commented Mar 2, 2026

Summary

This uses CMake’s FETCHCONTENT_SOURCE_DIR_* functionality plus a bit of additional trickery to allow usage of a pre-populated copy of the IBM MQ libraries in builds, and then leverages this to fetch the IBM MQ libraries before the build in our native DEB/RPM package builds in CI.

This should completely eliminate (or almost completely eliminate) the intermittent failures we’re seeing on these CI jobs resulting from failures to fetch these libraries.

Test Plan

CI passes on this PR.


Summary by cubic

Move IBM MQ library fetching out of CMake and into CI for DEB/RPM builds to reduce flaky package builds. We prefetch, verify, cache, and extract the redistributable, and point CMake at a pre-populated source when present.

  • Refactors

    • Add prep-ibm-mq-libs.sh with retries, SHA256 check, cache, and extract to tmp/ibm_mq.
    • CMake: load IBM MQ URL/hash from vendor files; support FETCHCONTENT_SOURCE_DIR_IBM_MQ for pre-populated libs.
    • CI: fetch libs on x86_64 before build; pass source dir via spec/build scripts when present.
  • Bug Fixes

    • CMake: remove duplicate CONFIGURE_COMMAND in FetchContent setup.

Written for commit 923e857. Summary will update on new commits.

This allows us to handle fetching them as a separate step in CI, letting
us better handle the errors resulting from IBM’s questioanble
infrastructure.
This lets us better handle infrastructure issues when trying to fetch
the libraries.
@github-actions github-actions bot added area/ci area/packaging Packaging and operating systems support labels Mar 2, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-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.

1 issue found across 8 files

Confidence score: 3/5

  • There is a concrete configuration failure risk: packaging/cmake/Modules/NetdataIBMPlugin.cmake uses COMMAND in an ExternalProject_Add context, which is not a valid option and can break the CMake configure step.
  • Given the medium severity (6/10) and direct impact on build/configuration, this carries some user-facing risk despite being localized.
  • Pay close attention to packaging/cmake/Modules/NetdataIBMPlugin.cmake - ensure the external project step uses a supported option like PATCH_COMMAND.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packaging/cmake/Modules/NetdataIBMPlugin.cmake">

<violation number="1" location="packaging/cmake/Modules/NetdataIBMPlugin.cmake:23">
P2: FetchContent_Declare passes arguments to ExternalProject_Add, but "COMMAND" is not a valid ExternalProject_Add option, so CMake will fail configuring this external project. Use PATCH_COMMAND (or another supported step) for the extra copy operation.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant CI as CI Runner (GHA)
    participant Script as prep-ibm-mq-libs.sh
    participant Cache as Artifact Cache
    participant IBM as IBM CDN
    participant CMake as CMake (FetchContent)
    participant Build as Plugin Build (CGO)

    Note over CI, Build: NEW: IBM MQ Library Prefetching Flow

    CI->>Script: Execute prep script
    Script->>Script: Read URL/SHA256 from packaging/vendor/
    
    Script->>Cache: Check for cached tarball
    alt Cache Miss or Invalid Hash
        loop NEW: Retry up to 5 times
            Script->>IBM: GET IBM MQ Redistributable
            IBM-->>Script: Tarball data
        end
        Script->>Script: Verify SHA256 hash
        Script->>Cache: Update cache with valid tarball
    else Cache Hit
        Cache-->>Script: Provide cached tarball
    end

    Script->>Script: Extract to tmp/ibm_mq
    
    Note over CI, CMake: Start Build Stage
    
    CI->>CMake: Invoke with -DFETCHCONTENT_SOURCE_DIR_IBM_MQ=tmp/ibm_mq
    
    activate CMake
    alt CHANGED: Pre-populated source provided
        CMake->>CMake: NEW: Copy libs from tmp/ibm_mq to build dir
        Note right of CMake: Skips network download
    else Standard build
        CMake->>IBM: Fetch via FetchContent_MakeAvailable
    end
    
    CMake->>Build: Configure CGO_CFLAGS/LDFLAGS with local paths
    deactivate CMake
    
    Build->>Build: Compile ibm.d.plugin using local headers/libs
    Build-->>CI: Build Success
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

SOURCE_DIR "${IBM_MQ_BUILD_DIR}"
CONFIGURE_COMMAND "${CMAKE_COMMAND} -E true"
CONFIGURE_COMMAND "${CMAKE_COMMAND} -E copy_directory bin gskit8 inc java lap lib lib64 licenses msg samp swidtag ${IBM_MQ_BUILD_DIR}"
COMMAND "${CMAKE_COMMAND} -E copy MANIFEST MANIFEST.Redist README.Redist ${IBM_MQ_BUILD_DIR}"
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 2, 2026

Choose a reason for hiding this comment

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

P2: FetchContent_Declare passes arguments to ExternalProject_Add, but "COMMAND" is not a valid ExternalProject_Add option, so CMake will fail configuring this external project. Use PATCH_COMMAND (or another supported step) for the extra copy operation.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packaging/cmake/Modules/NetdataIBMPlugin.cmake, line 23:

<comment>FetchContent_Declare passes arguments to ExternalProject_Add, but "COMMAND" is not a valid ExternalProject_Add option, so CMake will fail configuring this external project. Use PATCH_COMMAND (or another supported step) for the extra copy operation.</comment>

<file context>
@@ -12,19 +13,37 @@ macro(add_ibm_plugin_target)
     SOURCE_DIR "${IBM_MQ_BUILD_DIR}"
     CONFIGURE_COMMAND "${CMAKE_COMMAND} -E true"
+    CONFIGURE_COMMAND "${CMAKE_COMMAND} -E copy_directory bin gskit8 inc java lap lib lib64 licenses msg samp swidtag ${IBM_MQ_BUILD_DIR}"
+    COMMAND       "${CMAKE_COMMAND} -E copy MANIFEST MANIFEST.Redist README.Redist ${IBM_MQ_BUILD_DIR}"
     BUILD_COMMAND "${CMAKE_COMMAND} -E true"
     INSTALL_COMMAND "${CMAKE_COMMAND} -E true"
</file context>
Suggested change
COMMAND "${CMAKE_COMMAND} -E copy MANIFEST MANIFEST.Redist README.Redist ${IBM_MQ_BUILD_DIR}"
PATCH_COMMAND "${CMAKE_COMMAND} -E copy MANIFEST MANIFEST.Redist README.Redist ${IBM_MQ_BUILD_DIR}"
Fix with Cubic

@Ferroin Ferroin marked this pull request as ready for review March 2, 2026 16:38
@Ferroin Ferroin requested review from a team and vkalintiris as code owners March 2, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci area/packaging Packaging and operating systems support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant