diff --git a/.github/workflows/build_images.yaml b/.github/workflows/build_images.yaml index 7964272644..ee1bcbe4cc 100644 --- a/.github/workflows/build_images.yaml +++ b/.github/workflows/build_images.yaml @@ -36,6 +36,10 @@ on: PYTHON_VER: required: true type: string + sha: + description: "sha: full git commit SHA to check out" + required: true + type: string jobs: build: @@ -52,6 +56,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ inputs.sha }} - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -62,6 +67,9 @@ jobs: cp ./LICENSE ./ci/docker/context/LICENSE cp ./VERSION ./ci/docker/context/VERSION cp ./thirdparty/THIRD_PARTY_LICENSES ./ci/docker/context/THIRD_PARTY_LICENSES + - name: Copy Commit SHA + run: | + git rev-parse HEAD > ./ci/docker/context/COMMIT_SHA - name: Login to NGC uses: docker/login-action@v3 with: diff --git a/.github/workflows/build_test_publish_images.yaml b/.github/workflows/build_test_publish_images.yaml index af066e41ee..22ba97859f 100644 --- a/.github/workflows/build_test_publish_images.yaml +++ b/.github/workflows/build_test_publish_images.yaml @@ -79,6 +79,7 @@ jobs: with: fetch-depth: 0 # unshallow fetch for setuptools-scm persist-credentials: false + ref: ${{ inputs.sha }} - name: Compute matrix id: compute-matrix @@ -128,6 +129,7 @@ jobs: IMAGE_TAG_PREFIX: ${{ needs.compute-matrix.outputs.IMAGE_TAG_PREFIX }} LINUX_VER: ${{ matrix.linux_ver }} PYTHON_VER: ${{ matrix.python_ver }} + sha: ${{ inputs.sha }} build-cuopt-multiarch-manifest: name: Build cuopt multiarch manifest @@ -141,6 +143,7 @@ jobs: - name: Checkout code repo uses: actions/checkout@v4 with: + ref: ${{ inputs.sha }} fetch-depth: 0 - name: Login to DockerHub uses: docker/login-action@v3 @@ -183,3 +186,4 @@ jobs: CUDA_VER: ${{ matrix.CUDA_VER }} PYTHON_VER: ${{ matrix.PYTHON_VER }} IMAGE_TAG_PREFIX: ${{ needs.compute-matrix.outputs.IMAGE_TAG_PREFIX }} + sha: ${{ inputs.sha }} diff --git a/.github/workflows/test_images.yaml b/.github/workflows/test_images.yaml index bff2bb6d11..bfeda82f61 100644 --- a/.github/workflows/test_images.yaml +++ b/.github/workflows/test_images.yaml @@ -27,7 +27,10 @@ on: IMAGE_TAG_PREFIX: required: true type: string - + sha: + description: "sha: full git commit SHA to check out" + required: true + type: string jobs: @@ -56,6 +59,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ inputs.sha }} - name: Test cuopt run: | bash ./ci/docker/test_image.sh diff --git a/ci/docker/Dockerfile b/ci/docker/Dockerfile index e3ee6c73ca..f00564fcf2 100644 --- a/ci/docker/Dockerfile +++ b/ci/docker/Dockerfile @@ -107,7 +107,7 @@ RUN mkdir -p /opt/cuopt && \ WORKDIR /opt/cuopt # Copy all static files in a single layer -COPY ./LICENSE ./VERSION ./THIRD_PARTY_LICENSES /opt/cuopt/ +COPY ./LICENSE ./VERSION ./THIRD_PARTY_LICENSES ./COMMIT_SHA /opt/cuopt/ # Copy CUDA libraries from the cuda-libs stage COPY --from=cuda-libs /usr/local/cuda/lib64/libnvrtc* /usr/local/cuda/lib64/ diff --git a/python/cuopt_server/cuopt_server/utils/utils.py b/python/cuopt_server/cuopt_server/utils/utils.py index 9384957ca1..5eb493644c 100644 --- a/python/cuopt_server/cuopt_server/utils/utils.py +++ b/python/cuopt_server/cuopt_server/utils/utils.py @@ -16,7 +16,7 @@ import json import os -from cuopt_server.utils.job_queue import SolverLPJob, lp_datamodel_compat +from cuopt_server.utils.job_queue import SolverLPJob from cuopt_server.utils.linear_programming.data_definition import LPData from cuopt_server.utils.linear_programming.solver import ( create_data_model as lp_create_data_model, @@ -73,14 +73,12 @@ def build_lp_datamodel_from_json(data): """ if isinstance(data, dict): - lp_datamodel_compat(data) data = LPData.parse_obj(data) elif os.path.isfile(data): with open(data, "r") as f: data = json.loads(f.read()) # Remove this once we support variable names data.pop("variable_names") - lp_datamodel_compat(data) data = LPData.parse_obj(data) else: raise ValueError(