sync: main to stable #12000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test container image build and deployment | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths-ignore: | |
| - "LICENSE*" | |
| - "**.gitignore" | |
| - "**.md" | |
| - "**.txt" | |
| - ".github/ISSUE_TEMPLATE/**" | |
| - ".github/dependabot.yml" | |
| - "docs/**" | |
| - "clients/python/**" | |
| permissions: # set contents: read at top-level, per OpenSSF ScoreCard rule TokenPermissionsID | |
| contents: read | |
| env: | |
| IMG_REGISTRY: quay.io | |
| IMG_ORG: opendatahub | |
| IMG_REPO: model-registry | |
| PUSH_IMAGE: false | |
| BRANCH: ${{ github.base_ref }} | |
| jobs: | |
| build-and-test-image: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Generate Tag | |
| shell: bash | |
| id: tags | |
| run: | | |
| commit_sha=${{ github.event.after }} | |
| tag=main-${commit_sha:0:7} | |
| echo "tag=${tag}" >> $GITHUB_OUTPUT | |
| - name: Build Image | |
| shell: bash | |
| env: | |
| IMG_VERSION: ${{ steps.tags.outputs.tag }} | |
| run: make image/build | |
| - name: Start Kind Cluster | |
| uses: helm/kind-action@v1.13.0 | |
| with: | |
| node_image: "kindest/node:v1.27.11" | |
| - name: Remove AppArmor profile for mysql in KinD on GHA # https://github.com/kubeflow/manifests/issues/2507 | |
| run: | | |
| set -x | |
| sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld | |
| - name: Load Local Registry Test Image | |
| env: | |
| IMG: "${{ env.IMG_REGISTRY }}/${{ env.IMG_ORG }}/${{ env.IMG_REPO }}:${{ steps.tags.outputs.tag }}" | |
| run: | | |
| kind load docker-image -n chart-testing ${IMG} | |
| - name: Deploy Operator With Test Image | |
| env: | |
| IMG: "${{ env.IMG_REGISTRY }}/${{ env.IMG_ORG }}/${{ env.IMG_REPO }}:${{ steps.tags.outputs.tag }}" | |
| run: | | |
| echo "Deploying operator from model-registry-operator branch ${BRANCH}" | |
| kubectl apply -k "https://github.com/opendatahub-io/model-registry-operator.git/config/default?ref=${BRANCH}" | |
| kubectl set env -n model-registry-operator-system deployment/model-registry-operator-controller-manager REST_IMAGE="${IMG}" | |
| kubectl wait --for=condition=Available=true -n model-registry-operator-system deployment/model-registry-operator-controller-manager --timeout=5m | |
| - name: Display about MR Operator in KinD cluster status in any case | |
| if: always() | |
| run: | | |
| kubectl get deployments -n model-registry-operator-system -o wide | |
| kubectl get pods -n model-registry-operator-system -o wide --show-labels | |
| kubectl events -A | |
| kubectl describe -n model-registry-operator-system deployment/model-registry-operator-controller-manager | |
| for p in $(kubectl get pods -n model-registry-operator-system -o name); do | |
| echo "===== Logs for $p =====" | |
| kubectl logs -n model-registry-operator-system $p | |
| done | |
| - name: Create Test Registry | |
| run: | | |
| kubectl apply -k "https://github.com/opendatahub-io/model-registry-operator.git/config/samples/mysql?ref=${BRANCH}" | |
| kubectl get mr | |
| - name: Wait for Test Registry Deployment | |
| run: | | |
| kubectl wait --for=condition=Available=true deployment/model-registry-db --timeout=5m | |
| kubectl wait --for=condition=Available=true modelregistries/modelregistry-sample --timeout=5m | |
| - name: Display KinD cluster status in any case | |
| if: always() | |
| run: | | |
| kubectl get deployments -o wide | |
| kubectl get pods -o wide | |
| kubectl events | |
| kubectl get modelregistries/modelregistry-sample -o wide | |
| kubectl describe modelregistries/modelregistry-sample | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Upgrade pip | |
| run: | | |
| pip install --constraint=.github/workflows/constraints.txt pip | |
| pip --version | |
| - name: Install Poetry | |
| run: | | |
| pipx install --pip-args=--constraint=${{ github.workspace }}/.github/workflows/constraints.txt poetry | |
| poetry --version | |
| - name: Build package | |
| working-directory: clients/python | |
| run: | | |
| poetry build --ansi | |
| pip install dist/*.whl | |
| - name: Connect with Python client | |
| run: | | |
| kubectl port-forward service/modelregistry-sample 8080:8080 & | |
| sleep 5 | |
| python test/python/test_mr_conn.py http://localhost 8080 | |
| - name: Check Pod Logs | |
| if: always() | |
| run: | | |
| kubectl logs -l app=modelregistry-sample --all-containers --prefix |