Convert MNIST PyTorch and MNIST Ray test cases to go #9
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
# This workflow will update the manifests, tests and compatibilty matrix in odh-manifests repository | |
name: update manifests in odh-manifests repo | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- 'releases/*' | |
jobs: | |
update-manifests-and-create-pull-request: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout distributed-workload repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Retrieve components versions from distributed-workload repo | |
run: | | |
CODEFLARE_OPERATOR_VERSION=$(sed -n -e 's/^.*CodeFlare Operator *| //p' README.md | tr -d ' |') | |
echo "CODEFLARE_OPERATOR_VERSION=${CODEFLARE_OPERATOR_VERSION}" >> "$GITHUB_ENV" | |
MCAD_VERSION=$(sed -n -e 's/^.*Multi-Cluster App Dispatcher *| //p' README.md | tr -d ' |') | |
echo "MCAD_VERSION=${MCAD_VERSION}" >> "$GITHUB_ENV" | |
CODEFLARE_SDK_VERSION=$(sed -n -e 's/^.*CodeFlare-SDK *| //p' README.md | tr -d ' |') | |
echo "CODEFLARE_SDK_VERSION=${CODEFLARE_SDK_VERSION}" >> "$GITHUB_ENV" | |
INSTASCALE_VERSION=$(sed -n -e 's/^.*InstaScale *| //p' README.md | tr -d ' |') | |
echo "INSTASCALE_VERSION=${INSTASCALE_VERSION}" >> "$GITHUB_ENV" | |
KUBERAY_VERSION=$(sed -n -e 's/^.*KubeRay *| //p' README.md | tr -d ' |') | |
echo "KUBERAY_VERSION=${KUBERAY_VERSION}" >> "$GITHUB_ENV" | |
- name: Checkout odh-manifest repository | |
uses: actions/checkout@v3 | |
with: | |
repository: opendatahub-io/odh-manifests | |
ref: master | |
path: odh-manifests | |
token: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }} | |
- name: Update manifest & create PR in odh-manifests repo | |
run: | | |
LATEST_TAG=$(git describe --tags --always --abbrev=0) | |
BRANCH_NAME="update-manifests-to-$LATEST_TAG" | |
# Change working directory | |
cd odh-manifests | |
# Checkout new branch for the changes | |
git checkout -b $BRANCH_NAME | |
# Copy distributed-workload manifests using rsync | |
echo "Performing rsync ........" | |
rsync -av --exclude='README.md' ../codeflare-stack/ codeflare-stack/ | |
rsync -av --exclude='README.md' ../ray/ ray/ | |
rsync -av ../tests/util tests/resources/codeflare-stack/util | |
rsync -av --exclude='odh-subscription.yaml'../tests/resources/ tests/resources/codeflare-stack/ | |
rsync -av --exclude='distributed-workloads.sh' ../tests/basictests/ tests/basictests/ | |
echo "rsync complete .........." | |
# Overwrite path in ray.sh | |
echo "Performing overwrite ......" | |
sed -i -e 's/\(RESOURCEDIR="${MY_DIR}\/..\/resources\)/\1\/ray/' tests/basictests/ray.sh | |
sed -i 's/\(source ${MY_DIR}\/..\)/\1\/resources\/codeflare-stack/' tests/basictests/ray.sh | |
echo "overwrite complete ........" | |
# Update compatibilty matrix in codeflare/readme | |
echo "updating compatibilty matrix ........." | |
sed -i -E "s/(.*CodeFlare Operator.*)v[0-9]+\.[0-9]+\.[0-9]+(.*)/\1${{ env.CODEFLARE_OPERATOR_VERSION }}\2/" codeflare-stack/README.md | |
sed -i -E "s/(.*Multi-Cluster App Dispatcher.*)v[0-9]+\.[0-9]+\.[0-9]+(.*)/\1${{ env.MCAD_VERSION }}\2/" codeflare-stack/README.md | |
sed -i -E "s/(.*CodeFlare-SDK.*)v[0-9]+\.[0-9]+\.[0-9]+(.*)/\1${{ env.CODEFLARE_SDK_VERSION }}\2/" codeflare-stack/README.md | |
sed -i -E "s/(.*InstaScale.*)v[0-9]+\.[0-9]+\.[0-9]+(.*)/\1${{ env.INSTASCALE_VERSION }}\2/" codeflare-stack/README.md | |
sed -i -E "s/(.*KubeRay.*)v[0-9]+\.[0-9]+\.[0-9]+(.*)/\1${{ env.KUBERAY_VERSION }}\2/" codeflare-stack/README.md | |
echo "update complete ........." | |
# Configure identity for committer | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
# Commit and push the branch to origin | |
echo "Summary of changes:" | |
git status | |
if [[ `git status --porcelain` ]]; then | |
echo "Changes detected ...." | |
git add . | |
git commit -m "Manifest_updates_for_Distributed_Workloads_$LATEST_TAG" | |
echo "completed commit .........." | |
else | |
echo "No changes detected ...." | |
echo "So, exiting the workflow ..." | |
exit 0 | |
fi | |
# Check if the branch exists and perform rebase if it does | |
if git ls-remote --exit-code --heads origin $BRANCH_NAME; then | |
git pull --rebase origin $BRANCH_NAME | |
echo "rebase completed ...." | |
fi | |
git push origin $BRANCH_NAME | |
echo "push completed ...." | |
# Create PR in odh-manifests repo if not opened yet | |
if [[ $(gh pr view $BRANCH_NAME) && $(gh pr view $BRANCH_NAME --json state --jq .state) == "OPEN" ]]; then | |
echo "PR already opened" | |
else | |
echo "Creating PR......." | |
gh pr create \ | |
--title "Update distributed-workload manifests for $LATEST_TAG Release" \ | |
--body "This is an automated PR to update distributed-workload manifests" \ | |
--head "$BRANCH_NAME" \ | |
--base "master" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }} |