From b62a9aaefc593f6d0e99d63ac36338321d364b35 Mon Sep 17 00:00:00 2001
From: Michal Nasiadka <mnasiadka@gmail.com>
Date: Wed, 8 Dec 2021 19:43:04 +0100
Subject: [PATCH] ipa: Use openstack_branch instead of master

ironic-python-agent-builder has stable branches since Wallaby -
let's use them.

Also as per ipab docs [1] - the env vars for overriding ipa repo
are:
- DIB_REPOREF_ironic_python_agent
- DIB_REPOLOCATION_ironic_python_agent

[1]: https://docs.openstack.org/ironic-python-agent-builder/latest/admin/dib.html#building

Story: 2009755
Task: 44224

Change-Id: I025532156de831a0e7d025d61601a38202de10ff
---
 ansible/group_vars/all/ipa                          | 8 ++++----
 etc/kayobe/ipa.yml                                  | 2 +-
 releasenotes/notes/ipa-branch-b29c377c531013a8.yaml | 6 ++++++
 3 files changed, 11 insertions(+), 5 deletions(-)
 create mode 100644 releasenotes/notes/ipa-branch-b29c377c531013a8.yaml

diff --git a/ansible/group_vars/all/ipa b/ansible/group_vars/all/ipa
index 77bae9f9..1ed548e2 100644
--- a/ansible/group_vars/all/ipa
+++ b/ansible/group_vars/all/ipa
@@ -16,8 +16,8 @@ ipa_build_source_version: "{{ openstack_branch }}"
 # URL of IPA builder source repository.
 ipa_builder_source_url: "https://opendev.org/openstack/ironic-python-agent-builder"
 
-# Version of IPA builder source repository. Default is master.
-ipa_builder_source_version: master
+# Version of IPA builder source repository. Default is {{ openstack_branch }}.
+ipa_builder_source_version: "{{ openstack_branch }}"
 
 # List of default Diskimage Builder (DIB) elements to use when building IPA
 # images. Default is ["centos", "enable-serial-console",
@@ -45,8 +45,8 @@ ipa_build_dib_env_default:
   # TODO(mgoddard): Use {{ os_release }} here when we use os_distribution
   # above.
   DIB_RELEASE: "8-stream"
-  DIB_REPOLOCATION_ironic_agent: "{{ ipa_build_source_url }}"
-  DIB_REPOREF_ironic_agent: "{{ ipa_build_source_version }}"
+  DIB_REPOLOCATION_ironic_python_agent: "{{ ipa_build_source_url }}"
+  DIB_REPOREF_ironic_python_agent: "{{ ipa_build_source_version }}"
 
 # Dictionary of additional environment variables to provide to Diskimage
 # Builder (DIB) during IPA image build.
diff --git a/etc/kayobe/ipa.yml b/etc/kayobe/ipa.yml
index e0f2094f..519ca2a5 100644
--- a/etc/kayobe/ipa.yml
+++ b/etc/kayobe/ipa.yml
@@ -16,7 +16,7 @@
 # URL of IPA builder source repository.
 #ipa_builder_source_url:
 
-# Version of IPA builder source repository. Default is master.
+# Version of IPA builder source repository. Default is {{ openstack_branch }}.
 #ipa_builder_source_version:
 
 # List of default Diskimage Builder (DIB) elements to use when building IPA
diff --git a/releasenotes/notes/ipa-branch-b29c377c531013a8.yaml b/releasenotes/notes/ipa-branch-b29c377c531013a8.yaml
new file mode 100644
index 00000000..b7a34e17
--- /dev/null
+++ b/releasenotes/notes/ipa-branch-b29c377c531013a8.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    Fixes an issue with IPA image builds which used the ``master``
+    branch of ``ironic-python-agent``, even on stable releases
+    of Kayobe, or when explicitly setting ``ipa_build_source_version``.
-- 
GitLab