Skip to content

Commit 7c714e1

Browse files
committed
CI: Add multi-target build infra
1 parent 5e52e03 commit 7c714e1

File tree

4 files changed

+728
-4
lines changed

4 files changed

+728
-4
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# NIXL PR Testing Matrix Configuration
2+
#
3+
# This file defines the build matrix for NIXL PR validation using the multi-target Docker system.
4+
# Primary purpose: Fast feedback on code changes via build + test execution.
5+
#
6+
# Key Components:
7+
# - Single NIXL Image Build: Uses multi-stage Dockerfile (base -> nixl) with layer caching
8+
# - Integrated Testing: Runs C++ and Python tests directly in the built environment
9+
# - CI-Demo Integration: Base image auto-builds only when Dockerfile changes
10+
#
11+
# PR Testing Benefits:
12+
# - Fast feedback: Base layer cached when only code changes
13+
# - Full rebuild: When infrastructure (Dockerfile) changes
14+
# - No registry operations: Focus on validation, not distribution
15+
# - Multi-OS/arch testing: Ensures compatibility across platforms
16+
#
17+
18+
---
19+
job: nixl-ci-build-multi-target
20+
21+
# Registry configuration for base image reusability
22+
registry_host: urm.nvidia.com
23+
registry_path: /sw-nbu-swx-nixl-docker-local/ci
24+
registry_auth: svc-nixl-artifactory-token
25+
26+
# Build settings
27+
failFast: false
28+
timeout_minutes: 120
29+
30+
# Infrastructure requirements
31+
kubernetes:
32+
cloud: il-ipp-blossom-prod
33+
namespace: swx-media
34+
limits: "{memory: 16Gi, cpu: 8000m}"
35+
requests: "{memory: 8Gi, cpu: 4000m}"
36+
37+
# Container images: Base for reusability + NIXL for PR testing
38+
runs_on_dockers:
39+
- { name: "podman-v5.0.2", url: "quay.io/podman/stable:v5.0.2", privileged: true, category: 'tool' }
40+
41+
# BASE IMAGE - Built & Pushed for Reusability
42+
# Registry: urm.nvidia.com/sw-nbu-swx-nixl-docker-local/ci/{arch}/nixl-base:base-{os}-{arch}
43+
# Contains: UCX, DOCA, AWS SDK, Rust toolchain, all dependencies
44+
- { file: 'contrib/Dockerfile.multi-target', name: "nixl-base", tag: "base-${os}-${arch}", target: 'base', arch: '${arch}', build_args: 'OS=${os}', category: 'reusable' }
45+
46+
# NIXL TEST IMAGE - Uses base via multi-stage (PR testing only)
47+
# Local only: Built from base + NIXL source for validation
48+
- { file: 'contrib/Dockerfile.multi-target', name: "nixl-pr-test", tag: "test-${os}-${arch}", target: 'nixl', arch: '${arch}', build_args: 'OS=${os}', category: 'test' }
49+
50+
# Build matrix - test both architectures and OS versions
51+
matrix:
52+
axes:
53+
arch:
54+
- x86_64
55+
- aarch64
56+
os:
57+
- ubuntu22.04
58+
- ubuntu24.04
59+
60+
# Environment configuration
61+
env:
62+
NIXL_INSTALL_DIR: "/usr/local/nixl"
63+
NPROC: "16"
64+
65+
# Task naming for parallel execution
66+
taskName: "${os}/${arch}/${axis_index}"
67+
68+
credentials:
69+
- credentialsId: 'svc-nixl-artifactory-token'
70+
usernameVariable: 'ARTIFACTORY_USERNAME'
71+
passwordVariable: 'ARTIFACTORY_PASSWORD'
72+
73+
# Build pipeline steps
74+
steps:
75+
- name: Test NIXL with PR Changes
76+
parallel: true
77+
containerSelector: "{ name: 'nixl-pr-test' }"
78+
run: |
79+
echo "=== Testing NIXL with PR Changes ==="
80+
81+
# Set up environment
82+
cd /workspace/nixl
83+
export ARCH=$(uname -m)
84+
[ "$ARCH" = "arm64" ] && ARCH="aarch64"
85+
86+
echo "=== Running C++ Tests ==="
87+
if [ -f .gitlab/test_cpp.sh ]; then
88+
.gitlab/test_cpp.sh ${NIXL_INSTALL_DIR}
89+
else
90+
echo 'C++ test script not found, skipping C++ tests'
91+
fi
92+
93+
echo "=== Running Python Tests ==="
94+
if [ -f .gitlab/test_python.sh ]; then
95+
.gitlab/test_python.sh ${NIXL_INSTALL_DIR}
96+
else
97+
echo 'Python test script not found, skipping Python tests'
98+
fi
99+
100+
echo "✅ All tests completed successfully - PR is ready!"
101+
102+
# Pipeline completion
103+
pipeline_stop:
104+
shell: action
105+
module: groovy
106+
run: |
107+
def jobStatus = currentBuild.result ?: 'SUCCESS'
108+
def statusColor = jobStatus == 'SUCCESS' ? 'green' : 'red'
109+
110+
echo "NIXL PR testing completed with status: ${jobStatus}"
111+
112+
if (params.MAIL_TO) {
113+
def userName = currentBuild.rawBuild.getCause(hudson.model.Cause.UserIdCause)?.userName ?: 'schedule'
114+
115+
mail(
116+
to: params.MAIL_TO,
117+
subject: "NIXL PR Testing [${env.BUILD_NUMBER}] - ${jobStatus}",
118+
mimeType: 'text/html',
119+
body: """
120+
<h3>NIXL PR Testing Results</h3>
121+
<p><b>Status:</b> <span style="color: ${statusColor};">${jobStatus}</span></p>
122+
<p><b>Build:</b> <a href='${env.BUILD_URL}'>#${env.BUILD_NUMBER}</a></p>
123+
<p><b>Images:</b> Base image pushed for reuse, NIXL tested with PR changes</p>
124+
<p><a href='${env.BUILD_URL}console'>View Console Output</a></p>
125+
"""
126+
)
127+
}

.ci/jenkins/pipeline/proj-jjb.yaml

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,71 @@
316316
parent-credentials: true
317317
script-path: "{jjb_jenkinsfile}"
318318

319+
# Template for multi-target build job using the new unified Dockerfile approach
320+
- job-template:
321+
name: "{jjb_proj}-build-multi-target"
322+
project-type: pipeline
323+
folder: "{jjb_folder}"
324+
disabled: false
325+
properties:
326+
- github:
327+
url: "{jjb_gh_url}"
328+
- build-discarder:
329+
days-to-keep: 14
330+
num-to-keep: 1000
331+
- inject:
332+
keep-system-variables: true
333+
properties-content: |
334+
jjb_proj={jjb_proj}-build-multi-target
335+
description: >
336+
<b>NIXL PR Testing Pipeline</b><br/>
337+
• Fast feedback for code changes using multi-target Docker system<br/>
338+
• Builds NIXL with PR changes (base layer cached when possible)<br/>
339+
• Supports both Ubuntu 22.04 and 24.04 on x86_64/aarch64<br/>
340+
• Runs comprehensive C++ and Python test suites<br/>
341+
<br/>
342+
<i>Do NOT edit this job through the Jenkins GUI — managed by Jenkins Job Builder.</i>
343+
concurrent: true
344+
sandbox: true
345+
parameters:
346+
- string:
347+
name: "sha1"
348+
default: "{jjb_branch}"
349+
description: "Git commit/branch/tag to build (default: main)"
350+
- string:
351+
name: "githubData"
352+
default: ""
353+
description: "GitHub webhook data (automatically set)"
354+
- string:
355+
name: "conf_file"
356+
default: ".ci/jenkins/lib/build-multi-target-matrix.yaml"
357+
description: "Build matrix configuration file"
358+
- string:
359+
name: "MAIL_TO"
360+
default: ""
361+
description: "Email address for build notifications (optional)"
362+
- string:
363+
name: "DEBUG"
364+
default: 0
365+
description: "Debug level (0-9) for verbose output"
366+
pipeline-scm:
367+
scm:
368+
- git:
369+
url: "{jjb_git}"
370+
credentials-id: 'swx-jenkins_ssh_key'
371+
branches: ['$sha1']
372+
shallow-clone: false
373+
do-not-fetch-tags: false
374+
refspec: "+refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin/pr/* +refs/tags/*:refs/remotes/origin/tags/*"
375+
browser: githubweb
376+
browser-url: "{jjb_git}"
377+
submodule:
378+
disable: false
379+
recursive: true
380+
tracking: true
381+
parent-credentials: true
382+
script-path: "{jjb_jenkinsfile}"
383+
319384
# Project definition that instantiates the job templates
320385
# This section defines the actual jobs that will be created
321386
- project:
@@ -327,7 +392,8 @@
327392
jjb_branch: 'main' # Default branch
328393
jjb_gh_url: 'https://github.com/ai-dynamo/nixl' # GitHub web URL
329394
jobs:
330-
- "{jjb_proj}-dispatcher" # Create dispatcher job
331-
- "{jjb_proj}-build" # Create build job
332-
- "{jjb_proj}-build-container" # Create container builder job
333-
- "{jjb_proj}-test" # Create test job
395+
# - "{jjb_proj}-dispatcher" # Create dispatcher job
396+
# - "{jjb_proj}-build" # Create build job
397+
# - "{jjb_proj}-build-container" # Create container builder job
398+
- "{jjb_proj}-build-multi-target" # Create multi-target build job
399+
# - "{jjb_proj}-test" # Create test job

0 commit comments

Comments
 (0)