diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebee096..7a8faad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,13 +14,13 @@ jobs: name: Detect Changes runs-on: ubuntu-latest outputs: - cuda-12-8: ${{ steps.filter.outputs.cuda-12-8 }} - cuda-12-9: ${{ steps.filter.outputs.cuda-12-9 }} - cuda-13-0: ${{ steps.filter.outputs.cuda-13-0 }} - cuda-13-1: ${{ steps.filter.outputs.cuda-13-1 }} - python-3-12: ${{ steps.filter.outputs.python-3-12 }} - any-cuda: ${{ steps.filter.outputs.any-cuda }} - any-python: ${{ steps.filter.outputs.any-python }} + cuda-12-8: ${{ steps.filter.outputs['cuda-12-8'] }} + cuda-12-9: ${{ steps.filter.outputs['cuda-12-9'] }} + cuda-13-0: ${{ steps.filter.outputs['cuda-13-0'] }} + cuda-13-1: ${{ steps.filter.outputs['cuda-13-1'] }} + python-3-12: ${{ steps.filter.outputs['python-3-12'] }} + any-cuda: ${{ steps.filter.outputs['any-cuda'] }} + any-python: ${{ steps.filter.outputs['any-python'] }} steps: - uses: actions/checkout@v4 with: @@ -169,7 +169,7 @@ jobs: # Run when Python-related files change AND lint-containerfiles passed/skipped if: | always() && - needs.changes.outputs.any-python == 'true' && + needs.changes.outputs['any-python'] == 'true' && needs.lint.result == 'success' && needs.type-check.result == 'success' && (needs.lint-containerfiles.result == 'success' || needs.lint-containerfiles.result == 'skipped') @@ -214,7 +214,7 @@ jobs: # Run when CUDA-related files change AND lint-containerfiles passed/skipped if: | always() && - needs.changes.outputs.any-cuda == 'true' && + needs.changes.outputs['any-cuda'] == 'true' && needs.lint.result == 'success' && needs.type-check.result == 'success' && (needs.lint-containerfiles.result == 'success' || needs.lint-containerfiles.result == 'skipped') diff --git a/Containerfile.cuda.template b/Containerfile.cuda.template index 537c27e..433c755 100644 --- a/Containerfile.cuda.template +++ b/Containerfile.cuda.template @@ -224,6 +224,7 @@ RUN dnf clean all && \ ARG BUILD_DATE ARG VCS_REF ARG VERSION +ARG PYTHON_VERSION LABEL name="odh-midstream-cuda-base" \ version="${VERSION}" \ @@ -244,7 +245,7 @@ LABEL name="odh-midstream-cuda-base" \ com.nvidia.cudnn.version="${NV_CUDNN_VERSION}" \ com.nvidia.nccl.version="${NCCL_VERSION}" \ com.opendatahub.accelerator="cuda" \ - com.opendatahub.python="3.12" + com.opendatahub.python="${PYTHON_VERSION}" # ----------------------------------------------------------------------------- # User Configuration (from notebooks pattern) diff --git a/cuda/12.8/Containerfile b/cuda/12.8/Containerfile index 84ecaa8..831e414 100644 --- a/cuda/12.8/Containerfile +++ b/cuda/12.8/Containerfile @@ -224,6 +224,7 @@ RUN dnf clean all && \ ARG BUILD_DATE ARG VCS_REF ARG VERSION +ARG PYTHON_VERSION LABEL name="odh-midstream-cuda-base" \ version="${VERSION}" \ @@ -244,7 +245,7 @@ LABEL name="odh-midstream-cuda-base" \ com.nvidia.cudnn.version="${NV_CUDNN_VERSION}" \ com.nvidia.nccl.version="${NCCL_VERSION}" \ com.opendatahub.accelerator="cuda" \ - com.opendatahub.python="3.12" + com.opendatahub.python="${PYTHON_VERSION}" # ----------------------------------------------------------------------------- # User Configuration (from notebooks pattern) diff --git a/cuda/12.8/app.conf b/cuda/12.8/app.conf index 50a306d..00c60e7 100644 --- a/cuda/12.8/app.conf +++ b/cuda/12.8/app.conf @@ -17,6 +17,9 @@ # ----------------------------------------------------------------------------- IMAGE_TAG=12.8-py312 +# Python version bundled with this CUDA image (used in container labels) +PYTHON_VERSION=3.12 + # ----------------------------------------------------------------------------- # Base Image # ----------------------------------------------------------------------------- diff --git a/cuda/12.9/Containerfile b/cuda/12.9/Containerfile index 404ccfc..5f528f3 100644 --- a/cuda/12.9/Containerfile +++ b/cuda/12.9/Containerfile @@ -224,6 +224,7 @@ RUN dnf clean all && \ ARG BUILD_DATE ARG VCS_REF ARG VERSION +ARG PYTHON_VERSION LABEL name="odh-midstream-cuda-base" \ version="${VERSION}" \ @@ -244,7 +245,7 @@ LABEL name="odh-midstream-cuda-base" \ com.nvidia.cudnn.version="${NV_CUDNN_VERSION}" \ com.nvidia.nccl.version="${NCCL_VERSION}" \ com.opendatahub.accelerator="cuda" \ - com.opendatahub.python="3.12" + com.opendatahub.python="${PYTHON_VERSION}" # ----------------------------------------------------------------------------- # User Configuration (from notebooks pattern) diff --git a/cuda/12.9/app.conf b/cuda/12.9/app.conf index 695aea8..05777ba 100644 --- a/cuda/12.9/app.conf +++ b/cuda/12.9/app.conf @@ -17,6 +17,9 @@ # ----------------------------------------------------------------------------- IMAGE_TAG=12.9-py312 +# Python version bundled with this CUDA image (used in container labels) +PYTHON_VERSION=3.12 + # ----------------------------------------------------------------------------- # Base Image # ----------------------------------------------------------------------------- diff --git a/cuda/13.0/Containerfile b/cuda/13.0/Containerfile index f5a4b6a..7158ab1 100644 --- a/cuda/13.0/Containerfile +++ b/cuda/13.0/Containerfile @@ -224,6 +224,7 @@ RUN dnf clean all && \ ARG BUILD_DATE ARG VCS_REF ARG VERSION +ARG PYTHON_VERSION LABEL name="odh-midstream-cuda-base" \ version="${VERSION}" \ @@ -244,7 +245,7 @@ LABEL name="odh-midstream-cuda-base" \ com.nvidia.cudnn.version="${NV_CUDNN_VERSION}" \ com.nvidia.nccl.version="${NCCL_VERSION}" \ com.opendatahub.accelerator="cuda" \ - com.opendatahub.python="3.12" + com.opendatahub.python="${PYTHON_VERSION}" # ----------------------------------------------------------------------------- # User Configuration (from notebooks pattern) diff --git a/cuda/13.0/app.conf b/cuda/13.0/app.conf index 3697583..1afc445 100644 --- a/cuda/13.0/app.conf +++ b/cuda/13.0/app.conf @@ -17,6 +17,9 @@ # ----------------------------------------------------------------------------- IMAGE_TAG=13.0-py312 +# Python version bundled with this CUDA image (used in container labels) +PYTHON_VERSION=3.12 + # ----------------------------------------------------------------------------- # Base Image # ----------------------------------------------------------------------------- diff --git a/cuda/13.1/Containerfile b/cuda/13.1/Containerfile index a19008d..d491014 100644 --- a/cuda/13.1/Containerfile +++ b/cuda/13.1/Containerfile @@ -224,6 +224,7 @@ RUN dnf clean all && \ ARG BUILD_DATE ARG VCS_REF ARG VERSION +ARG PYTHON_VERSION LABEL name="odh-midstream-cuda-base" \ version="${VERSION}" \ @@ -244,7 +245,7 @@ LABEL name="odh-midstream-cuda-base" \ com.nvidia.cudnn.version="${NV_CUDNN_VERSION}" \ com.nvidia.nccl.version="${NCCL_VERSION}" \ com.opendatahub.accelerator="cuda" \ - com.opendatahub.python="3.12" + com.opendatahub.python="${PYTHON_VERSION}" # ----------------------------------------------------------------------------- # User Configuration (from notebooks pattern) diff --git a/cuda/13.1/app.conf b/cuda/13.1/app.conf index 357c813..9fdb027 100644 --- a/cuda/13.1/app.conf +++ b/cuda/13.1/app.conf @@ -17,6 +17,9 @@ # ----------------------------------------------------------------------------- IMAGE_TAG=13.1-py312 +# Python version bundled with this CUDA image (used in container labels) +PYTHON_VERSION=3.12 + # ----------------------------------------------------------------------------- # Base Image # ----------------------------------------------------------------------------- diff --git a/scripts/generate-containerfile.sh b/scripts/generate-containerfile.sh index 07ef05f..1dbf829 100755 --- a/scripts/generate-containerfile.sh +++ b/scripts/generate-containerfile.sh @@ -166,6 +166,12 @@ generate_python() { } main() { + # Handle help flags first (before arg count check) + if [[ "${1:-}" == "-h" || "${1:-}" == "--help" || "${1:-}" == "help" ]]; then + print_usage + exit 0 + fi + if [[ $# -lt 2 ]]; then log_error "Missing arguments" print_usage @@ -182,10 +188,6 @@ main() { python) generate_python "${version}" ;; - -h|--help|help) - print_usage - exit 0 - ;; *) log_error "Unknown type: ${type}" print_usage