Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin docker: Fix arch string used for container metadata to be compliant with the standard #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

# imcleod@redhat.com - 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"] = self.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'] = self.goarchs[tdlobj.arch]
tdict['idstring'] = docker_image_id
tdict['cmd'] = cmd
tdict['env'] = env
Expand Down