Skip to content

CI Variable with multiple lines are not parsed correctly

Summary

When gitlab passes K8S_SECRET variables to the auto-deploy script, variables that are multiline are not parsed correctly and only the first line is inserted as a secret.

Steps to reproduce

Make use of auto-devops and create a multi line environment variable. I made the following:

image

However, once deployed, I only see this in kubernetes:

image

This is an identical issue to gitlab-org/gitlab#38262 (closed) - where they have setup a demo project showcasing the issue. The issue is related to this line of code: https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/blob/2a50aa57135d8c0252d9dbf55eeb812966e0e74d/src/bin/auto-deploy#L299

What is the current bug behavior?

The secret is created with only the first line of the variable value.

What is the expected correct behavior?

Gitlab should load the value of the variable with the line breaks.

Relevant logs and/or screenshots

https://gitlab.com/natvaldev/env-var-bug/-/jobs/370574277