Closed alexcb closed 3 years ago
I see two issues here:
gitlab.com/alexcb/privproj
doesn't look like a valid git URLGIT CLONE
command. But perhaps there are good reasons to support this.I changed my earthfile to:
WORKDIR /environ
private:
GIT CLONE \
--branch=master \
https://gitlab.com/alexcb/privproj.git .
public:
GIT CLONE \
--branch=main \
github.com/earthly/earthly .
and it's still not working.
here's a potential test-case showing this issue: https://github.com/earthly/earthly/pull/709
I don't think we should be using the git auth configured in Earthly for the GIT CLONE command. But perhaps there are good reasons to support this.
BTW, I realized that our docs say that we support this.
Same issue with a private bitbucket repo : fatal: could not read Username for 'https://bitbucket.org': terminal prompts disabled
.
I'm also experiencing this on GitHub with GitHub actions.
Link to Slack discussion https://earthlycommunity.slack.com/archives/C01DL2928RM/p1615570638014000
I've been experiencing the same issue as well.
Initially, I had used the workaround suggested here: https://earthlycommunity.slack.com/archives/C01DL2928RM/p1610568364141300?thread_ts=1610505194.098400&cid=C01DL2928RM
Lately, though, I've found that a combination of secrets in .env
and a small git credential helper made my workflow a little smoother when requiring multiple sets of credentials.
.env
GITHUB_USER_FOO=foo
GITHUB_TOKEN_FOO=footoken
GITHUB_USER_BAR=bar
GITHUB_TOKEN_BAR=bartoken
Earthfile
FROM goboring/golang:1.15.8b5
WORKDIR /app
RUN git config --global credential.helper '!p() { printf "username=${GIT_USER}\npassword=${GIT_PASS}"; }; p'
clone:
RUN --secret GIT_PASS=+secrets/GITHUB_TOKEN_FOO --secret GIT_USER=+secrets/GITHUB_USER_FOO \
git clone https://github.com/foo/foo-proto.git
RUN --secret GIT_PASS=+secrets/GITHUB_TOKEN_BAR --secret GIT_USER=+secrets/GITHUB_USER_BAR \
git clone https://github.com/bar/bar-app.git
Consider an Earthfile like:
I can run
earthly +public
without any issues; however when I try to run it against my private repo withearthly +private
, it fails with:This is with
~/.earthly/config.yml
:however the auth works when I reference the git repo on the command line via:
earthly gitlab.com/alexcb/privproj+docker