Skip to content

Commit f9e562e

Browse files
Roshan-Rjbtrystram
authored andcommitted
jobs/build-node-image: run openshift specific tests
This change re-enables previously removed OpenShift-specific node image tests and ensures they are run before the Brew upload stage to catch potential issues
1 parent 8b5f5f4 commit f9e562e

File tree

1 file changed

+76
-1
lines changed

1 file changed

+76
-1
lines changed

jobs/build-node-image.Jenkinsfile

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,15 @@ def skip_brew_upload = stream_info.skip_brew_upload ?: false
4949
def src_config_ref = stream_info.source_config.ref
5050
def src_config_url = stream_info.source_config.url
5151

52+
def basearches = params.ARCHES.split() as Set
53+
def timeout_mins = 300
54+
55+
def cosa_img = params.COREOS_ASSEMBLER_IMAGE
56+
5257
lock(resource: "build-node-image") {
5358
// building actually happens on builders so we don't need much resources
5459
cosaPod(image: params.COREOS_ASSEMBLER_IMAGE,
55-
memory: "512Mi", cpu: "1", kvm: false,
60+
memory: "2.5Gi", kvm: true,
5661
serviceAccount: "jenkins",
5762
secrets: ["brew-keytab", "brew-ca:ca.crt:/etc/pki/ca.crt",
5863
"koji-conf:koji.conf:/etc/koji.conf",
@@ -149,6 +154,76 @@ lock(resource: "build-node-image") {
149154
"--add-openshift-build-labels"] + label_args)
150155
}
151156
}
157+
stage("Run Tests") {
158+
withCredentials([file(credentialsId: 'oscontainer-push-registry-secret', variable: 'REGISTRY_AUTH_FILE')]) {
159+
def openshift_stream = params.RELEASE.split("-")[0]
160+
def rhel_stream = params.RELEASE.split("-")[1]
161+
162+
parallel basearches.collectEntries { arch ->
163+
[arch, {
164+
// Define the sequence of cosa commands as a closure to avoid repetition.
165+
def executeCosaCommands = { boolean isRemote ->
166+
// The 'cosa init' command can exit with an error due to a known issue (coreos/coreos-assembler#4239).
167+
// Piping to 'true' ignores any non-zero exit code from 'cosa init', preventing the pipeline from failing.
168+
shwrap("""
169+
set +o pipefail
170+
cosa init https://github.com/openshift/os --branch release-${openshift_stream} --force | true
171+
""")
172+
// The 'cosa shell' prefix directs commands to the correct execution environment:
173+
// the remote session if active, or the local container otherwise.
174+
def s3_dir = pipeutils.get_s3_streams_dir(pipecfg, rhel_stream)
175+
pipeutils.shwrapWithAWSBuildUploadCredentials("""
176+
cosa shell mkdir -p tmp
177+
cosa buildfetch \
178+
--arch=$arch --artifact qemu --url=s3://${s3_dir}/builds \
179+
--aws-config-file \${AWS_BUILD_UPLOAD_CONFIG} --find-build-for-arch
180+
""")
181+
182+
def build_id = shwrapCapture("""
183+
link=\$(cosa shell realpath builds/latest)
184+
cosa shell basename \$link
185+
""")
186+
shwrap("cosa decompress --build $build_id")
187+
def skopeo_arch_override = (arch == "x86_64") ? "amd64" : arch
188+
shwrap("cosa shell skopeo copy --override-arch ${skopeo_arch_override} --authfile $REGISTRY_AUTH_FILE docker://${registry_staging_repo}@${node_image_manifest_digest} oci-archive:./openshift-${arch}.ociarchive")
189+
kola(
190+
cosaDir: WORKSPACE,
191+
build: build_id,
192+
arch: arch,
193+
skipUpgrade: true,
194+
extraArgs: "--tag openshift --oscontainer openshift-${arch}.ociarchive --denylist-stream ${params.RELEASE}"
195+
)
196+
kola(
197+
cosaDir: WORKSPACE,
198+
build: build_id,
199+
arch: arch,
200+
skipUpgrade: true,
201+
extraArgs: "-b rhcos --tag openshift --oscontainer openshift-${arch}.ociarchive --denylist-stream ${params.RELEASE}"
202+
)
203+
}
204+
205+
// Conditional execution based on architecture
206+
if (arch != 'x86_64') {
207+
// Conditionally create the remote session only if the architecture is NOT x86_64.
208+
pipeutils.withPodmanRemoteArchBuilder(arch: arch) {
209+
def session = pipeutils.makeCosaRemoteSession(
210+
expiration: "${timeout_mins}m",
211+
image: cosa_img,
212+
workdir: WORKSPACE
213+
)
214+
withEnv(["COREOS_ASSEMBLER_REMOTE_SESSION=${session}"]) {
215+
// Execute the commands within the remote session context.
216+
executeCosaCommands(true)
217+
}
218+
}
219+
} else {
220+
// For x86_64, execute the commands directly without a remote session.
221+
executeCosaCommands(false)
222+
}
223+
}]
224+
}
225+
}
226+
}
152227
if (!skip_brew_upload){
153228
stage("Brew Upload") {
154229
// Use the staging since we already have the digests

0 commit comments

Comments
 (0)