Skip to content

Support images with more than one forward slash#466

Merged
savingoyal merged 2 commits intoNetflix:masterfrom
rchui:fix-docker-tag-parsing
Apr 2, 2021
Merged

Support images with more than one forward slash#466
savingoyal merged 2 commits intoNetflix:masterfrom
rchui:fix-docker-tag-parsing

Conversation

@rchui
Copy link
Copy Markdown
Contributor

@rchui rchui commented Apr 2, 2021

This PR address #348.

Explanation (https://regex101.com/r/aPUxUr/1):

^(.+?(?:[:.].+?)\/)?(.*?)(?:[@:])?((?<=[@:]).*)?$

        Explanation:

            (.+?(?:[:.].+?)\/)? - [GROUP 0] REGISTRY
                .+?                 - A registry must start with at least one character
                (?:[:.].+?)\/       - A registry must have ":" or "." and end with "/"
                ?                   - Make a registry optional
            (.*?)               - [GROUP 1] REPOSITORY
                .*?                 - Get repository name until separator
            (?:[@:])?           - SEPARATOR
                ?:                  - Don't capture separator
                [@:]                - The separator must be either "@" or ":"
                ?                   - The separator is optional
            ((?<=[@:]).*)?      - [GROUP 2] TAG / DIGEST
                (?<=[@:])           - A tag / digest must be preceeded by "@" or ":"
                .*                  - Capture rest of tag / digest
                ?                   - A tag / digest is optional

        Examples:

            image
                - None
                - image
                - None
            example/image
                - None
                - example/image
                - None
            example/image:tag
                - None
                - example/image
                - tag
            example.domain.com/example/image:tag
                - example.domain.com/
                - example/image
                - tag
            123.123.123.123:123/example/image:tag
                - 123.123.123.123:123/
                - example/image
                - tag
            example.domain.com/example/image@sha256:45b23dee0
                - example.domain.com/
                - example/image
                - sha256:45b23dee0

@rchui rchui changed the title Fix docker tag parsing Support images with more than one forward slash Apr 2, 2021
Copy link
Copy Markdown

@corleyma corleyma left a comment

Choose a reason for hiding this comment

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

I think this looks good and should match up with how the open source docker registry treats this (using this code as my comparison for source of truth).

@savingoyal savingoyal merged commit d6f961e into Netflix:master Apr 2, 2021
@rchui rchui deleted the fix-docker-tag-parsing branch April 2, 2021 20:52
savingoyal added a commit that referenced this pull request Apr 22, 2021
* New logging system for Metaflow

Work in progress

* fixups

* more fixups

* change environment.py to metaflow_environment.py (#451)

* Fix typo in missing job queue error message

* extend message

* nit

* Change environment.py to metaflow_environment.py

environment.py clashes with @Environment and results in
pylint throwing up a E1102: environment is not callable (not-callable)

* Change environment.py to metaflow_environment.py

environment.py clashes with @Environment and results in
pylint throwing up a E1102: environment is not callable (not-callable)

* Fix issues with @Environment (#452)

* Fix issues with @Environment

context https://gitter.im/metaflow_org/community?at=604a2bfb44f5a454a46cc7f8

* add more comments

* roll back to previous commit

* Patch version bump for release (#453)

* Fix typos (#455)

* Fix ordering of custom parameters in help text (#456)

* Display custom parameter help-text options in definition order

Custom parameters are iteratively inserted into the front of the command
parameters list. Doing so in reverse preserves the order in which they
are defined in the FlowSpec.

* Remove unused import

* Comment on help-text ordering fix

* Allow more than two slashes to be in a docker image. (#466)

* Update metaflow/mflog/mflog.py

Co-authored-by: Oleg Avdeev <oleg.v.avdeev@gmail.com>

* fixes

* fixups

* mo' fixes

Co-authored-by: David Poznik <dpoznik@users.noreply.github.com>
Co-authored-by: Ryan Chui <ryanc@23andme.com>
Co-authored-by: Oleg Avdeev <oleg.v.avdeev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants