CI_COMMIT_REF_SLUG is not safe to name docker image because of pass multiply '-'
# .gitlab-ci.yaml
...
variables:
BUILD_TARGET: bcoin
IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}-issue/api_php
before_script:
- docker info
- echo "$CI_JOB_TOKEN" | docker login -u gitlab-ci-token <my_gitlab> --password-stdin
script:
- docker build --pull -t ${IMAGE_NAME} --target=$BUILD_TARGET $BUILD_CONTEXT
- docker push ${IMAGE_NAME}
...
If i have more than one MergeRequest for issue with non-ASCII title, it generates branch with name like 432--2 (fist branch is 432-)
<my_gitlab>/<group>/<project>/432--2-issue/api_php - this name is valid for local registry on build host.
But, if i'll try to push it to self-hosted gitlab registry, my build host will be banned by ip. Forever. It`s pain. Epic fail!
I am an gitlab sysadmin and i can resolve it: https://docs.gitlab.com/ee/security/rack_attack.html#remove-blocked-ips-from-rack-attack-via-redis
But what about others regular developers? What about cloud gitlab? Imho:
-
quiet unlimited ban is too angry protection
-
SLUG shoud replace multiply '-' to one everywhere.
432--2to432-2
Edited by Denis Chernosov