periodic sync upstream KF to midstream ODH #140
Workflow file for this run
This file contains 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: | |
pull_request: | |
paths-ignore: | |
- "LICENSE*" | |
- "**.gitignore" | |
- "**.md" | |
- "**.txt" | |
- ".github/ISSUE_TEMPLATE/**" | |
- ".github/dependabot.yml" | |
- "docs/**" | |
- "clients/python/docs/**" | |
env: | |
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@v4 | |
- 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: | |
VERSION: ${{ steps.tags.outputs.tag }} | |
run: ./scripts/build_deploy.sh | |
- name: Start Kind Cluster | |
uses: helm/kind-action@v1.10.0 | |
with: | |
node_image: "kindest/node:v1.27.11" | |
- name: Load Local Registry Test Image | |
env: | |
IMG: "quay.io/${{ 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: "quay.io/${{ 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}" | |
- name: Create Test Registry | |
run: | | |
kubectl apply -k "https://github.com/opendatahub-io/model-registry-operator.git/config/samples/postgres?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: Set up Python | |
uses: actions/setup-python@v5 | |
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 9090:9090 & | |
sleep 5 | |
python test/python/test_mr_conn.py localhost 9090 |