-
Notifications
You must be signed in to change notification settings - Fork 57
Restore ability to build Containerfile(s) on PR #645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tarilabs
wants to merge
13
commits into
trustyai-explainability:main
Choose a base branch
from
tarilabs:tarilabs-20260213-GHAbuildImages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6a39038
Revert "ci: Remove GHA due to devFlags deprecation (#631)"
tarilabs 6cbe5ef
rename GHA
tarilabs e8277d4
keep only what's necessary
tarilabs 09cbdd3
change GHA Workflow name
tarilabs a37baec
implement review comment
tarilabs 2f92f15
restore Defaults value for Env vars
tarilabs 248d47b
do not prevent Merge if failing
tarilabs 73193e5
implement code review comment
tarilabs 1191d2e
simplify trigger
tarilabs f05895a
make it require label needs-build
tarilabs 9f7f657
simplify steps
tarilabs d4b2897
add expiry label also to the other dockerfiles
tarilabs 1d86e01
Update .github/workflows/build-images-on-PR.yaml
tarilabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| name: Build and Push | ||
| on: | ||
| pull_request: | ||
| paths-ignore: | ||
| - "LICENSE" | ||
| - "**/.gitignore" | ||
| - "**.md" | ||
| - "**.adoc" | ||
| - "*.txt" | ||
| types: [labeled, opened, synchronize, reopened] | ||
| jobs: | ||
| build-and-push-ci: | ||
| if: github.repository == 'trustyai-explainability/trustyai-service-operator' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| security-events: write | ||
| pull-requests: write | ||
| steps: # Assign context variable for various action contexts (only 'CI', to guard against potential 'on:' additions later) | ||
| - name: Assigning CI context | ||
| if: github.head_ref != '' && github.head_ref != 'main' && !startsWith(github.ref, 'refs/tags/v') | ||
| run: echo "BUILD_CONTEXT=ci" >> $GITHUB_ENV | ||
|
|
||
| # Run checkouts | ||
| - uses: mheap/github-action-required-labels@v4 | ||
| if: env.BUILD_CONTEXT == 'ci' | ||
| with: | ||
| mode: minimum | ||
| count: 1 | ||
| labels: "ok-to-test, lgtm, approved" | ||
| - uses: actions/checkout@v4 | ||
| if: env.BUILD_CONTEXT == 'ci' | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| persist-credentials: false | ||
| # | ||
| # Set environments depending on context | ||
| - name: Set CI environment | ||
| if: env.BUILD_CONTEXT == 'ci' | ||
| run: | | ||
| echo "OPERATOR_TAG=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | ||
| echo "IMAGE_NAME=quay.io/trustyai/trustyai-service-operator-ci" >> $GITHUB_ENV | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Set CI environment - LMES | ||
| if: env.BUILD_CONTEXT == 'ci' && contains(github.event.pull_request.labels.*.name, 'needs-lmes-build') | ||
| run: | | ||
| echo "LMES_DRIVER_TAG=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | ||
| echo "LMES_JOB_TAG=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | ||
| echo "LMES_DRIVER_IMAGE_NAME=quay.io/trustyai/ta-lmes-driver-ci" >> $GITHUB_ENV | ||
| echo "LMES_JOB_IMAGE_NAME=quay.io/trustyai/ta-lmes-job-ci" >> $GITHUB_ENV | ||
|
|
||
| - name: Set CI environment - Orchestrator | ||
| if: env.BUILD_CONTEXT == 'ci' && contains(github.event.pull_request.labels.*.name, 'needs-orchestrator-build') | ||
| run: | | ||
| echo "ORCH_IMAGE_NAME=quay.io/trustyai/ta-guardrails-orchestrator-ci" >> $GITHUB_ENV | ||
| echo "ORCH_TAG=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | ||
|
|
||
| # Print variables for debugging | ||
| - name: Log reference variables | ||
| run: | | ||
| echo "CONTEXT: ${{ env.BUILD_CONTEXT }}" | ||
| echo "GITHUB.REF: ${{ github.ref }}" | ||
| echo "GITHUB.HEAD_REF: ${{ github.head_ref }}" | ||
| echo "SHA: ${{ github.event.pull_request.head.sha }}" | ||
| echo "MAIN IMAGE AT: ${{ env.OPERATOR_IMAGE_NAME }}:${{ env.OPERATOR_TAG }}" | ||
| echo "LMES DRIVER IMAGE AT: ${{ env.LMES_DRIVER_IMAGE_NAME }}:${{ env.LMES_DRIVER_TAG }}" | ||
| echo "LMES JOB IMAGE AT: ${{ env.LMES_JOB_IMAGE_NAME }}:${{ env.LMES_JOB_TAG }}" | ||
| echo "GUARDRAILS ORCH IMAGE AT: ${{ env.ORCH_IMAGE_NAME }}:${{ env.ORCH_TAG }}" | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| # Run docker commands | ||
| - name: Put expiry date on CI-tagged image | ||
| if: env.BUILD_CONTEXT == 'ci' | ||
| run: sed -i 's#summary="odh-trustyai-service-operator\"#summary="odh-trustyai-service-operator" \\ \n quay.expires-after=7d#' Dockerfile | ||
| - name: Log in to Quay | ||
| run: docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} -p ${{ secrets.QUAY_ROBOT_SECRET }} quay.io | ||
|
sourcery-ai[bot] marked this conversation as resolved.
sourcery-ai[bot] marked this conversation as resolved.
sourcery-ai[bot] marked this conversation as resolved.
|
||
| - name: Build main image | ||
| run: docker build -t ${{ env.OPERATOR_IMAGE_NAME }}:${{ env.OPERATOR_TAG }} . | ||
| - name: Push main image to Quay | ||
| run: docker push ${{ env.OPERATOR_IMAGE_NAME }}:${{ env.OPERATOR_TAG }} | ||
|
|
||
| # LMES Driver Builds | ||
| - name: Build LMES driver image | ||
| if: contains(github.event.pull_request.labels.*.name, 'needs-lmes-build') || env.BUILD_CONTEXT == 'main' || env.BUILD_CONTEXT == 'tag' | ||
| run: docker build -f Dockerfile.driver -t ${{ env.LMES_DRIVER_IMAGE_NAME }}:${{ env.LMES_DRIVER_TAG }} . | ||
| - name: Push LMES driver image to Quay | ||
| if: contains(github.event.pull_request.labels.*.name, 'needs-lmes-build') || env.BUILD_CONTEXT == 'main' || env.BUILD_CONTEXT == 'tag' | ||
| run: docker push ${{ env.LMES_DRIVER_IMAGE_NAME }}:${{ env.LMES_DRIVER_TAG }} | ||
|
|
||
| # LMES Job Builds | ||
| - name: Build LMES job image | ||
| if: contains(github.event.pull_request.labels.*.name, 'needs-lmes-build') || env.BUILD_CONTEXT == 'main' || env.BUILD_CONTEXT == 'tag' | ||
|
sourcery-ai[bot] marked this conversation as resolved.
Outdated
|
||
| run: docker build -f Dockerfile.lmes-job -t ${{ env.LMES_JOB_IMAGE_NAME }}:${{ env.LMES_JOB_TAG }} . | ||
| - name: Push LMES job image to Quay | ||
| if: contains(github.event.pull_request.labels.*.name, 'needs-lmes-build') || env.BUILD_CONTEXT == 'main' || env.BUILD_CONTEXT == 'tag' | ||
| run: docker push ${{ env.LMES_JOB_IMAGE_NAME }}:${{ env.LMES_JOB_TAG }} | ||
|
|
||
| # Orchestrator Builds | ||
| - name: Build Guardrails orchestrator image | ||
| if: contains(github.event.pull_request.labels.*.name, 'needs-orchestrator-build') || env.BUILD_CONTEXT == 'main' || env.BUILD_CONTEXT == 'tag' | ||
| run: docker build -f Dockerfile.orchestrator -t ${{ env.ORCH_IMAGE_NAME }}:${{ env.ORCH_TAG }} . | ||
| - name: Push Guardrails orchestrator image to Quay | ||
| if: contains(github.event.pull_request.labels.*.name, 'needs-orchestrator-build') || env.BUILD_CONTEXT == 'main' || env.BUILD_CONTEXT == 'tag' | ||
| run: docker push ${{ env.ORCH_IMAGE_NAME }}:${{ env.ORCH_TAG }} | ||
|
|
||
| # Leave comment | ||
| - uses: peter-evans/find-comment@v3 | ||
| name: Find Comment | ||
| id: fc | ||
| if: env.BUILD_CONTEXT == 'ci' | ||
| with: | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| comment-author: "github-actions[bot]" | ||
| body-includes: PR image build and manifest generation completed successfully | ||
| - uses: peter-evans/create-or-update-comment@v4 | ||
| name: Generate/update success message comment | ||
| if: env.BUILD_CONTEXT == 'ci' | ||
| with: | ||
| comment-id: ${{ steps.fc.outputs.comment-id }} | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| edit-mode: replace | ||
| body: | | ||
| PR image build and manifest generation completed successfully! | ||
|
|
||
| 📦 [PR image](https://${{ env.OPERATOR_IMAGE_NAME }}:${{ env.OPERATOR_TAG }}): `${{ env.OPERATOR_IMAGE_NAME }}:${{ env.OPERATOR_TAG }}` | ||
|
|
||
| 📦 [LMES driver image](https://${{ env.LMES_DRIVER_IMAGE_NAME }}:${{ env.LMES_DRIVER_TAG }}): `${{ env.LMES_DRIVER_IMAGE_NAME }}:${{ env.LMES_DRIVER_TAG }}` | ||
|
|
||
| 📦 [LMES job image](https://${{ env.LMES_JOB_IMAGE_NAME }}:${{ env.LMES_JOB_TAG }}): `${{ env.LMES_JOB_IMAGE_NAME }}:${{ env.LMES_JOB_TAG }}` | ||
|
|
||
| 📦 [Guardrails orchestrator image](https://${{ env.ORCH_IMAGE_NAME }}:${{ env.ORCH_TAG }}): `${{ env.ORCH_IMAGE_NAME }}:${{ env.ORCH_TAG }}` | ||
|
tarilabs marked this conversation as resolved.
coderabbitai[bot] marked this conversation as resolved.
tarilabs marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.