Skip to content

Raise a PR and Label it #7

Raise a PR and Label it

Raise a PR and Label it #7

name: EE Dry Run - Latest Kruize image
on:
schedule:
- cron: "5 0 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: RedHatInsights/ros-ocp-backend
path: ros-ocp-backend
- name: Checkout autotune-builder repository
uses: actions/checkout@v3
with:
repository: RedHatInsights/autotune-builder
path: autotune-builder
- name: Compare commitsha
id: compare_files
run: |
# Add logic to fetch the current kruize image tag value
python3 ./ros-ocp-backend/scripts/get_kruize_image_tag.py ./ros-ocp-backend/kruize-clowdapp.yaml
cat /tmp/.commitsha
echo "changed=$(cmp --silent /tmp/.commitsha ./autotune-builder/.commitsha && echo 'false' || echo 'true')" >> $GITHUB_OUTPUT
# Added this for testing
echo "changed=true" >> $GITHUB_OUTPUT
- name: Print changed variable
run: |
echo "changed = ${{ steps.compare_files.outputs.changed }}"
- name: Update the kruize image tag in kruize clowdapp yaml
if: steps.compare_files.outputs.changed == 'true'
run: |
echo "changed = ${{ steps.compare_files.outputs.changed }}"
# Update the kruize image tag
current_tag=$(cat /tmp/.commitsha)
new_tag=$(cat ./autotune-builder/.commitsha)
echo "current_tag = $current_tag"
echo "new_tag = $new_tag"
new_tag="c84bd63"
sed -i "s/$current_tag/$new_tag/g" ./ros-ocp-backend/kruize-clowdapp.yaml
cat ./ros-ocp-backend/kruize-clowdapp.yaml
rm -rf autotune-builder
cd ros-ocp-backend
# Setup the committers identity.
git config user.name 'kruize-rosocp-bot'
git config user.email '[email protected]'
git status
# Commit the changes and push the feature branch to origin
git add kruize-clowdapp.yaml
git commit -m "Updated Kruize image tag"
- name: Create pull request
if: steps.compare_files.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: '[Do not merge] - EE Dry Run with latest Kruize RM image - PR from another repo'
base: main
path: ros-ocp-backend
- name: Display Pull Request Number
run: |
echo "Pull Request Number:${{ env.PULL_REQUEST_NUMBER }}"
- name: Comment on PR
run: |
gh pr comment ${{ env.PULL_REQUEST_NUMBER }} --body "/retest"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}