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

Tag wrongly gets parsed as octal #311

Closed
VengefulAncient opened this issue Dec 17, 2020 · 2 comments
Closed

Tag wrongly gets parsed as octal #311

VengefulAncient opened this issue Dec 17, 2020 · 2 comments

Comments

@VengefulAncient
Copy link

VengefulAncient commented Dec 17, 2020

Plugin step configuration:

- name: build-docker
  image: plugins/docker
  settings:
    username:
      from_secret: docker-username
    password:
      from_secret: docker-password
    repo: registry.gitlab.com/${DRONE_REPO}
    registry: registry.gitlab.com
    tags:
    - ${DRONE_COMMIT_SHA:0:7}
    - ${DRONE_TARGET_BRANCH}

${DRONE_COMMIT_SHA:0:7} resolves to 0351500 in the run where we encountered this error. Resulting Docker command:

/usr/local/bin/docker tag 0351500<the rest of the full commit hash>
registry.gitlab.com/<our repository>:119616

Testing confirms that 0351500 as octal converts to 119616 in decimal. This is reproducible with fmt.Println in Go, but the plugin should sanitize input correctly regardless and parse tags only as strings. Presently, the plugin applies an incorrect tag and breaks the rest of the pipeline, since the resulting image cannot be correctly referenced by the subsequent steps.

@tboerger
Copy link

You should always quote variables that could start with digits like commit SHAs, than it is correctly handled. AFAIK it's simply a downside of YAML parsing.

@VengefulAncient
Copy link
Author

Thanks and apologies for the erroneous report in this case. I was not aware of this behaviour from YAML.

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

No branches or pull requests

2 participants