sg: add install func for Jaeger (#36726)

* sg: add install func for Jaeger

* Update dev/sg/internal/run/run.go

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
This commit is contained in:
Jean-Hadrien Chabran 2022-06-07 17:46:15 +02:00 committed by GitHub
parent 27276142de
commit e3212ab04a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 14 deletions

View File

@ -307,6 +307,31 @@ var installFuncs = map[string]installFunc{
return download.ArchivedExecutable(ctx, url, target, "caddy")
},
"installJaeger": func(ctx context.Context, env map[string]string) error {
version := env["JAEGER_VERSION"]
// Make sure the data folder exists.
disk := env["JAEGER_DISK"]
if err := os.MkdirAll(disk, 0755); err != nil {
return err
}
if version == "" {
return errors.New("could not find JAEGER_VERSION in env")
}
root, err := root.RepositoryRoot()
if err != nil {
return err
}
archiveName := fmt.Sprintf("jaeger-%s-%s-%s", version, runtime.GOOS, runtime.GOARCH)
url := fmt.Sprintf("https://github.com/jaegertracing/jaeger/releases/download/v%s/%s.tar.gz", version, archiveName)
target := filepath.Join(root, fmt.Sprintf(".bin/jaeger-all-in-one-%s", version))
return download.ArchivedExecutable(ctx, url, target, fmt.Sprintf("%s/jaeger-all-in-one", archiveName))
},
}
func runWatch(

View File

@ -516,20 +516,7 @@ commands:
jaeger:
cmd: |
.bin/jaeger-all-in-one-${JAEGER_VERSION} --log-level ${JAEGER_LOG_LEVEL}
install: |
set -e
mkdir -p "${JAEGER_DISK}"
suffix="${JAEGER_VERSION}-$(go env GOOS)-$(go env GOARCH)"
target="$PWD/.bin/jaeger-all-in-one-${JAEGER_VERSION}"
url="https://github.com/jaegertracing/jaeger/releases/download/v${JAEGER_VERSION}/jaeger-${suffix}.tar.gz"
if [ ! -f "${target}" ]; then
echo "downloading ${url}" 1>&2
curl -sS -L -f "${url}" | tar -xz --to-stdout "jaeger-${suffix}/jaeger-all-in-one" >"${target}.tmp"
mv "${target}.tmp" "${target}"
fi
chmod +x "${target}"
install_func: installJaeger
env:
JAEGER_VERSION: 1.30.0
JAEGER_DISK: $HOME/.sourcegraph-dev/data/jaeger