Skip to content

Commit

Permalink
plugin docker: Fix arch string used for container metadata to be comp…
Browse files Browse the repository at this point in the history
…liant with the standard

Fixes: RHBZ#1793927
  • Loading branch information
jcajka committed Feb 25, 2020
1 parent a49d087 commit 12156b3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions imagefactory_plugins/Docker/Docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ class Docker(object):
"gzip": "gzip -c %s > %s",
"bzip2": "bzip2 -c %s > %s" }

# In image metadata, Go arch is used to identify the architecture
# https://docs.docker.com/registry/spec/manifest-v2-2/
goarchs = { "x86_64": "amd64",
"aarch64": "arm64",
"armv7hl": "armhfp",
"riscv64": "riscv64",
"ppc64le": "ppc64le",
"s390x": "s390x"}

# The templates below allow us to generate base images without a running docker locally

# [email protected] - 26-Aug-2014
Expand Down Expand Up @@ -385,7 +394,7 @@ def _run_guestmount(g):
if set_arch_label:
if label == 'null':
label = dict()
label["architecture"] = tdlobj.arch
label["architecture"] = goarchs[tdlobj.arch]

rdict = { repository: { tag: docker_image_id } }

Expand All @@ -394,16 +403,11 @@ def _run_guestmount(g):
raise Exception("No docker JSON template available for specified docker version (%s)" % (dockerversion))
docker_json_template=self.docker_templates_dict[dockerversion]

arch = tdlobj.arch
if arch == "x86_64":
arch = "amd64"
elif arch == "armv7hl":
arch = "armhfp"
tdict = { }
tdict['commentstring'] = parameters.get('comment', 'Created by Image Factory')
tdict['os'] = parameters.get('os', 'linux')
tdict['createdtime'] = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
tdict['arch'] = arch
tdict['arch'] = goarchs[tdlobj.arch]
tdict['idstring'] = docker_image_id
tdict['cmd'] = cmd
tdict['env'] = env
Expand Down

0 comments on commit 12156b3

Please sign in to comment.