Invalid repository failure if the github organization is all uppercase
coryramirez opened this issue · 4 comments
Trying to publish an image with the following step:
- name: publish
image: plugins/docker
settings:
repo: registry/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}
registry: registry
insecure: true
custom_dns: ip
auto_tag: true
when:
status:
- success
event:
- tag
Returns:
Error parsing reference: "registry/UPPERCASE-ORG/repo:1" is not a valid repository/tag: invalid reference format: repository name must be lowercase
--
117 | time="2019-09-03T21:32:30Z" level=fatal msg="exit status 1"
Seems odd. Anyway we can at the very least have it checked and converted to lowercase, instead of just flat out failing? This requires me to hardcode the org within my pipeline, and I don't want to do that.
The plugin won't manipulate names on his own. If you provide the parameter you got to take care that it got a valid format. Beside that does drone support string manipulation functions inspired by bash which provides a substitution to lowercase a specific variable, you can find the docs at https://docker-runner.docs.drone.io/configuration/environment/substitution.
Just to clarify, this plugin does not modify these variables. The value for DRONE_REPO_OWNER
comes from the repos.repo_namespace
field in the Drone database, which itself is populated based on the data returned from the your source control management system API (for example /api/user/repos
when using GitHub).
I'm aware. I'm just asking why that validation exists in the first place? If you're validating it, why not just convert it? Doesn't make sense pragmatically to me.. especially when users would have to:
A) Hard code the value, or;
B) Convince a large, thousand-member organization to reconsider their GitHub naming conventions.
Hopefully you see my point...
Hi Cory, this plugin does not perform any name validations. This error comes from Docker [1]. Please note that most people do hard code the value which I think is perfectly fine (we do this for all 100+ drone projects that use this plugin). If you prefer to build these values dynamically you can use the bash string functions to convert to lowercase.
A) Hard code the value, or;
B) Convince a large, thousand-member organization to reconsider their GitHub naming conventions.
I also wanted to point out a third option that is frequently used by large companies:
C) fork the plugin and use the forked version in your organization. This is common practice at many large companies that want to use a plugin, but want to add custom logic, automatically default values, and enforce company naming conventions.