diff --git a/Documentation/dev/libvirt-howto.md b/Documentation/dev/libvirt-howto.md index 8a5f98494ab..eb40cca750c 100644 --- a/Documentation/dev/libvirt-howto.md +++ b/Documentation/dev/libvirt-howto.md @@ -84,8 +84,7 @@ bazel build tarball ### 3. Create a cluster ```sh tar -zxf bazel-bin/tectonic-dev.tar.gz -cd tectonic-dev -export PATH="${PWD}/installer:${PATH}" +alias tectonic="${PWD}/tectonic-dev/installer/tectonic" ``` Initialize (the environment variables are a convenience): diff --git a/README.md b/README.md index 82723981650..736a9f1c5c7 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,11 @@ These instructions can be used for AWS: 3. Extract the tarball ```sh tar -zxf bazel-bin/tectonic-dev.tar.gz - cd tectonic-dev ``` -4. Add binaries to $PATH +4. Create an alias for tectonic ```sh - export PATH="${PWD}/installer:${PATH}" + alias tectonic="${PWD}/tectonic-dev/installer/tectonic" ``` 5. Edit Tectonic configuration file including the $CLUSTER_NAME diff --git a/installer/pkg/workflow/executor.go b/installer/pkg/workflow/executor.go index 9ad3a4df932..e7908fcd104 100644 --- a/installer/pkg/workflow/executor.go +++ b/installer/pkg/workflow/executor.go @@ -67,7 +67,7 @@ func (ex *executor) execute(clusterDir string, args ...string) error { return cmd.Run() } -// tfBinatyPath searches for a TerraForm binary on disk: +// tfBinaryPath searches for a TerraForm binary on disk: // - in the executing binary's folder, // - in the current working directory, // - in the PATH. @@ -79,9 +79,18 @@ func tfBinaryPath() (string, error) { binaryFileName = tfBinWindows } - // Look into the executable's folder. - if execFolderPath, err := filepath.Abs(filepath.Dir(os.Args[0])); err == nil { - path := filepath.Join(execFolderPath, binaryFileName) + // Find the current executable's path, gets an absolute path or error + execPath, err := os.Executable() + if err == nil { + // execPath could be a symlink + if stat, err := os.Stat(execPath); err == nil && (stat.Mode()&os.ModeSymlink) == os.ModeSymlink { + if evalExecPath, err := filepath.EvalSymlinks(execPath); err != nil { + execPath = evalExecPath + } + } + + // Look into the executable's folder. + path := filepath.Join(filepath.Dir(execPath), binaryFileName) if stat, err := os.Stat(path); err == nil && !stat.IsDir() { return path, nil } diff --git a/tests/run.sh b/tests/run.sh index 700a616a432..827e7a6ca22 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -14,11 +14,12 @@ SMOKE_TEST_OUTPUT="Never executed. Problem with one of previous stages" [ -z ${DOMAIN+x} ] && DOMAIN="tectonic-ci.de" [ -z ${JOB_NAME+x} ] && PREFIX="${USER:-test}" || PREFIX="ci-${JOB_NAME#*/}" CLUSTER_NAME=$(echo "${PREFIX}-$(uuidgen -r | cut -c1-5)" | tr '[:upper:]' '[:lower:]') +TECTONIC="${PWD}/tectonic-dev/installer/tectonic" exec &> >(tee -a "$CLUSTER_NAME.log") function destroy() { echo -e "\\e[34m Exiting... Destroying Tectonic...\\e[0m" - tectonic destroy --dir="${CLUSTER_NAME}" + "${TECTONIC}" destroy --dir="${CLUSTER_NAME}" echo -e "\\e[36m Finished! Smoke test output:\\e[0m ${SMOKE_TEST_OUTPUT}" echo -e "\\e[34m So Long, and Thanks for All the Fish\\e[0m" } @@ -33,7 +34,6 @@ bazel build tarball smoke_tests echo -e "\\e[36m Unpacking artifacts...\\e[0m" tar -zxf bazel-bin/tectonic-dev.tar.gz cp bazel-bin/tests/smoke/linux_amd64_stripped/go_default_test tectonic-dev/smoke -export PATH="${PWD}/tectonic-dev/installer:${PATH}" cd tectonic-dev ### HANDLE SSH KEY ### @@ -91,10 +91,10 @@ python <<-EOF >"${CLUSTER_NAME}.yaml" EOF echo -e "\\e[36m Initializing Tectonic...\\e[0m" -tectonic init --config="${CLUSTER_NAME}".yaml +"${TECTONIC}" init --config="${CLUSTER_NAME}".yaml echo -e "\\e[36m Deploying Tectonic...\\e[0m" -tectonic install --dir="${CLUSTER_NAME}" +"${TECTONIC}" install --dir="${CLUSTER_NAME}" echo -e "\\e[36m Running smoke test...\\e[0m" export SMOKE_KUBECONFIG="${PWD}/${CLUSTER_NAME}/generated/auth/kubeconfig" export SMOKE_NODE_COUNT="5" # Sum of all nodes (master + worker)