yalegria / devops-git-actions

0 stars 0 forks source link

Create a new Workflow to deploy code to Docker image. #34

Closed yalegria closed 1 year ago

yalegria commented 1 year ago

I found out a very interesting thing on how Github Actions security features work. The username and name of my account on DockerHub is the same. I use a github secret for my username and password but then I was trying to use the same secret to reference my account on the build Docker command, but always the string was substituted with three asteriks (***). So I understood using a secret as a variable to be replaced on a command wont work. Then I tried to hard code my account name, but still the command contain the three asterisks. I found out that GitHub Actions substitute automatically any string that matches one of your secret values as a security feature.

Now the question is how can I replace it correctly or use the hard coded value without letting GitHub Actions replaced my string?...let's find out!

yalegria commented 1 year ago

I ended up removing the secret for the username, so I can use the hard coded value for my DockerHub username. There is this concept of environments in GitHub Actions but won't help the issue I faced here.

I would create a new bug ticket to keep a log of the blocker in this issue but in order to continue I had a workaround as described above.

The image was successfully pushed to DockerHub.