EE Dry Run - Latest Kruize image #441
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
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 | |
- 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 ./scripts/get_kruize_image_tag.py ./kruize-clowdapp.yaml | |
cat /tmp/.commitsha | |
echo "changed=$(cmp --silent /tmp/.commitsha ./autotune-builder/.commitsha && echo 'false' || echo '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" | |
sed -i "s/$current_tag/$new_tag/g" ./kruize-clowdapp.yaml | |
cat ./kruize-clowdapp.yaml | |
rm -rf autotune-builder | |
# Setup the committers identity. | |
git config user.name 'kruize-rosocp-bot' | |
git config user.email 'kruize@redhat.com' | |
git status | |
# Commit the changes and push the feature branch to origin | |
git add kruize-clowdapp.yaml | |
git commit -m "Updated Kruize image tag" | |
- uses: tibdex/github-app-token@v1 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Create pull request | |
if: steps.compare_files.outputs.changed == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
title: '[Do not merge] - EE Dry Run with latest Kruize RM image' | |
base: main | |
- name: Display Pull Request Number | |
run: | | |
echo "Pull Request Number:${{ env.PULL_REQUEST_NUMBER }}" | |