1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

feat: remote taskfiles (HTTP) (#1152)

* feat: remote taskfiles over http

* feat: allow insecure connections when --insecure flag is provided

* feat: better error handling for fetch errors

* fix: ensure cache directory always exists

* fix: setup logger before everything else

* feat: put remote taskfiles behind an experiment

* feat: --download and --offline flags for remote taskfiles

* feat: node.Read accepts a context

* feat: experiment docs

* chore: changelog

* chore: remove unused optional param from Node interface

* chore: tidy up and generalise NewNode function

* fix: use sha256 in remote checksum

* feat: --download by itself will not run a task

* feat: custom error if remote taskfiles experiment is not enabled

* refactor: BaseNode functional options and simplified FileNode

* fix: use hex encoding for checksum instead of b64
This commit is contained in:
Pete Davison
2023-09-12 16:42:54 -05:00
committed by GitHub
parent 84ad0056e4
commit 22ce67c5e5
19 changed files with 611 additions and 120 deletions

View File

@@ -2,6 +2,7 @@ package experiments
import (
"fmt"
"io"
"os"
"strings"
"text/tabwriter"
@@ -13,11 +14,16 @@ import (
const envPrefix = "TASK_X_"
var GentleForce bool
// A list of experiments.
var (
GentleForce bool
RemoteTaskfiles bool
)
func init() {
readDotEnv()
GentleForce = parseEnv("GENTLE_FORCE")
RemoteTaskfiles = parseEnv("REMOTE_TASKFILES")
}
func parseEnv(xName string) bool {
@@ -35,10 +41,15 @@ func readDotEnv() {
}
}
func List(l *logger.Logger) error {
w := tabwriter.NewWriter(os.Stdout, 0, 8, 6, ' ', 0)
func printExperiment(w io.Writer, l *logger.Logger, name string, value bool) {
l.FOutf(w, logger.Yellow, "* ")
l.FOutf(w, logger.Green, "GENTLE_FORCE")
l.FOutf(w, logger.Default, ": \t%t\n", GentleForce)
l.FOutf(w, logger.Green, name)
l.FOutf(w, logger.Default, ": \t%t\n", value)
}
func List(l *logger.Logger) error {
w := tabwriter.NewWriter(os.Stdout, 0, 8, 0, ' ', 0)
printExperiment(w, l, "GENTLE_FORCE", GentleForce)
printExperiment(w, l, "REMOTE_TASKFILES", RemoteTaskfiles)
return w.Flush()
}