AWS credentials can’t be read from gitlab-ci variable

Kun-Hung Tsai
1 min readFeb 28, 2020

--

Recently I noticed that the deplop step of my gitlab-ci pipeline failed to upload my result to AWS S3. The error message was “An error occurred (AccessDenied) when calling the PutObject operation: Access Denied”However, I have make sure that AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set in my repository CI/CD variables.

After several examinations, I found that the variables were not being set in the container environment for my gitlab-ci pipeline (the echo results of $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY are empty) and I also noticed that the “protected” state of my variables is set to “on”.

Then I found a gitlab runner issue indicating that if the “protected” state of variable is “on”. It will only take effect on protected branch and that the reason why the environment variables of my gitlab-ci pipeline, which is activated by an unprotected branch is not be set correctly.

Sign up to discover human stories that deepen your understanding of the world.

--

--

Kun-Hung Tsai
Kun-Hung Tsai

Responses (1)

Write a response