image-build: add arch name(s) in image config file name
Pungi write image config file with name of <format>-<name>.cfg, if there are two or more image configs present for different arches under the same variant and with same format & name, the config file can be overwritten, and result in invalid image conf file. Example: image_build = { '^Server$': [ { 'image-build': { 'format': [('qcow2', 'qcow2'),], 'name': 'fedora-guest-image', 'target': 'guest-fedora-26-image', 'version': '26', 'ksurl': "git://git.example.com/ks.git?fedora#HEAD", 'kickstart': "fedora-26-kvm.ks", 'ksversion': 'f26', 'distro': 'fedora-26', 'disk-size': '10', 'arches': ['x86_64'], 'repo': ["http://example.com/linux/fedora/26/Everything/x86_64/os", ] } }, { 'image-build': { 'format': [('qcow2', 'qcow2'),], 'name': 'fedora-guest-image', 'target': 'guest-fedora-26-image', 'version': '26', 'ksurl': "git://git.example.com/ks.git?fedora#HEAD", 'kickstart': "fedora-26-kvm.ks", 'ksversion': 'f26', 'distro': 'fedora-26', 'disk-size': '10', 'arches': ['ppc64le'], } }, ], } In this case, config file "qcow2_guest-fedora-26-image.cfg" will be created for both x86_64 and ppc64le under the same variant dir, and there is a high chance it will be over-written while Pungi creating the koji task. We can add arch name(s) in config filename to avoid that. Signed-off-by: Qixiang Wan <qwan@redhat.com>
This commit is contained in:
parent
5379fb5e28
commit
b81e94e808
@ -302,17 +302,23 @@ class WorkPaths(object):
|
||||
makedirs(path)
|
||||
return path
|
||||
|
||||
def image_build_conf(self, variant, image_name, image_type, create_dir=True):
|
||||
def image_build_conf(self, variant, image_name, image_type, arches=None, create_dir=True):
|
||||
"""
|
||||
@param variant
|
||||
@param image-name
|
||||
@param image-type (e.g docker)
|
||||
@param arches
|
||||
@param create_dir=True
|
||||
|
||||
Examples:
|
||||
work/image-build/Server/docker_rhel-server-docker.cfg
|
||||
work/image-build/Server/docker_rhel-server-docker_x86_64.cfg
|
||||
work/image-build/Server/docker_rhel-server-docker_x86_64-ppc64le.cfg
|
||||
"""
|
||||
path = os.path.join(self.image_build_dir(variant), "%s_%s.cfg" % (image_type, image_name))
|
||||
path = os.path.join(self.image_build_dir(variant), "%s_%s" % (image_type, image_name))
|
||||
if arches is not None:
|
||||
path = "%s_%s" % (path, '-'.join(list(arches)))
|
||||
path = "%s.cfg" % path
|
||||
return path
|
||||
|
||||
|
||||
|
@ -120,7 +120,8 @@ class ImageBuildPhase(base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigG
|
||||
"conf_file": self.compose.paths.work.image_build_conf(
|
||||
image_conf["image-build"]['variant'],
|
||||
image_name=image_conf["image-build"]['name'],
|
||||
image_type=image_conf["image-build"]['format'].replace(",", "-")
|
||||
image_type=image_conf["image-build"]['format'].replace(",", "-"),
|
||||
arches=image_conf["image-build"]['arches'],
|
||||
),
|
||||
"image_dir": self.compose.paths.compose.image_dir(variant),
|
||||
"relative_image_dir": self.compose.paths.compose.image_dir(
|
||||
|
@ -73,7 +73,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'can_fail': ['x86_64'],
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Client/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Client/docker_Fedora-Docker-Base_amd64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Client/%(arch)s/images',
|
||||
"relative_image_dir": 'Client/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
@ -98,7 +98,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'can_fail': ['x86_64'],
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
||||
"relative_image_dir": 'Server/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
@ -158,7 +158,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'release': '20151203.t.0',
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
||||
"relative_image_dir": 'Server/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
@ -214,7 +214,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'release': '20151203.t.0',
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
||||
"relative_image_dir": 'Server/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
@ -311,7 +311,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'distro': 'Fedora-20',
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
||||
"relative_image_dir": 'Server/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
@ -375,7 +375,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'distro': 'Fedora-20',
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
||||
"relative_image_dir": 'Server/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
@ -436,7 +436,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'distro': 'Fedora-20',
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_x86_64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
||||
"relative_image_dir": 'Server/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
@ -648,7 +648,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'can_fail': ['x86_64'],
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server-optional/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Server-optional/docker_Fedora-Docker-Base_x86_64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server-optional/%(arch)s/images',
|
||||
"relative_image_dir": 'Server-optional/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
@ -708,7 +708,7 @@ class TestImageBuildPhase(PungiTestCase):
|
||||
'can_fail': ['amd64', 'x86_64'],
|
||||
}
|
||||
},
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base.cfg',
|
||||
"conf_file": self.topdir + '/work/image-build/Server/docker_Fedora-Docker-Base_amd64-x86_64.cfg',
|
||||
"image_dir": self.topdir + '/compose/Server/%(arch)s/images',
|
||||
"relative_image_dir": 'Server/%(arch)s/images',
|
||||
"link_type": 'hardlink-or-copy',
|
||||
|
Loading…
Reference in New Issue
Block a user