CI_REGISTRY not exported while running CI/CD

HI,
I’m running local GitLab 13.11.3-ce on Ubuntu 20.04

After succesful build I can’t push image as my CI_REGISTRY and CI_REGISTRY_IMAGE are not exported at all.
For the sole purpose of testing, I have even created a completely empty project with public permissions and enabled registry (that was already enabled by default) and put a simple .gitlab-ci.yml:

stages:
  - build

build-and-push:
  stage: build
  environment:
    name: docker-test2
  script:
    - echo "Building a Docker image!"
    - echo $CI_REGISTRY
    - export
  only:
    changes:
      - "*"

This simple pipeline gets triggered and has following output:

Executing “step_script” stage of the job script 00:00
$ echo “Building a Docker image!”
Building a Docker image!
$ echo $CI_REGISTRY
$ export
declare -x CI=“true”
declare -x CI_API_V4_URL=“https://git.mydomain.com/api/v4
declare -x CI_BUILDS_DIR="/builds"
declare -x CI_BUILD_BEFORE_SHA=“7adcc950794edb2afe10f5066437d6dd2be17313”
declare -x CI_BUILD_ID=“216”
declare -x CI_BUILD_NAME=“build-and-push-test2”
declare -x CI_BUILD_REF=“6aa7029a7f08a3df621b10cc27ae9246badd4dbd”
declare -x CI_BUILD_REF_NAME=“master”
declare -x CI_BUILD_REF_SLUG=“master”
declare -x CI_BUILD_STAGE=“diff-and-build”
declare -x CI_BUILD_TOKEN="[MASKED]"
declare -x CI_COMMIT_AUTHOR=“Marsplay marsplay@marsplay.com
declare -x CI_COMMIT_BEFORE_SHA=“7adcc950794edb2afe10f5066437d6dd2be17313”
declare -x CI_COMMIT_BRANCH=“master”
declare -x CI_COMMIT_DESCRIPTION=""
declare -x CI_COMMIT_MESSAGE="."
declare -x CI_COMMIT_REF_NAME=“master”
declare -x CI_COMMIT_REF_PROTECTED=“true”
declare -x CI_COMMIT_REF_SLUG=“master”
declare -x CI_COMMIT_SHA=“6aa7029a7f08a3df621b10cc27ae9246badd4dbd”
declare -x CI_COMMIT_SHORT_SHA=“6aa7029a”
declare -x CI_COMMIT_TIMESTAMP=“2021-05-02T09:45:32+02:00”
declare -x CI_COMMIT_TITLE="."
declare -x CI_CONCURRENT_ID=“0”
declare -x CI_CONCURRENT_PROJECT_ID=“0”
declare -x CI_CONFIG_PATH=".gitlab-ci.yml"
declare -x CI_DEFAULT_BRANCH=“master”
declare -x CI_DISPOSABLE_ENVIRONMENT=“true”
declare -x CI_ENVIRONMENT_NAME=“docker-test2”
declare -x CI_ENVIRONMENT_SLUG=“docker-test2”
declare -x CI_JOB_ID=“216”
declare -x CI_JOB_JWT="[MASKED]"
declare -x CI_JOB_NAME=“build-and-push-test2”
declare -x CI_JOB_STAGE=“diff-and-build”
declare -x CI_JOB_STARTED_AT=“2021-05-02T05:45:42-02:00”
declare -x CI_JOB_STATUS=“running”
declare -x CI_JOB_TOKEN="[MASKED]"
declare -x CI_JOB_URL=“https://git.mydomain.com/root/test2/-/jobs/216
declare -x CI_KUBERNETES_ACTIVE=“true”
declare -x CI_NODE_TOTAL=“1”
declare -x CI_PAGES_DOMAIN=“example.com
declare -x CI_PAGES_URL=“http://root.example.com/test2
declare -x CI_PIPELINE_CREATED_AT=“2021-05-02T05:45:38-02:00”
declare -x CI_PIPELINE_ID=“54”
declare -x CI_PIPELINE_IID=“6”
declare -x CI_PIPELINE_SOURCE=“push”
declare -x CI_PIPELINE_URL=“https://git.mydomain.com/root/test2/-/pipelines/54
declare -x CI_PROJECT_CONFIG_PATH=".gitlab-ci.yml"
declare -x CI_PROJECT_DIR="/builds/root/test2"
declare -x CI_PROJECT_ID=“12”
declare -x CI_PROJECT_NAME=“test2”
declare -x CI_PROJECT_NAMESPACE=“root”
declare -x CI_PROJECT_PATH=“root/test2”
declare -x CI_PROJECT_PATH_SLUG=“root-test2”
declare -x CI_PROJECT_REPOSITORY_LANGUAGES=""
declare -x CI_PROJECT_ROOT_NAMESPACE=“root”
declare -x CI_PROJECT_TITLE=“test2”
declare -x CI_PROJECT_URL=“https://git.mydomain.com/root/test2
declare -x CI_PROJECT_VISIBILITY=“public”
declare -x CI_REGISTRY_PASSWORD="[MASKED]"
declare -x CI_REGISTRY_USER=“gitlab-ci-token”
declare -x CI_REPOSITORY_URL=“https://gitlab-ci-token:[MASKED]@git.mydomain.com/root/test2.git”
declare -x CI_RUNNER_DESCRIPTION=“K8s-Worker”
declare -x CI_RUNNER_EXECUTABLE_ARCH=“linux/amd64”
declare -x CI_RUNNER_ID=“2”
declare -x CI_RUNNER_REVISION=“54944146”
declare -x CI_RUNNER_SHORT_TOKEN=“iEstQd18”
declare -x CI_RUNNER_TAGS=“kubernetes, cluster”
declare -x CI_RUNNER_VERSION=“13.10.0”
declare -x CI_SERVER=“yes”
declare -x CI_SERVER_HOST=“git.mydomain.com
declare -x CI_SERVER_NAME=“GitLab”
declare -x CI_SERVER_PORT=“443”
declare -x CI_SERVER_PROTOCOL=“https”
declare -x CI_SERVER_REVISION=“b321336e443”
declare -x CI_SERVER_TLS_CA_FILE="/builds/root/test2.tmp/CI_SERVER_TLS_CA_FILE"
declare -x CI_SERVER_URL=“https://git.mydomain.com
declare -x CI_SERVER_VERSION=“13.11.3”
declare -x CI_SERVER_VERSION_MAJOR=“13”
declare -x CI_SERVER_VERSION_MINOR=“11”
declare -x CI_SERVER_VERSION_PATCH=“3”
declare -x FF_CMD_DISABLE_DELAYED_ERROR_LEVEL_EXPANSION=“false”
declare -x FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR=“false”
declare -x FF_ENABLE_BASH_EXIT_CODE_CHECK=“false”
declare -x FF_GITLAB_REGISTRY_HELPER_IMAGE=“false”
declare -x FF_NETWORK_PER_BUILD=“false”
declare -x FF_RESET_HELPER_IMAGE_ENTRYPOINT=“true”
declare -x FF_SHELL_EXECUTOR_USE_LEGACY_PROCESS_KILL=“false”
declare -x FF_SKIP_NOOP_BUILD_STAGES=“true”
declare -x FF_USE_DIRECT_DOWNLOAD=“true”
declare -x FF_USE_FASTZIP=“false”
declare -x FF_USE_GO_CLOUD_WITH_CACHE_ARCHIVER=“true”
declare -x FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY=“true”
declare -x FF_USE_WINDOWS_LEGACY_PROCESS_STRATEGY=“true”
declare -x GITLAB_CI=“true”
declare -x GITLAB_FEATURES=""
declare -x GITLAB_USER_EMAIL=“myemail”
declare -x GITLAB_USER_ID=“2”
declare -x GITLAB_USER_LOGIN=“mylogin”
declare -x GITLAB_USER_NAME=“mylogin”
declare -x HOME="/root"

Cleaning up file based variables 00:01
Job succeeded

I have googled all around but didn’t find any clues for this issue. I have also updated the GitLab from 13.11.1 (that was my initial installation to 13.11.3, but no luck.

There are no CI_REGISTRY or CI_REGISTRY_IMAGE and I’m bumping my head with this, any ideas or suggestions are welcome!

Thanks

SOLVED sorry if I was spamming.

if anyone will have similar issue in the furure this is how I solved it:

gitlab.rb didn’t have the registry enabled and url with port wasn’t configured

registry[‘enable’] = true
registry_external_url ‘https://git.yourdomain.com:5050

It would be of great help if only UI would not show registry in the menu without any notification, falsely leading user to conclusion that registry is setup and working when it’s NOT!

1 Like

Thanks for posting your solution. Was driving me crazy for an afternoon until I came across your solution. I hope the devs make this a lot more obvious as well.