Skip to content

Fix make prepare_index read GPG_KEY from file

What does this MR do?

Use the file function in make to read the file instead of cat. This escapes the new lines of the GPG_KEY_PATH content properly. More information about the file function can be found in https://www.gnu.org/software/make/manual/html_node/File-Function.html

Why was this MR needed?

In !2958 (merged) we changed the GPG_KEY and GPG_PASSPHRASE to be file based CI/CD variables rather then environment base. However we started seeing failures that the gpg key could not be loaded such as https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/1372115967.

In #28008 (comment 610274443) we see that when we use cat it doesn't escpae the newlines properly.

What's the best way to test this MR?

docker run --rm -it -v $PWD:/code -w /code registry.gitlab.com/gitlab-org/gitlab-runner/ci:1.13.8-12
# Create /tmp/gpg_key with GPG key content
# Create /tmp/gpg_passphrase with passphrase content

export GPG_KEY_PATH=/tmp/gpg_key
export GPG_PASSPHRASE_PATH=/tmp/gpg_passphrase
make prepare_index

What are the relevant issue numbers?

Closes #28008 (closed)

Merge request reports