Skip to content

Commit 9fa5022

Browse files
authored
Merge pull request #393 from stackhpc/upstream/2024.1-2025-03-24
Synchronise 2024.1 with upstream
2 parents 0a17781 + 9ef6688 commit 9fa5022

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

kolla/common/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ def parse(conf, args, usage=None, prog=None,
386386
openstack_branch_slashed = openstack_branch.replace('-', '/')
387387
conf.set_default('openstack_branch', openstack_branch)
388388
conf.set_default('openstack_branch_slashed', openstack_branch_slashed)
389+
# NOTE(bbezak) Derive debian_arch from base_arch if not set explicitly
390+
derived_arch = 'arm64' if conf.base_arch == 'aarch64' else 'amd64'
391+
conf.set_default('debian_arch', derived_arch)
389392

390393
if not conf.base_image:
391394
conf.base_image = DEFAULT_BASE_TAGS[conf.base]['name']

kolla/tests/docker/etcd/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}

kolla/tests/test_build.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,3 +858,49 @@ def test_unbuildable_images(self, mock_run_build):
858858
mock_run_build.return_value = image_statuses
859859
result = build_cmd.main()
860860
self.assertEqual(0, result)
861+
862+
@mock.patch('requests.get')
863+
@mock.patch(engine_client)
864+
def test_build_etcd_cross_arch(self, mock_docker, mock_requests_get):
865+
"""Test building etcd with --base-arch aarch64.
866+
867+
This ensures we fetch the arm64 tarball instead of amd64.
868+
"""
869+
mock_response = mock.Mock()
870+
# Force error (404) so we can inspect the requested URL
871+
mock_response.status_code = 404
872+
mock_requests_get.return_value = mock_response
873+
874+
argv = ['kolla-build', '--base-arch', 'aarch64', 'etcd']
875+
with mock.patch.object(sys, 'argv', argv):
876+
build_cmd.main()
877+
878+
self.assertTrue(
879+
mock_requests_get.called,
880+
"requests.get was never called; 'etcd' may not have been matched."
881+
)
882+
883+
found_url = None
884+
for call_args in mock_requests_get.call_args_list:
885+
url = call_args[0][0]
886+
# Look for a string like 'etcd-vX.Y.Z-linux-...'
887+
if 'etcd-v' in url and 'linux-' in url:
888+
found_url = url
889+
break
890+
891+
self.assertIsNotNone(
892+
found_url,
893+
"No GET request found for the etcd tarball "
894+
"(expected 'etcd-v' and 'linux-' in the URL)."
895+
)
896+
897+
self.assertIn(
898+
'arm64',
899+
found_url,
900+
"Expected 'arm64' in etcd URL (aarch64), got: %s" % found_url
901+
)
902+
self.assertNotIn(
903+
'amd64',
904+
found_url,
905+
"Should not be 'amd64' for aarch64 build, got: %s" % found_url
906+
)

0 commit comments

Comments
 (0)