Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Draft: PoC multi-arch support #626

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nightfurys
Copy link
Contributor

Signed-off-by: Swathi Gangisetty swathi@anchore.com

What this PR does / why we need it:

Which issue this PR fixes (optional, in fixes #<issue number>)(, fixes #<issue_number, ...) format, will close the issue when PR is merged: fixes #:

Special notes:

Swathi Gangisetty added 3 commits September 18, 2020 22:55
Signed-off-by: Swathi Gangisetty <swathi@anchore.com>
…niqueness

Signed-off-by: Swathi Gangisetty <swathi@anchore.com>
Signed-off-by: Swathi Gangisetty <swathi@anchore.com>
ret = None
try:
proc_env = os.environ.copy()
if user and pw:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that this is used through the entire module which means it should be broken out into a separate function like

def set_auth_info(user=None, password=None, verify=False):
        proc_env = os.environ.copy()
        if user and pw:
            proc_env['SKOPUSER'] = user
            proc_env['SKOPPASS'] = pw
            credstr = "--creds \"${SKOPUSER}\":\"${SKOPPASS}\""
        else:
            credstr = ""
        if verify:
            tlsverifystr = "--tls-verify=true"
        else:
            tlsverifystr = "--tls-verify=false"

        return (proc_env, credstr, tlsverifystr)

This would reduce the amount of code and give us reusable functionality for future expansion.

raise err


def get_image_manifest_v2(url, registry, repo, intag=None, indigest=None, user=None, pw=None, verify=True, default=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default should be set to False as it is a bool.

Signed-off-by: Swathi Gangisetty <swathi@anchore.com>
raise Exception("could not retrieve manifest")

except Exception as err:
raise err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't have any effect and it is equal to not having it at all

s_digest = manifest_to_digest(raw_manifest)
return s_manifest, s_digest
except Exception as err:
logger.warn("CMD failed - exception: " + str(err))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't add anything that the Exception wouldn't already show. Does this imply there is something beyond str(err) that is useful to log? It seems this could do well without a try/except block

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants