Bug 47621

Summary: http: invalid Host header при запуске с Docker
Product: Sisyphus Reporter: Evgeny Shesteperov <alimektor>
Component: gitlab-runnerAssignee: bne <bne>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P5 CC: bne
Version: unstable   
Hardware: x86_64   
OS: Linux   

Description Evgeny Shesteperov 2023-09-16 18:53:29 MSK
Версия

- gitlab-runner-16.1.1-alt2

Предусловия

Установленные пакеты:

    # apt-get install -y  docker-engine docker-cli

Запустить сервис Docker:

    # systemctl enable --now docker && sleep 5; systemctl status docker --no-pager -l

    $ cat .gitlab-ci.yml 
    build-job:
      stage: build
      script:
        - echo "Hello, $GITLAB_USER_LOGIN!"

    test-job1:
      stage: test
      script:
        - echo "This job tests something. Current project dir is $CI_PROJECT_DIR"

    test-job2:
      stage: test
      script:
        - echo "This job tests something, but takes more time than test-job1."
        - echo "After the echo commands complete, it runs the sleep command for 20 seconds"
        - echo "which simulates a test that runs 20 seconds longer than test-job1"
        - sleep 20

    deploy-prod:
      stage: deploy
      script:
        - echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
      environment: production

Шаги воспроизведения

1.  Зарегистрировать новый Gitlab Runner без привязки по тегу:

        # gitlab-runner register --url <URL> --token <TOKEN>

2.  При запросе Enter the GitLab instance URL оставить по умолчанию.

3.  При запросе Enter a name for the runner. This is stored only in the
    local config.toml file ввести test-docker

4.  При запросе Enter an executor: kubernetes, parallels, ssh,
    docker+machine, shell, virtualbox, docker-autoscaler, instance,
    custom, docker, docker-windows ввести docker

5.  При запросе Enter the default Docker image ввести alt:p10

6.  Запустить Pipelines. В моём случае я просто делаю триггер:

    git commit -m "Trigger" --allow-empty; git push -f

Ожидаемый результат: успешно пройденный Pipelines.

Фактический результат: ошибка

    Running with gitlab-runner development version (HEAD)
      on test-docker ePq3W8uE5, system ID: s_bbb741e10f56
    Preparing the "docker" executor 00:29
    Using Docker executor with image alt:p10 ...
    Using helper image:  registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest
    Pulling docker image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest ...
    Using docker image sha256:9ab1df015c0e63f25557060d6f85f0bdfc36969377bc3386e8202dde19fc93bf for registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest with digest registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper@sha256:9ce1f2b4d50a3a43b23890e322e3d9c1989c70b073ad54375367b1fc5344ae08 ...
    Pulling docker image alt:p10 ...
    Using docker image sha256:62a39dae75c8d838ab276d88806e5d2c13b0b753112b8946388bd1b70b8bf5bd for alt:p10 with digest alt@sha256:e9252bbd8730f12a12a4434ae6dd058ab542312c826e0ae16b312f3724697379 ...
    Preparing environment 00:00
    ERROR: Job failed (system failure): prepare environment: http: invalid Host header (exec.go:71:0s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

Я предполагаю, что это свежий баг в апстриме:

-   https://gitlab.com/gitlab-org/gitlab-runner/-/issues/36051
Comment 1 Repository Robot 2024-03-21 23:00:04 MSK
gitlab-runner-16.9.1-alt1 -> sisyphus:

 Wed Mar 20 2024 Nikolay Burykin <bne@altlinux> 16.9.1-alt1
 - New version 16.9.1
 - Fix:
   + "/root/.bash_profile: Permission denied" when use shell as an executor (ALT #47620)
   + failure prepare environment step, when use Docker as an executor (ALT #47621)