-
Notifications
You must be signed in to change notification settings - Fork 24
78 lines (60 loc) · 2.4 KB
/
test-ros-kruize-rm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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 }}"