Skip to content

Fixed the pod label and annotation escaping

Tommy Seus requested to merge tommyseus/gitlab-runner:pod-labels-squote into master

Fixed the pod label and annotation escaping. Added support to use environment variables for the pod labels and pod annotations.

example-configuration: (old fix)

runners:
  podLabels:
    gitlab-runner/ci-project-path-slug: "$CI_PROJECT_PATH_SLUG"

issue:

quote: "$CI_PROJECT_PATH_SLUG" => empty string, because bash
squote: '$CI_PROJECT_PATH_SLUG' => untouched, same as in the values.yaml

Updated the merge request (2019-08-01)

Created a new values node to add the pipeline environment vars to the pod labels and annotations

example-configuration:

runners:
  podEnvLabels:
    gitlab-runner/ci-pipeline-id: "$CI_PIPELINE_ID"
    gitlab-runner/ci-project-path-slug: "$CI_PROJECT_PATH_SLUG"
  
  podEnvAnnotations:
    gitlab-runner/ci-build-name: "$CI_BUILD_NAME"
    gitlab-runner/ci-build-stage: "$CI_BUILD_STAGE"
    gitlab-runner/ci-job-id: "$CI_JOB_ID"
    gitlab-runner/ci-job-url: "$CI_JOB_URL"
    gitlab-runner/ci-project-path: "$CI_PROJECT_PATH"
    gitlab-runner/gitlab-user-name: "$GITLAB_USER_NAME"
Edited by 🤖 GitLab Bot 🤖

Merge request reports