Forward entrypoint logs
What does this MR do?
For the k8s executor: forwards logs emitted by the container's entrypoint from the k8s api to the build logger, iff FF_KUBERNETES_HONOR_ENTRYPOINT is set.
Why was this MR needed?
To make sure, users see all logs they'd expect and to reach parity with the docker executor.
What's the best way to test this MR?
go test -count=1 -tags=kubernetes,integration -v -run '(?i).*entry.*' ./executors/kubernetes/
go test -count=1 -v -run '(?i).*entry.*' ./executors/kubernetes/
Use
-
this
config.toml
listen_address = ":9252" concurrent = 1 check_interval = 1 log_level = "debug" connection_max_age = "15m0s" shutdown_timeout = 0 [session_server] session_timeout = 1800 [[runners]] name = "hhoerl-gitlab" url = "https://gitlab.com" id = 40502329 token = "glrt-NOPENOPENOPE" token_obtained_at = 2024-08-09T13:39:07Z token_expires_at = 0001-01-01T00:00:00Z executor = "kubernetes" shell = "bash" [runners.kubernetes] host = "" image = "alpine"
-
and this
gitlab-ci.yaml
stages: - test test: variables: CI_DEBUG_SERVICES: true FF_SCRIPT_SECTIONS: true FF_PRINT_POD_EVENTS: true FF_RETRIEVE_POD_WARNING_EVENTS: true FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: false ## <- toggle this FF_KUBERNETES_HONOR_ENTRYPOINT: true ## <- toggle this stage: test services: - name: postgres:11.6 image: name: registry.gitlab.com/gitlab-org/gitlab-runner/alpine-entrypoint-pre-post-trap # name: registry.gitlab.com/gitlab-org/gitlab-runner/powershell-entrypoint-pre-post-trap script: - echo "hello world"
against a GitLab instance and see
- the job succeed
- the job log shows the entrypoint logs
What are the relevant issue numbers?
closes: #37468 (closed)
Edited by Hannes Hörl