Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Do not download ngrok everytime during testdrive if in /tmp cache #2323

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions testdrive/testdrive.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,22 @@ Follow these instructions to create a token (we don't store any tokens):
colorstring.Println("[green]=> terraform found in $PATH![reset]")
}

// Download ngrok.
colorstring.Println("=> downloading ngrok ")
s.Start()
ngrokURL := fmt.Sprintf("%s/ngrok-stable-%s-%s.zip", ngrokDownloadURL, runtime.GOOS, runtime.GOARCH)
if err = downloadAndUnzip(ngrokURL, "/tmp/ngrok.zip", "/tmp"); err != nil {
return errors.Wrapf(err, "downloading and unzipping ngrok")
// Detect /tmp/ngrok and install it if not installed.
_, err := exec.LookPath("/tmp/ngrok")
if err != nil {
colorstring.Println("[yellow]=> ngrok not found in $PATH.[reset]")
colorstring.Println("=> downloading ngrok ")
s.Start()
ngrokDownloadURL := fmt.Sprintf("%s/ngrok-stable-%s-%s.zip", ngrokDownloadURL, runtime.GOOS, runtime.GOARCH)
if err = downloadAndUnzip(ngrokDownloadURL, "/tmp/ngrok.zip", "/tmp"); err != nil {
return errors.Wrapf(err, "downloading and unzipping ngrok")
}

colorstring.Println("[green]=> downloaded ngrok successfully![reset]")
} else {
colorstring.Println("[green]=> ngrok found in $PATH![reset]")
}
s.Stop()
colorstring.Println("[green]=> downloaded ngrok successfully![reset]")

// Create ngrok tunnel.
colorstring.Println("=> creating secure tunnel")
Expand Down