Current Behaviour
Currently there's no way to use GitLab container registry as part of the deployment, the reason is URLs of the registry are slightly different than the ones available in other registries (e.g. DockerHub).
- GitLab:
https://registry.example.com/group/project:tag
- GitLab:
https://registry.example.com/group/project/image:tag (extra /<foo> is valid in gitlab, up to three level deep)
- DockerHub:
group/project:tag (simplified for the sake of writing here)
The relevant part of the code is here:
|
if sharedRepo { |
|
imageRef = registry[:len(registry)-1] + "/" + owner + "-" + repo + "-" + imageName |
|
} else { |
|
imageRef = registry + "/" + owner + "/" + repo + "-" + imageName |
|
} |
Note that imageName is being appended to repo by a -, which breaks gitlab registry. Considering the project exists at https://git.example.com/group/project:
- Invalid:
https://registry.example.com/group/project-latest-master-<sha>
- Valid:
https://registry.example.com/group/project:latest-master-<sha>
- Valid:
https://registry.example.com/group/project/fn-name:latest-master-<sha>
On the same topic and slightly different issue (let me know if you'd like me to open another issue for this), owner in the code above (line 205 and 207) in GitLab depends on the profile. Considering user name of khos2ow and full profile name of Khosrow Moossavi, owner will be set to full profile name which breaks the URL format. Considering the project exists at https://git.example.com/khos2ow/project:
- Invalid:
https://registry.example.com/Khosrow Moossavi/project:latest-master-<sha>
- Expected:
https://registry.example.com/khos2ow/project:latest-master-<sha>
Possible Solution
- First issue: Intelligently choose
/ over - when building image only for GitLab container registry.
- Second issue: haven't investigated further to see what would be available
Current Behaviour
Currently there's no way to use GitLab container registry as part of the deployment, the reason is URLs of the registry are slightly different than the ones available in other registries (e.g. DockerHub).
https://registry.example.com/group/project:taghttps://registry.example.com/group/project/image:tag(extra/<foo>is valid in gitlab, up to three level deep)group/project:tag(simplified for the sake of writing here)The relevant part of the code is here:
openfaas-cloud/git-tar/function/ops.go
Lines 204 to 208 in b1dc3f0
Note that
imageNameis being appended torepoby a-, which breaks gitlab registry. Considering theprojectexists athttps://git.example.com/group/project:https://registry.example.com/group/project-latest-master-<sha>https://registry.example.com/group/project:latest-master-<sha>https://registry.example.com/group/project/fn-name:latest-master-<sha>On the same topic and slightly different issue (let me know if you'd like me to open another issue for this),
ownerin the code above (line205and207) in GitLab depends on the profile. Considering user name ofkhos2owand full profile name ofKhosrow Moossavi,ownerwill be set to full profile name which breaks the URL format. Considering theprojectexists athttps://git.example.com/khos2ow/project:https://registry.example.com/Khosrow Moossavi/project:latest-master-<sha>https://registry.example.com/khos2ow/project:latest-master-<sha>Possible Solution
/over-when building image only for GitLab container registry.