|
| 1 | +name: Test PR in Showroom |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + pr_number: |
| 7 | + description: 'PR number to build and test' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + catalog_image: |
| 11 | + description: 'OLM catalog image (optional, uses default if not specified)' |
| 12 | + required: false |
| 13 | + type: string |
| 14 | + operator_image: |
| 15 | + description: 'Operator image (optional, uses default if not specified)' |
| 16 | + required: false |
| 17 | + type: string |
| 18 | + |
| 19 | +jobs: |
| 20 | + build-and-test: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + timeout-minutes: 30 |
| 23 | + concurrency: |
| 24 | + group: openshift-cluster-1 |
| 25 | + cancel-in-progress: false |
| 26 | + permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Get PR information |
| 31 | + id: pr-info |
| 32 | + env: |
| 33 | + PR_NUMBER: ${{ inputs.pr_number }} |
| 34 | + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
| 35 | + with: |
| 36 | + script: | |
| 37 | + const prNumber = Number(process.env.PR_NUMBER); |
| 38 | + if (!Number.isInteger(prNumber) || prNumber < 1) { |
| 39 | + core.setFailed('Invalid PR number'); |
| 40 | + return; |
| 41 | + } |
| 42 | +
|
| 43 | + const pr = await github.rest.pulls.get({ |
| 44 | + owner: context.repo.owner, |
| 45 | + repo: context.repo.repo, |
| 46 | + pull_number: prNumber |
| 47 | + }); |
| 48 | +
|
| 49 | + core.setOutput('sha', pr.data.head.sha); |
| 50 | + core.setOutput('ref', pr.data.head.ref); |
| 51 | + core.setOutput('repo', pr.data.head.repo.full_name); |
| 52 | +
|
| 53 | + console.log(`PR #${prNumber}:`); |
| 54 | + console.log(` SHA: ${pr.data.head.sha}`); |
| 55 | + console.log(` Ref: ${pr.data.head.ref}`); |
| 56 | + console.log(` Repo: ${pr.data.head.repo.full_name}`); |
| 57 | +
|
| 58 | + - name: Checkout PR code |
| 59 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 60 | + with: |
| 61 | + repository: ${{ steps.pr-info.outputs.repo }} |
| 62 | + ref: ${{ steps.pr-info.outputs.sha }} |
| 63 | + path: llama-stack-distribution |
| 64 | + persist-credentials: false |
| 65 | + |
| 66 | + - name: Build image from PR |
| 67 | + id: build |
| 68 | + working-directory: llama-stack-distribution |
| 69 | + env: |
| 70 | + PR_NUMBER: ${{ inputs.pr_number }} |
| 71 | + PR_SHA: ${{ steps.pr-info.outputs.sha }} |
| 72 | + run: | |
| 73 | + if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then |
| 74 | + echo "Invalid PR_NUMBER" |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | + TAG="pr-${PR_NUMBER}-${PR_SHA}" |
| 78 | + echo "tag=$TAG" >> "$GITHUB_OUTPUT" |
| 79 | + echo "Building image: llama-stack-test:$TAG" |
| 80 | +
|
| 81 | + python3 distribution/build.py |
| 82 | + podman build -f distribution/Containerfile -t "llama-stack-test:$TAG" . |
| 83 | +
|
| 84 | + - name: Setup CI environment |
| 85 | + id: setup |
| 86 | + uses: derekhiggins/llama-stack-showroom@036ca9802bbe245d59bbe4a3d703f37c82cf692f # main as of 2026-03-24 |
| 87 | + with: |
| 88 | + catalog_image: ${{ inputs.catalog_image }} |
| 89 | + llama_stack_image: "image-registry.openshift-image-registry.svc:5000/redhat-ods-operator/llama-stack-test:${{ steps.build.outputs.tag }}" |
| 90 | + operator_image: ${{ inputs.operator_image }} |
| 91 | + oc_server: ${{ secrets.OC_SERVER }} |
| 92 | + oc_token: ${{ secrets.OC_TOKEN }} |
| 93 | + env: | |
| 94 | + SHOWROOM_PULL_SECRET=${{ secrets.SHOWROOM_PULL_SECRET }} |
| 95 | + SHOWROOM_VLLM_URL=https://llama-3-2-3b-maas-apicast-production.apps.prod.rhoai.rh-aiservices-bu.com:443/v1 |
| 96 | + SHOWROOM_VLLM_API_TOKEN=${{ secrets.SHOWROOM_VLLM_API_TOKEN }} |
| 97 | + SHOWROOM_VLLM_EMBEDDING_URL=https://nomic-embed-text-v1-5-maas-apicast-production.apps.prod.rhoai.rh-aiservices-bu.com:443/v1 |
| 98 | + SHOWROOM_VLLM_EMBEDDING_API_TOKEN=${{ secrets.SHOWROOM_VLLM_EMBEDDING_API_TOKEN }} |
| 99 | +
|
| 100 | + - name: Push image to OpenShift registry |
| 101 | + id: push |
| 102 | + run: | |
| 103 | + # Push image to registry |
| 104 | + "${{ steps.setup.outputs.scripts_dir }}/push-image-to-registry.sh" \ |
| 105 | + llama-stack-test:${{ steps.build.outputs.tag }} \ |
| 106 | + redhat-ods-operator \ |
| 107 | + llama-stack-test:${{ steps.build.outputs.tag }} |
| 108 | +
|
| 109 | + # Construct pull URL for cluster-internal access |
| 110 | + PULL_IMAGE="image-registry.openshift-image-registry.svc:5000/redhat-ods-operator/llama-stack-test:${{ steps.build.outputs.tag }}" |
| 111 | +
|
| 112 | + echo "pull_image=${PULL_IMAGE}" >> "$GITHUB_OUTPUT" |
| 113 | +
|
| 114 | + - name: Run setup.sh |
| 115 | + run: | |
| 116 | + "${{ steps.setup.outputs.scripts_dir }}/setup.sh" |
| 117 | +
|
| 118 | + - name: Run provision.sh |
| 119 | + run: | |
| 120 | + "${{ steps.setup.outputs.scripts_dir }}/provision.sh" |
| 121 | +
|
| 122 | + - name: Run tests |
| 123 | + run: | |
| 124 | + "${{ steps.setup.outputs.scripts_dir }}/test.sh" |
| 125 | +
|
| 126 | + - name: Run unprovision.sh |
| 127 | + if: always() |
| 128 | + run: | |
| 129 | + "${{ steps.setup.outputs.scripts_dir }}/unprovision.sh" |
| 130 | +
|
| 131 | + - name: Run cleanup.sh |
| 132 | + if: always() |
| 133 | + run: | |
| 134 | + "${{ steps.setup.outputs.scripts_dir }}/cleanup.sh" |
| 135 | +
|
| 136 | + - name: Output summary |
| 137 | + if: always() |
| 138 | + env: |
| 139 | + PR_NUMBER: ${{ inputs.pr_number }} |
| 140 | + PR_SHA: ${{ steps.pr-info.outputs.sha }} |
| 141 | + IMAGE_TAG: ${{ steps.build.outputs.tag }} |
| 142 | + JOB_STATUS: ${{ job.status }} |
| 143 | + run: | |
| 144 | + { |
| 145 | + echo "# Test PR in Showroom - Summary" |
| 146 | + echo "" |
| 147 | + echo "## Build Information" |
| 148 | + echo "- **PR Number**: #${PR_NUMBER}" |
| 149 | + echo "- **Commit SHA**: ${PR_SHA}" |
| 150 | + echo "- **Image Tag**: \`${IMAGE_TAG}\`" |
| 151 | + echo "" |
| 152 | + echo "## Test Results" |
| 153 | + if [ "$JOB_STATUS" = "success" ]; then |
| 154 | + echo "✅ All tests passed successfully!" |
| 155 | + else |
| 156 | + echo "❌ Tests failed. Check the logs above for details." |
| 157 | + fi |
| 158 | + } >> "$GITHUB_STEP_SUMMARY" |
0 commit comments