Skip to content
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

[WIP] Add WF for appending additional images #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/fms-additional-images-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Add FMS-HF-Tuning image to additional image list

on:
workflow_dispatch:
inputs:
rhoai-release-version:
type: string
required: true
description: 'RHOAI Version number (for example: 2.11)'

env:
REPO_NAME: rhoai-additional-images
REPO_OWNER: redhat-data-services
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
RHOAI_VERSION: ${{ github.event.inputs.rhoai-release-version }}
UPDATE_BRANCH: rhoai-${{ github.event.inputs.rhoai-release-version }}-add-fms-hf-image
RHOAI_BRANCH: rhoai-${{ github.event.inputs.rhoai-release-version }}
IMAGE_BASE: modh
IMAGE_REPO: fms-hf-tuning

jobs:
append-fms-image-list:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
repository: 'redhat-data-services/rhoai-additional-images'
ref: rhoai-${{ github.event.inputs.rhoai-release-version }}
token: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}

- name: Login to Quay.io
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_ID }} # DEV COMMENT: Add Quay secrets to rhds/fms-hf-tuning repo
password: ${{ secrets.QUAY_TOKEN }}

- name: Perform tests
run: |
echo "Performing functional tests"
Comment on lines +39 to +41

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now this is just a place holder until we can set up some proper tests.


- name: Update image list
run: |
echo "Creating updated image list Pull Request"
git config --global user.email "[email protected]"
git config --global user.name "codeflare-machine-account"
Comment on lines +46 to +47

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit, can we put these in the env vars too?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or as repo variables maybe?

git checkout -b $UPDATE_BRANCH
# Update the image list to include the fms-hf-tuning release image
export IMAGE_SHA=$(podman pull --quiet quay.io/$IMAGE_BASE/$IMAGE_REPO:release)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to do this without pulling the whole image? The image is 3.3Gb which is relatively large.

sed -i "/additional-images:/a\- quay.io/$IMAGE_BASE/$IMAGE_REPO@sha256:${IMAGE_SHA}" rhoai-disconnected-images.yaml

- name: Push changes
run: |
git add .
git commit -am "Updated rhoai-disconnected-images.yaml with latest fms-hf-tuning release image" --signoff
git push origin $UPDATE_BRANCH
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$REPO_OWNER/$REPO_NAME.git

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this line doing? Is this so that the WF is authenticated when creating the PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is for authentication purposes for the gh create pr command

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move it down to that step just so they are linked?


- name: Create Pull Request
run: |
# Create a PR to the given rhoai-xxx branch
gh pr create --repo $REPO_OWNER/$REPO_NAME \
--title "$PR_TITLE" \
--body "$PR_BODY" \
--head "$REPO_OWNER:$UPDATE_BRANCH" \
--base "$RHOAI_BRANCH"
env:
PR_TITLE: "Update rhoai-disconnected-images.yaml with latest fms-hf-tuning release image"
PR_BODY: |
This is an automated Pull Request.

This PR appends the lateset fms-hf-tuning image to the list of additional disconnected image examples

- name: Tag RHOAI image
run: |
# Tag the release image with the given RHOAI release and push to quay
podman tag quay.io/$IMAGE_BASE/$IMAGE_REPO:release quay.io/$IMAGE_BASE/$IMAGE_REPO:$RHOAI_BRANCH
podman push quay.io/$IMAGE_BASE/$IMAGE_REPO:$RHOAI_BRANCH
Comment on lines +78 to +79

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
podman tag quay.io/$IMAGE_BASE/$IMAGE_REPO:release quay.io/$IMAGE_BASE/$IMAGE_REPO:$RHOAI_BRANCH
podman push quay.io/$IMAGE_BASE/$IMAGE_REPO:$RHOAI_BRANCH
podman push quay.io/$IMAGE_BASE/$IMAGE_REPO:release
quay.io/$IMAGE_BASE/$IMAGE_REPO:$RHOAI_BRANCH

I think this should work with just a single line

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow that's really cool I didn't know you could do that! Thanks

Loading