From 6e6818e552a9a513eec61536ca76de585be04625 Mon Sep 17 00:00:00 2001 From: Vincent Roseberry Date: Fri, 30 Oct 2026 17:31:36 +0000 Subject: [PATCH] Run tests right after each image build Tests and diffs now run in parallel immediately after their image is built, instead of waiting for all builds to finish. Test kaggle-environments runs alongside the CPU image test since it uses the CPU image. --- Jenkinsfile | 127 +++++++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 65 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fa82a412..b45791dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,14 +38,45 @@ pipeline { ''' } } - stage('Diff CPU image') { + stage('Test/Diff CPU Image') { steps { - sh '''#!/bin/bash - set -exo pipefail + script { + parallel( + 'Test CPU Image': { + timeout(time: 15, unit: 'MINUTES') { + retry(2) { + sh '''#!/bin/bash + set -exo pipefail - docker pull gcr.io/kaggle-images/python:${PRETEST_TAG} - ./diff --target gcr.io/kaggle-images/python:${PRETEST_TAG} - ''' + date + docker pull gcr.io/kaggle-images/python:${PRETEST_TAG} + ./test --image gcr.io/kaggle-images/python:${PRETEST_TAG} + ''' + } + } + }, + 'Test kaggle-environments': { + timeout(time: 15, unit: 'MINUTES') { + sh '''#!/bin/bash + set -exo pipefail + docker run --rm \ + -e PYTHONUNBUFFERED=1 \ + --pull always \ + gcr.io/kaggle-images/python:${PRETEST_TAG} \ + bash -c "git clone https://github.com/Kaggle/kaggle-environments.git /tmp/kaggle-environments && cd /tmp/kaggle-environments && python -m pytest tests/ kaggle_environments/ --tb=short --ignore-glob='*/test_pyxis.py'" + ''' + } + }, + 'Diff CPU Image': { + sh '''#!/bin/bash + set -exo pipefail + + docker pull gcr.io/kaggle-images/python:${PRETEST_TAG} + ./diff --target gcr.io/kaggle-images/python:${PRETEST_TAG} + ''' + } + ) + } } } } @@ -74,14 +105,33 @@ pipeline { ''' } } - stage('Diff GPU Image') { + stage('Test/Diff GPU Image') { steps { - sh '''#!/bin/bash - set -exo pipefail + script { + parallel( + 'Test on T4x2': { + timeout(time: 60, unit: 'MINUTES') { + retry(2) { + sh '''#!/bin/bash + set -exo pipefail - docker pull gcr.io/kaggle-private-byod/python:${PRETEST_TAG} - ./diff --gpu --target gcr.io/kaggle-private-byod/python:${PRETEST_TAG} - ''' + date + docker pull gcr.io/kaggle-private-byod/python:${PRETEST_TAG} + ./test --gpu --image gcr.io/kaggle-private-byod/python:${PRETEST_TAG} + ''' + } + } + }, + 'Diff GPU Image': { + sh '''#!/bin/bash + set -exo pipefail + + docker pull gcr.io/kaggle-private-byod/python:${PRETEST_TAG} + ./diff --gpu --target gcr.io/kaggle-private-byod/python:${PRETEST_TAG} + ''' + } + ) + } } } } @@ -117,59 +167,6 @@ pipeline { } } - stage('Test') { - parallel { - stage('Test CPU Image') { - options { - timeout(time: 15, unit: 'MINUTES') - } - steps { - retry(2) { - sh '''#!/bin/bash - set -exo pipefail - - date - docker pull gcr.io/kaggle-images/python:${PRETEST_TAG} - ./test --image gcr.io/kaggle-images/python:${PRETEST_TAG} - ''' - } - } - } - stage('Test on T4x2') { - agent { label 'ephemeral-linux-gpu-t4x2' } - options { - timeout(time: 60, unit: 'MINUTES') - } - steps { - retry(2) { - sh '''#!/bin/bash - set -exo pipefail - - date - docker pull gcr.io/kaggle-private-byod/python:${PRETEST_TAG} - ./test --gpu --image gcr.io/kaggle-private-byod/python:${PRETEST_TAG} - ''' - } - } - } - stage('Test kaggle-environments') { - options { - timeout(time: 15, unit: 'MINUTES') - } - steps { - sh '''#!/bin/bash - set -exo pipefail - docker run --rm \ - -e PYTHONUNBUFFERED=1 \ - --pull always \ - gcr.io/kaggle-images/python:${PRETEST_TAG} \ - bash -c "git clone https://github.com/Kaggle/kaggle-environments.git /tmp/kaggle-environments && cd /tmp/kaggle-environments && python -m pytest tests/ kaggle_environments/ --tb=short --ignore-glob='*/test_pyxis.py'" - ''' - } - } - } - } - stage('Label CPU/GPU Staging Images') { steps { sh '''#!/bin/bash