Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

gps: vcs: suppress git password prompts #1357

Merged
merged 2 commits into from
Nov 14, 2017
Merged

gps: vcs: suppress git password prompts #1357

merged 2 commits into from
Nov 14, 2017

Conversation

jmank88
Copy link
Collaborator

@jmank88 jmank88 commented Nov 8, 2017

What does this do / why do we need it?

This change suppresses git password prompts in more places. Cherry picked from #1250 (f1f0bac).

Which issue(s) does this PR fix?

It might fix: #1356

@jmank88
Copy link
Collaborator Author

jmank88 commented Nov 8, 2017

tip $GOCACHE CI failures:

testproj.go:112: go standard error:
testproj.go:113: initializing cache in $GOCACHE: mkdir /test-dep-home-does-not-exist: permission denied

@@ -92,6 +92,8 @@ func (r *gitRepo) get(ctx context.Context) error {
r.Remote(),
r.LocalPath(),
)
// Ensure no prompting for PWs
cmd.SetEnv(append([]string{"GIT_ASKPASS=", "GIT_TERMINAL_PROMPT=0"}, os.Environ()...))
Copy link
Collaborator

@carolynvs carolynvs Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When dep runs git commands, does it inherit our current environment variables? I'm wondering if we can just set the environment variable once, instead of directly on the git command?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure - I copied from this:

dep/gps/vcs_source.go

Lines 241 to 246 in 80e94e8

func (s *gitSource) listVersions(ctx context.Context) (vlist []PairedVersion, err error) {
r := s.repo
cmd := commandContext(ctx, "git", "ls-remote", r.Remote())
// Ensure no prompting for PWs
cmd.SetEnv(append([]string{"GIT_ASKPASS=", "GIT_TERMINAL_PROMPT=0"}, os.Environ()...))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha, yeah it doesn't inherit any environment variables then. 👍

@jmank88
Copy link
Collaborator Author

jmank88 commented Nov 14, 2017

This now includes a bonus commit to resolve some intermittent appveyor failures.

@carolynvs
Copy link
Collaborator

If you fix our AppVeyor builds I owe you a lb of chocolates and your beverage of choice! 👍

@sdboyer sdboyer merged commit 832c144 into golang:master Nov 14, 2017
@jmank88 jmank88 deleted the git-prompt branch November 14, 2017 22:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Username prompt from code.cloudfoundry.org/cli, then seems to hang
5 participants