Skip to content

Commit ace59df

Browse files
committed
add advisory message
1 parent 339acb9 commit ace59df

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

install.sh

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,38 +91,45 @@ The installer will cache all downloaded assets into ~/.cache/coder
9191
EOF
9292
}
9393

94-
echo_latest_version() {
95-
if [ "${MAINLINE}" = 0 ]; then
96-
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
97-
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/coder/coder/releases/latest)"
98-
version="${version#https://github.com/coder/coder/releases/tag/v}"
99-
else
100-
# Fetch the releases from the GitHub API, sort by version number,
101-
# and take the first result. Note that we're sorting by space-
102-
# separated numbers and without utilizing the sort -V flag for the
103-
# best compatibility.
104-
version="$(
105-
curl -fsSL https://api.github.com/repos/coder/coder/releases |
106-
awk -F'"' '/"tag_name"/ {print $4}' |
107-
tr -d v |
108-
tr . ' ' |
109-
sort -k1,1nr -k2,2nr -k3,3nr |
110-
head -n1 |
111-
tr ' ' .
112-
)"
113-
fi
94+
echo_latest_stable_version() {
95+
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
96+
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/coder/coder/releases/latest)"
97+
version="${version#https://github.com/coder/coder/releases/tag/v}"
11498
echo "${version}"
11599
}
116100

101+
echo_latest_mainline_version() {
102+
# Fetch the releases from the GitHub API, sort by version number,
103+
# and take the first result. Note that we're sorting by space-
104+
# separated numbers and without utilizing the sort -V flag for the
105+
# best compatibility.
106+
curl -fsSL https://api.github.com/repos/coder/coder/releases |
107+
awk -F'"' '/"tag_name"/ {print $4}' |
108+
tr -d v |
109+
tr . ' ' |
110+
sort -k1,1nr -k2,2nr -k3,3nr |
111+
head -n1 |
112+
tr ' ' .
113+
}
114+
117115
echo_standalone_postinstall() {
118116
if [ "${DRY_RUN-}" ]; then
119117
echo_dryrun_postinstall
120118
return
121119
fi
122120

121+
channel=mainline
122+
advisory="To install our stable release (v${STABLE_VERSION}), use the --stable flag. "
123+
if [ "${MAINLINE}" = 0 ]; then
124+
channel=stable
125+
advisory=""
126+
fi
127+
123128
cath <<EOF
124129
125-
Coder has been installed to
130+
Coder ${channel} release v${VERSION} installed. ${advisory}See our releases documentation or GitHub for more information on versioning.
131+
132+
The Coder binary has been placed in the following location:
126133
127134
$STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME
128135
@@ -232,7 +239,7 @@ There is another binary in your PATH that conflicts with the binary we've instal
232239
233240
This is likely because of an existing installation of Coder. See our documentation for suggestions on how to resolve this.
234241
235-
https://coder.com/docs/v2/latest/install/install.sh#path-conflicts
242+
https://coder.com/docs/v2/latest/install/install.sh#path-conflicts
236243
237244
EOF
238245
}
@@ -382,7 +389,12 @@ main() {
382389
TERRAFORM_INSTALL_PREFIX=${TERRAFORM_INSTALL_PREFIX:-/usr/local}
383390
STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-/usr/local}
384391
STANDALONE_BINARY_NAME=${STANDALONE_BINARY_NAME:-coder}
385-
VERSION=${VERSION:-$(echo_latest_version)}
392+
STABLE_VERSION=$(echo_latest_stable_version)
393+
if [ "${MAINLINE}" = 0 ]; then
394+
VERSION=${STABLE_VERSION}
395+
else
396+
VERSION=$(echo_latest_mainline_version)
397+
fi
386398

387399
distro_name
388400

@@ -396,6 +408,13 @@ main() {
396408
with_terraform
397409
fi
398410

411+
# If the version is the same as the stable version, we're installing
412+
# the stable version.
413+
if [ "${MAINLINE}" != 0 ] && [ "${VERSION}" = "${STABLE_VERSION}" ]; then
414+
echoh "The latest mainline version has been promoted to stable, selecting stable."
415+
MAINLINE=0
416+
fi
417+
399418
# Standalone installs by pulling pre-built releases from GitHub.
400419
if [ "$METHOD" = standalone ]; then
401420
if has_standalone; then

0 commit comments

Comments
 (0)