4141 ref : ${{ inputs.openstack_version }}
4242 path : src/kayobe-config
4343
44+ - name : Set sanitized branch name
45+ id : branch_name
46+ run : |
47+ sanitized_name=$(echo "update-dependencies/${{ inputs.openstack_version }}" | tr '/' '-')
48+ echo "name=${sanitized_name}" >> $GITHUB_OUTPUT
49+
4450 - name : Set up branch and Git config
4551 run : |
46- git checkout -b update-dependencies/ ${{ inputs.openstack_version }}
52+ git checkout -b ${{ steps.branch_name.outputs.name }}
4753 git config user.name "stackhpc-ci"
4854 git config user.email "[email protected] " 4955 working-directory : src/kayobe-config
5460 echo "" >> pr_body.md
5561 echo "### Changes" >> pr_body.md
5662
63+ # --- 1. Kolla ---
5764 - name : Checkout Kolla repository
5865 uses : actions/checkout@v4
5966 with :
7077 - name : Get current Kolla version
7178 id : current_kolla_version
7279 run : |
73- VERSION=$(grep ' stackhpc_kolla_source_version:' src/kayobe-config/etc/kayobe/stackhpc.yml | sed 's/.*: //' )
80+ VERSION=$(awk -F': ' '/ stackhpc_kolla_source_version:/ {print $2} ' src/kayobe-config/etc/kayobe/stackhpc.yml | xargs )
7481 echo "version=${VERSION}" >> $GITHUB_OUTPUT
7582
83+ - name : Debug Kolla version comparison
84+ run : |
85+ echo "Latest Tag: '${{ steps.latest_kolla_tag.outputs.latest_tag }}'"
86+ echo "Current Version: '${{ steps.current_kolla_version.outputs.version }}'"
87+
7688 - name : Update and commit Kolla version if needed
7789 if : steps.latest_kolla_tag.outputs.latest_tag != steps.current_kolla_version.outputs.version
7890 run : |
8597 TAG : ${{ steps.latest_kolla_tag.outputs.latest_tag }}
8698 working-directory : src/kayobe-config
8799
100+ # --- 2. Kolla Ansible ---
88101 - name : Checkout Kolla Ansible repository
89102 uses : actions/checkout@v4
90103 with :
@@ -101,9 +114,14 @@ jobs:
101114 - name : Get current Kolla Ansible version
102115 id : current_kolla_ansible_version
103116 run : |
104- VERSION=$(grep ' stackhpc_kolla_ansible_source_version:' src/kayobe-config/etc/kayobe/stackhpc.yml | sed 's/.*: //' )
117+ VERSION=$(awk -F': ' '/ stackhpc_kolla_ansible_source_version:/ {print $2} ' src/kayobe-config/etc/kayobe/stackhpc.yml | xargs )
105118 echo "version=${VERSION}" >> $GITHUB_OUTPUT
106119
120+ - name : Debug Kolla Ansible version comparison
121+ run : |
122+ echo "Latest Tag: '${{ steps.latest_kolla_ansible_tag.outputs.latest_tag }}'"
123+ echo "Current Version: '${{ steps.current_kolla_ansible_version.outputs.version }}'"
124+
107125 - name : Update and commit Kolla Ansible version if needed
108126 if : steps.latest_kolla_ansible_tag.outputs.latest_tag != steps.current_kolla_ansible_version.outputs.version
109127 run : |
@@ -116,6 +134,7 @@ jobs:
116134 TAG : ${{ steps.latest_kolla_ansible_tag.outputs.latest_tag }}
117135 working-directory : src/kayobe-config
118136
137+ # --- 3. Kayobe ---
119138 - name : Checkout Kayobe repository
120139 uses : actions/checkout@v4
121140 with :
@@ -132,9 +151,14 @@ jobs:
132151 - name : Get current Kayobe version
133152 id : current_kayobe_version
134153 run : |
135- VERSION=$(grep 'kayobe@stackhpc/' src/kayobe-config/requirements.txt | sed 's/.*@//')
154+ VERSION=$(grep 'kayobe@stackhpc/' src/kayobe-config/requirements.txt | sed 's/.*@//' | xargs )
136155 echo "version=${VERSION}" >> $GITHUB_OUTPUT
137156
157+ - name : Debug Kayobe version comparison
158+ run : |
159+ echo "Latest Tag: '${{ steps.latest_kayobe_tag.outputs.latest_tag }}'"
160+ echo "Current Version: '${{ steps.current_kayobe_version.outputs.version }}'"
161+
138162 - name : Update and commit Kayobe version if needed
139163 if : steps.latest_kayobe_tag.outputs.latest_tag != steps.current_kayobe_version.outputs.version
140164 run : |
@@ -147,15 +171,38 @@ jobs:
147171 TAG : ${{ steps.latest_kayobe_tag.outputs.latest_tag }}
148172 working-directory : src/kayobe-config
149173
174+ # --- 4. Push and Create Pull Request ---
175+ - name : Check for new commits
176+ id : check_commits
177+ run : |
178+ echo "--- Git Log ---"
179+ git log --oneline --graph --all
180+ echo "---------------"
181+ count=$(git rev-list --count ${{ inputs.openstack_version }}..HEAD)
182+ echo "Commit count between ${{ inputs.openstack_version }} and HEAD is: $count"
183+ if [ "$count" -gt 0 ]; then
184+ echo "has_commits=true" >> $GITHUB_OUTPUT
185+ else
186+ echo "has_commits=false" >> $GITHUB_OUTPUT
187+ fi
188+ working-directory : src/kayobe-config
189+
190+ - name : Push commits
191+ if : steps.check_commits.outputs.has_commits == 'true'
192+ run : git push --force origin ${{ steps.branch_name.outputs.name }}
193+ working-directory : src/kayobe-config
194+
150195 - name : Propose changes via PR if required
151- id : cpr
196+ if : steps.check_commits.outputs.has_commits == 'true'
152197 uses : peter-evans/create-pull-request@v7
153198 with :
154199 path : src/kayobe-config
155- branch : update-dependencies/${{ inputs.openstack_version }}
200+ branch : ${{ steps.branch_name.outputs.name }}
201+ base : ${{ inputs.openstack_version }}
156202 delete-branch : true
157203 title : " chore(deps): Bump dependencies for OpenStack ${{ inputs.openstack_codename }}"
158204 body-path : pr_body.md
159205 labels : |
160206 automated
161207 ${{ inputs.openstack_codename }}
208+
0 commit comments