I am following the steps at Git-Clone · Codefresh | Docs in order to obtain a GitHub access token from the codefresh git integration. When the freestyle stage runs a command such as:
- git clone https://my-github-username:$GITHUB_TOKEN@github.com/my-github-username/my-repo.git
Then the codefresh build log will include the actual value of the GITHUB_TOKEN
, rather than a masked version.
(in my case I’m actually updating the origin of the repository cloned by main_clone
so that it includes the GITHUB_TOKEN
and I am able to push back commits after bumping version numbers - but it is similar in sentiment)
The only solution I have is to inline the command which fetches the token as such:
- git clone https://my-github-username:$(codefresh get context github --decrypt -o yaml | yq -r .spec.data.auth.password)@github.com/my-github-username/my-repo.git
but that is quite messy, and I’d rather extract the value to a variable.
Has anybody else done this in such a way that the github token is not leaked to the build?