Skip to content

chore(scripts): use slim and always run make in coder-dev.sh #8418

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

Merged
merged 3 commits into from
Jul 13, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
enable coder server usage via coder-dev.sh, with caveat
  • Loading branch information
mafredri committed Jul 12, 2023
commit 36a03004c2df8d05b3a81c8c404b5b96533be65b
28 changes: 26 additions & 2 deletions scripts/coder-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ source "${SCRIPT_DIR}/lib.sh"

GOOS="$(go env GOOS)"
GOARCH="$(go env GOARCH)"
RELATIVE_BINARY_PATH="build/coder-slim_${GOOS}_${GOARCH}"
BINARY_TYPE=coder-slim
if [[ $1 == server ]]; then
BINARY_TYPE=coder
fi
RELATIVE_BINARY_PATH="build/${BINARY_TYPE}_${GOOS}_${GOARCH}"

# To preserve the CWD when running the binary, we need to use pushd and popd to
# get absolute paths to everything.
Expand All @@ -20,6 +24,26 @@ CODER_DEV_BIN="$(realpath "$RELATIVE_BINARY_PATH")"
CODER_DEV_DIR="$(realpath ./.coderv2)"
popd

make -j "${RELATIVE_BINARY_PATH}"
case $BINARY_TYPE in
coder-slim)
# Ensure the coder slim binary is always up-to-date with local
# changes, this simplifies usage of this script for development.
make -j "${RELATIVE_BINARY_PATH}"
;;
coder)
if [[ ! -x "${CODER_DEV_BIN}" ]]; then
# A feature requiring the full binary was requested and the
# binary is missing, normally it's built by `develop.sh`, but
# it's an expensive operation, so we require manual action here.
echo "Running \"coder $1\" requires the full binary, please run \"develop.sh\" first or build the binary manually:"
echo " make $RELATIVE_BINARY_PATH"
exit 1
fi
;;
*)
echo "Unknown binary type: $BINARY_TYPE"
exit 1
;;
esac

exec "${CODER_DEV_BIN}" --global-config "${CODER_DEV_DIR}" "$@"