From a8a640f90e273901f8f3500f81979b98b90a2a00 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Tue, 20 May 2025 19:52:03 +0000 Subject: [PATCH 1/6] chore: fall back to `gh auth login` for update_experiments.sh script --- scripts/release/docs_update_experiments.sh | 54 ++++++++-------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/scripts/release/docs_update_experiments.sh b/scripts/release/docs_update_experiments.sh index 1e5e6d1eb6b3e..08a2d4d2bc63b 100755 --- a/scripts/release/docs_update_experiments.sh +++ b/scripts/release/docs_update_experiments.sh @@ -12,27 +12,33 @@ set -euo pipefail source "$(dirname "${BASH_SOURCE[0]}")/../lib.sh" cdroot +# Ensure GITHUB_TOKEN is available +if [[ -z "${GITHUB_TOKEN:-}" ]]; then + if GITHUB_TOKEN="$(gh auth token 2>/dev/null)"; then + export GITHUB_TOKEN + else + echo "Error: GitHub token not found. Please run 'gh auth login' to authenticate." >&2 + exit 1 + fi +fi + if isdarwin; then dependencies gsed gawk sed() { gsed "$@"; } awk() { gawk "$@"; } fi -# From install.sh echo_latest_stable_version() { - # https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860 + # Extract redirect URL to determine latest stable tag version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/coder/coder/releases/latest)" version="${version#https://github.com/coder/coder/releases/tag/v}" echo "v${version}" } echo_latest_mainline_version() { - # Fetch the releases from the GitHub API, sort by version number, - # and take the first result. Note that we're sorting by space- - # separated numbers and without utilizing the sort -V flag for the - # best compatibility. + # Use GitHub API to get latest release version, authenticated echo "v$( - curl -fsSL https://api.github.com/repos/coder/coder/releases | + curl -fsSL -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/coder/coder/releases | awk -F'"' '/"tag_name"/ {print $4}' | tr -d v | tr . ' ' | @@ -42,7 +48,6 @@ echo_latest_mainline_version() { )" } -# For testing or including experiments from `main`. echo_latest_main_version() { echo origin/main } @@ -59,11 +64,6 @@ sparse_clone_codersdk() { } parse_all_experiments() { - # Go doc doesn't include inline array comments, so this parsing should be - # good enough. We remove all whitespaces so that we can extract a plain - # string that looks like {}, {ExpA}, or {ExpA,ExpB,}. - # - # Example: ExperimentsAll=Experiments{ExperimentNotifications,ExperimentAutoFillParameters,} go doc -all -C "${dir}" ./codersdk ExperimentsAll | tr -d $'\n\t ' | grep -E -o 'ExperimentsAll=Experiments\{[^}]*\}' | @@ -72,20 +72,6 @@ parse_all_experiments() { } parse_experiments() { - # Extracts the experiment name and description from the Go doc output. - # The output is in the format: - # - # ||Add new experiments here! - # ExperimentExample|example|This isn't used for anything. - # ExperimentAutoFillParameters|auto-fill-parameters|This should not be taken out of experiments until we have redesigned the feature. - # ExperimentMultiOrganization|multi-organization|Requires organization context for interactions, default org is assumed. - # ExperimentCustomRoles|custom-roles|Allows creating runtime custom roles. - # ExperimentNotifications|notifications|Sends notifications via SMTP and webhooks following certain events. - # ExperimentWorkspaceUsage|workspace-usage|Enables the new workspace usage tracking. - # ||ExperimentTest is an experiment with - # ||a preceding multi line comment!? - # ExperimentTest|test| - # go doc -all -C "${1}" ./codersdk Experiment | sed \ -e 's/\t\(Experiment[^ ]*\)\ \ *Experiment = "\([^"]*\)"\(.*\/\/ \(.*\)\)\?/\1|\2|\4/' \ @@ -104,6 +90,11 @@ for channel in mainline stable; do log "Fetching experiments from ${channel}" tag=$(echo_latest_"${channel}"_version) + if [[ -z "${tag}" || "${tag}" == "v" ]]; then + echo "Error: Failed to retrieve valid ${channel} version tag. Check your GitHub token or rate limit." >&2 + exit 1 + fi + dir="$(sparse_clone_codersdk "${workdir}" "${channel}" "${tag}")" declare -A all_experiments=() @@ -115,14 +106,12 @@ for channel in mainline stable; do done fi - # Track preceding/multiline comments. maybe_desc= while read -r line; do line=${line//$'\n'/} readarray -d '|' -t parts <<<"$line" - # Missing var/key, this is a comment or description. if [[ -z ${parts[0]} ]]; then maybe_desc+="${parts[2]//$'\n'/ }" continue @@ -133,24 +122,20 @@ for channel in mainline stable; do desc="${parts[2]}" desc=${desc//$'\n'/} - # If desc (trailing comment) is empty, use the preceding/multiline comment. if [[ -z "${desc}" ]]; then desc="${maybe_desc% }" fi maybe_desc= - # Skip experiments not listed in ExperimentsAll. if [[ ! -v all_experiments[$var] ]]; then log "Skipping ${var}, not listed in ExperimentsAll" continue fi - # Don't overwrite desc, prefer first come, first served (i.e. mainline > stable). if [[ ! -v experiments[$key] ]]; then experiments[$key]="$desc" fi - # Track the release channels where the experiment is available. experiment_tags[$key]+="${channel}, " done < <(parse_experiments "${dir}") done @@ -170,8 +155,6 @@ table="$( done )" -# Use awk to print everything outside the BEING/END block and insert the -# table in between. awk \ -v table="${table}" \ 'BEGIN{include=1} /BEGIN: available-experimental-features/{print; print table; include=0} /END: available-experimental-features/{include=1} include' \ @@ -179,5 +162,4 @@ awk \ >"${dest}".tmp mv "${dest}".tmp "${dest}" -# Format the file for a pretty table (target single file for speed). (cd site && pnpm exec prettier --cache --write ../"${dest}") From b4ed9d258d752befbdbe9eab360b6ad05d38ea75 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Tue, 20 May 2025 20:09:34 +0000 Subject: [PATCH 2/6] refactor: update experiment parsing script to use ExperimentsSafe instead of ExperimentsAll --- scripts/release/docs_update_experiments.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/release/docs_update_experiments.sh b/scripts/release/docs_update_experiments.sh index 08a2d4d2bc63b..360e0daee4649 100755 --- a/scripts/release/docs_update_experiments.sh +++ b/scripts/release/docs_update_experiments.sh @@ -64,9 +64,24 @@ sparse_clone_codersdk() { } parse_all_experiments() { - go doc -all -C "${dir}" ./codersdk ExperimentsAll | + # Try ExperimentsSafe first, then fall back to ExperimentsAll if needed + experiments_var="ExperimentsSafe" + experiments_output=$(go doc -all -C "${dir}" ./codersdk "${experiments_var}" 2>/dev/null || true) + + if [[ -z "${experiments_output}" ]]; then + # Fall back to ExperimentsAll if ExperimentsSafe is not found + experiments_var="ExperimentsAll" + experiments_output=$(go doc -all -C "${dir}" ./codersdk "${experiments_var}" 2>/dev/null || true) + + if [[ -z "${experiments_output}" ]]; then + log "Warning: Neither ExperimentsSafe nor ExperimentsAll found in ${dir}" + return + fi + fi + + echo "${experiments_output}" | tr -d $'\n\t ' | - grep -E -o 'ExperimentsAll=Experiments\{[^}]*\}' | + grep -E -o "${experiments_var}=Experiments\{[^}]*\}" | sed -e 's/.*{\(.*\)}.*/\1/' | tr ',' '\n' } @@ -128,7 +143,7 @@ for channel in mainline stable; do maybe_desc= if [[ ! -v all_experiments[$var] ]]; then - log "Skipping ${var}, not listed in ExperimentsAll" + log "Skipping ${var}, not listed in experiments list" continue fi From 89144e9eece8d000c807cd1d08f355109948e8c6 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Tue, 20 May 2025 20:12:13 +0000 Subject: [PATCH 3/6] docs: add prebuilds experiment --- docs/install/releases/feature-stages.md | 94 ++++++++++++++++--------- 1 file changed, 59 insertions(+), 35 deletions(-) diff --git a/docs/install/releases/feature-stages.md b/docs/install/releases/feature-stages.md index 5730a5d76288e..535192efaa95c 100644 --- a/docs/install/releases/feature-stages.md +++ b/docs/install/releases/feature-stages.md @@ -10,7 +10,7 @@ If you encounter an issue with any Coder feature, please submit a ## Feature stages | Feature stage | Stable | Production-ready | Support | Description | -|----------------------------------------|--------|------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------------| +| -------------------------------------- | ------ | ---------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | [Early Access](#early-access-features) | No | No | GitHub issues | For staging only. Not feature-complete or stable. Disabled by default. | | [Beta](#beta) | No | Not fully | Docs, Discord, GitHub | Publicly available. In active development with minor bugs. Suitable for staging; optional for production. Not covered by SLA. | | [GA](#general-availability-ga) | Yes | Yes | License-based | Stable and tested. Enabled by default. Fully documented. Support based on license. | @@ -24,32 +24,37 @@ If you encounter an issue with any Coder feature, please submit a Early access features are neither feature-complete nor stable. We do not recommend using early access features in production deployments. -Coder sometimes releases early access features that are available for use, but are disabled by default. -You shouldn't use early access features in production because they might cause performance or stability issues. -Early access features can be mostly feature-complete, but require further internal testing and remain in the early access stage for at least one month. +Coder sometimes releases early access features that are available for use, but +are disabled by default. You shouldn't use early access features in production +because they might cause performance or stability issues. Early access features +can be mostly feature-complete, but require further internal testing and remain +in the early access stage for at least one month. -Coder may make significant changes or revert features to a feature flag at any time. +Coder may make significant changes or revert features to a feature flag at any +time. If you plan to activate an early access feature, we suggest that you use a staging deployment.
To enable early access features: -Use the [Coder CLI](../../install/cli.md) `--experiments` flag to enable early access features: +Use the [Coder CLI](../../install/cli.md) `--experiments` flag to enable early +access features: - Enable all early access features: - ```shell - coder server --experiments=* - ``` + ```shell + coder server --experiments=* + ``` - Enable multiple early access features: - ```shell - coder server --experiments=feature1,feature2 - ``` + ```shell + coder server --experiments=feature1,feature2 + ``` -You can also use the `CODER_EXPERIMENTS` [environment variable](../../admin/setup/index.md). +You can also use the `CODER_EXPERIMENTS` +[environment variable](../../admin/setup/index.md). You can opt-out of a feature after you've enabled it. @@ -60,7 +65,9 @@ You can opt-out of a feature after you've enabled it. -Currently no experimental features are available in the latest mainline or stable release. +| Feature | Description | Available in | +| --------------------- | -------------------------------------------- | ------------ | +| `workspace-prebuilds` | Enables the new workspace prebuilds feature. | mainline | @@ -68,24 +75,32 @@ Currently no experimental features are available in the latest mainline or stabl - **Stable**: No - **Production-ready**: Not fully -- **Support**: Documentation, [Discord](https://discord.gg/coder), and [GitHub issues](https://github.com/coder/coder/issues) +- **Support**: Documentation, [Discord](https://discord.gg/coder), and + [GitHub issues](https://github.com/coder/coder/issues) Beta features are open to the public and are tagged with a `Beta` label. -They’re in active development and subject to minor changes. -They might contain minor bugs, but are generally ready for use. +They’re in active development and subject to minor changes. They might contain +minor bugs, but are generally ready for use. -Beta features are often ready for general availability within two-three releases. -You should test beta features in staging environments. -You can use beta features in production, but should set expectations and inform users that some features may be incomplete. +Beta features are often ready for general availability within two-three +releases. You should test beta features in staging environments. You can use +beta features in production, but should set expectations and inform users that +some features may be incomplete. -We keep documentation about beta features up-to-date with the latest information, including planned features, limitations, and workarounds. -If you encounter an issue, please contact your [Coder account team](https://coder.com/contact), reach out on [Discord](https://discord.gg/coder), or create a [GitHub issues](https://github.com/coder/coder/issues) if there isn't one already. -While we will do our best to provide support with beta features, most issues will be escalated to the product team. -Beta features are not covered within service-level agreements (SLA). +We keep documentation about beta features up-to-date with the latest +information, including planned features, limitations, and workarounds. If you +encounter an issue, please contact your +[Coder account team](https://coder.com/contact), reach out on +[Discord](https://discord.gg/coder), or create a +[GitHub issues](https://github.com/coder/coder/issues) if there isn't one +already. While we will do our best to provide support with beta features, most +issues will be escalated to the product team. Beta features are not covered +within service-level agreements (SLA). -Most beta features are enabled by default. -Beta features are announced through the [Coder Changelog](https://coder.com/changelog), and more information is available in the documentation. +Most beta features are enabled by default. Beta features are announced through +the [Coder Changelog](https://coder.com/changelog), and more information is +available in the documentation. ## General Availability (GA) @@ -93,16 +108,25 @@ Beta features are announced through the [Coder Changelog](https://coder.com/chan - **Production-ready**: Yes - **Support**: Yes, [based on license](https://coder.com/pricing). -All features that are not explicitly tagged as `Early access` or `Beta` are considered generally available (GA). -They have been tested, are stable, and are enabled by default. +All features that are not explicitly tagged as `Early access` or `Beta` are +considered generally available (GA). They have been tested, are stable, and are +enabled by default. -If your Coder license includes an SLA, please consult it for an outline of specific expectations. +If your Coder license includes an SLA, please consult it for an outline of +specific expectations. -For support, consult our knowledgeable and growing community on [Discord](https://discord.gg/coder), or create a [GitHub issue](https://github.com/coder/coder/issues) if one doesn't exist already. -Customers with a valid Coder license, can submit a support request or contact your [account team](https://coder.com/contact). +For support, consult our knowledgeable and growing community on +[Discord](https://discord.gg/coder), or create a +[GitHub issue](https://github.com/coder/coder/issues) if one doesn't exist +already. Customers with a valid Coder license, can submit a support request or +contact your [account team](https://coder.com/contact). -We intend [Coder documentation](../../README.md) to be the [single source of truth](https://en.wikipedia.org/wiki/Single_source_of_truth) and all features should have some form of complete documentation that outlines how to use or implement a feature. -If you discover an error or if you have a suggestion that could improve the documentation, please [submit a GitHub issue](https://github.com/coder/internal/issues/new?title=request%28docs%29%3A+request+title+here&labels=["customer-feedback","docs"]&body=please+enter+your+request+here). +We intend [Coder documentation](../../README.md) to be the +[single source of truth](https://en.wikipedia.org/wiki/Single_source_of_truth) +and all features should have some form of complete documentation that outlines +how to use or implement a feature. If you discover an error or if you have a +suggestion that could improve the documentation, please +[submit a GitHub issue](https://github.com/coder/internal/issues/new?title=request%28docs%29%3A+request+title+here&labels=["customer-feedback","docs"]&body=please+enter+your+request+here). -Some GA features can be disabled for air-gapped deployments. -Consult the feature's documentation or submit a support ticket for assistance. +Some GA features can be disabled for air-gapped deployments. Consult the +feature's documentation or submit a support ticket for assistance. From 6bc879646d0894d6592340179bcc0fc748e998cd Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Tue, 20 May 2025 20:13:57 +0000 Subject: [PATCH 4/6] bump version --- docs/install/kubernetes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install/kubernetes.md b/docs/install/kubernetes.md index 176fc7c452805..92e97e3cf902c 100644 --- a/docs/install/kubernetes.md +++ b/docs/install/kubernetes.md @@ -133,7 +133,7 @@ We support two release channels: mainline and stable - read the helm install coder coder-v2/coder \ --namespace coder \ --values values.yaml \ - --version 2.20.0 + --version 2.22.1 ``` - **Stable** Coder release: From 068a29352e0a0a7e1c36059c9d45940c6d5aa472 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Tue, 20 May 2025 20:28:00 +0000 Subject: [PATCH 5/6] =?UTF-8?q?fmt=20(=F0=9F=A4=9E)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/release/docs_update_experiments.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/release/docs_update_experiments.sh b/scripts/release/docs_update_experiments.sh index 360e0daee4649..7d7c178a9d4e9 100755 --- a/scripts/release/docs_update_experiments.sh +++ b/scripts/release/docs_update_experiments.sh @@ -67,18 +67,18 @@ parse_all_experiments() { # Try ExperimentsSafe first, then fall back to ExperimentsAll if needed experiments_var="ExperimentsSafe" experiments_output=$(go doc -all -C "${dir}" ./codersdk "${experiments_var}" 2>/dev/null || true) - + if [[ -z "${experiments_output}" ]]; then # Fall back to ExperimentsAll if ExperimentsSafe is not found experiments_var="ExperimentsAll" experiments_output=$(go doc -all -C "${dir}" ./codersdk "${experiments_var}" 2>/dev/null || true) - + if [[ -z "${experiments_output}" ]]; then log "Warning: Neither ExperimentsSafe nor ExperimentsAll found in ${dir}" return fi fi - + echo "${experiments_output}" | tr -d $'\n\t ' | grep -E -o "${experiments_var}=Experiments\{[^}]*\}" | From 38b093d17e3179e58513cb0b6698a45bfe490d56 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Tue, 20 May 2025 20:35:56 +0000 Subject: [PATCH 6/6] fmt --- docs/install/releases/feature-stages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/install/releases/feature-stages.md b/docs/install/releases/feature-stages.md index 535192efaa95c..216b9c01d28af 100644 --- a/docs/install/releases/feature-stages.md +++ b/docs/install/releases/feature-stages.md @@ -10,7 +10,7 @@ If you encounter an issue with any Coder feature, please submit a ## Feature stages | Feature stage | Stable | Production-ready | Support | Description | -| -------------------------------------- | ------ | ---------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +|----------------------------------------|--------|------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------------| | [Early Access](#early-access-features) | No | No | GitHub issues | For staging only. Not feature-complete or stable. Disabled by default. | | [Beta](#beta) | No | Not fully | Docs, Discord, GitHub | Publicly available. In active development with minor bugs. Suitable for staging; optional for production. Not covered by SLA. | | [GA](#general-availability-ga) | Yes | Yes | License-based | Stable and tested. Enabled by default. Fully documented. Support based on license. | @@ -66,7 +66,7 @@ You can opt-out of a feature after you've enabled it. | Feature | Description | Available in | -| --------------------- | -------------------------------------------- | ------------ | +|-----------------------|----------------------------------------------|--------------| | `workspace-prebuilds` | Enables the new workspace prebuilds feature. | mainline |