Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .github/scripts/check_registry_site_health.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ create_incident() {
# Function to check for existing unresolved incidents
check_existing_incident() {
# Fetch the latest incidents with status not equal to "RESOLVED"
local unresolved_incidents=$(curl -s -X GET "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/incidents" \
local unresolved_incidents
unresolved_incidents=$(curl -s -X GET "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/incidents" \
-H "Authorization: Bearer $INSTATUS_API_KEY" \
-H "Content-Type: application/json" | jq -r '.incidents[] | select(.status != "RESOLVED") | .id')

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ jobs:
- 'scripts/ts_test_auto.sh'
- 'scripts/terraform_test_all.sh'
- 'scripts/terraform_validate.sh'
- 'scripts/shellcheck_validate.sh'
modules:
- 'registry/**/modules/**'
shell:
- '**/*.sh'
all:
- '**'
- name: Set up Terraform
Expand Down Expand Up @@ -64,6 +67,12 @@ jobs:
SHARED_CHANGED: ${{ steps.filter.outputs.shared }}
MODULE_CHANGED_FILES: ${{ steps.filter.outputs.modules_files }}
run: bun terraform-validate
- name: Run ShellCheck
env:
ALL_CHANGED_FILES: ${{ steps.filter.outputs.all_files }}
SHARED_CHANGED: ${{ steps.filter.outputs.shared }}
SHELL_CHANGED_FILES: ${{ steps.filter.outputs.shell_files }}
run: bun shellcheck
validate-style:
name: Check for typos and unformatted code
runs-on: ubuntu-latest
Expand Down
20 changes: 20 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ShellCheck configuration for Coder Registry
# https://www.shellcheck.net/wiki/

# Set default shell dialect to bash (most scripts use bash)
shell=bash

# Disable checks that conflict with Terraform templating syntax
# Many scripts use Terraform's templatefile() function with $${VAR} escape syntax
disable=SC2154 # Variable is referenced but not assigned (injected by Terraform)
disable=SC2034 # Variable appears unused (used via $${VAR} syntax)
disable=SC1083 # Literal braces (Terraform's $${VAR} escape syntax)
disable=SC2193 # Comparison arguments never equal (Terraform interpolation)
disable=SC2125 # Brace expansion/globs in assignments (Terraform syntax)

# Disable checks that conflict with common bash idioms
disable=SC2076 # Quoted regex in =~ (intentional for literal string matching with space padding)

# Enable all optional checks for thorough analysis
enable=all

243 changes: 243 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"terraform-validate": "./scripts/terraform_validate.sh",
"tftest": "./scripts/terraform_test_all.sh",
"tstest": "./scripts/ts_test_auto.sh",
"shellcheck": "./scripts/shellcheck_validate.sh",
"update-version": "./update-version.sh"
},
"devDependencies": {
Expand All @@ -16,7 +17,8 @@
"marked": "^16.2.0",
"prettier": "^3.6.2",
"prettier-plugin-sh": "^0.18.0",
"prettier-plugin-terraform-formatter": "^1.2.1"
"prettier-plugin-terraform-formatter": "^1.2.1",
"shellcheck": "^4.1.0"
},
"peerDependencies": {
"typescript": "^5.8.3"
Expand Down
6 changes: 3 additions & 3 deletions registry/anomaly/modules/tmux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ up a default or custom tmux configuration with session save/restore capabilities
```tf
module "tmux" {
source = "registry.coder.com/anomaly/tmux/coder"
version = "1.0.1"
version = "1.0.2"
agent_id = coder_agent.example.id
}
```
Expand All @@ -39,7 +39,7 @@ module "tmux" {
```tf
module "tmux" {
source = "registry.coder.com/anomaly/tmux/coder"
version = "1.0.1"
version = "1.0.2"
agent_id = coder_agent.example.id
tmux_config = "" # Optional: custom tmux.conf content
save_interval = 1 # Optional: save interval in minutes
Expand Down Expand Up @@ -78,7 +78,7 @@ This module can provision multiple tmux sessions, each as a separate app in the
```tf
module "tmux" {
source = "registry.coder.com/anomaly/tmux/coder"
version = "1.0.1"
version = "1.0.2"
agent_id = var.agent_id
sessions = ["default", "dev", "anomaly"]
tmux_config = <<-EOT
Expand Down
2 changes: 1 addition & 1 deletion registry/anomaly/modules/tmux/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ main() {
printf "$${BOLD}✅ tmux setup complete! \n\n"

printf "$${BOLD} Attempting to restore sessions\n"
tmux new-session -d \; source-file ~/.tmux.conf \; run-shell '~/.tmux/plugins/tmux-resurrect/scripts/restore.sh'
tmux new-session -d \; source-file ~/.tmux.conf \; run-shell "$HOME/.tmux/plugins/tmux-resurrect/scripts/restore.sh"
printf "$${BOLD} Sessions restored: -> %s\n" "$(tmux ls)"

}
Expand Down
10 changes: 5 additions & 5 deletions registry/coder-labs/modules/archive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This module installs small, robust scripts in your workspace to create and extra
module "archive" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/archive/coder"
version = "0.0.1"
version = "0.0.2"
agent_id = coder_agent.example.id

paths = ["./projects", "./code"]
Expand Down Expand Up @@ -43,7 +43,7 @@ Basic example:
module "archive" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/archive/coder"
version = "0.0.1"
version = "0.0.2"
agent_id = coder_agent.example.id

# Paths to include in the archive (files or directories).
Expand All @@ -61,7 +61,7 @@ Customize compression and output:
module "archive" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/archive/coder"
version = "0.0.1"
version = "0.0.2"
agent_id = coder_agent.example.id

directory = "/"
Expand All @@ -78,7 +78,7 @@ Enable auto-archive on stop:
module "archive" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/archive/coder"
version = "0.0.1"
version = "0.0.2"
agent_id = coder_agent.example.id

# Creates /tmp/coder-archive.tar.gz of the users home directory (defaults).
Expand All @@ -92,7 +92,7 @@ Extract on start:
module "archive" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/archive/coder"
version = "0.0.1"
version = "0.0.2"
agent_id = coder_agent.example.id

# Where to look for the archive file to extract:
Expand Down
5 changes: 3 additions & 2 deletions registry/coder-labs/modules/archive/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ EXTRACT_ON_START="${TF_EXTRACT_ON_START}"
EXTRACT_WAIT_TIMEOUT="${TF_EXTRACT_WAIT_TIMEOUT}"

# Set script defaults from Terraform.
DEFAULT_PATHS=(${TF_PATHS})
DEFAULT_EXCLUDE_PATTERNS=(${TF_EXCLUDE_PATTERNS})
IFS=' ' read -r -a DEFAULT_PATHS <<< "${TF_PATHS}"
IFS=' ' read -r -a DEFAULT_EXCLUDE_PATTERNS <<< "${TF_EXCLUDE_PATTERNS}"
DEFAULT_COMPRESSION="${TF_COMPRESSION}"
DEFAULT_ARCHIVE_PATH="${TF_ARCHIVE_PATH}"
DEFAULT_DIRECTORY="${TF_DIRECTORY}"
Expand Down Expand Up @@ -62,6 +62,7 @@ echo "Installed extract script to: $EXTRACT_WRAPPER_PATH"

# 3) Optionally wait for and extract an archive on start.
if [[ $EXTRACT_ON_START = true ]]; then
# shellcheck disable=SC1090
. "$LIB_PATH"

archive_wait_and_extract "$EXTRACT_WAIT_TIMEOUT" quiet || {
Expand Down
14 changes: 7 additions & 7 deletions registry/coder/modules/code-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Automatically install [code-server](https://github.com/coder/code-server) in a w
module "code-server" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/code-server/coder"
version = "1.3.1"
version = "1.3.2"
agent_id = coder_agent.example.id
}
```
Expand All @@ -29,7 +29,7 @@ module "code-server" {
module "code-server" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/code-server/coder"
version = "1.3.1"
version = "1.3.2"
agent_id = coder_agent.example.id
install_version = "4.8.3"
}
Expand All @@ -43,7 +43,7 @@ Install the Dracula theme from [OpenVSX](https://open-vsx.org/):
module "code-server" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/code-server/coder"
version = "1.3.1"
version = "1.3.2"
agent_id = coder_agent.example.id
extensions = [
"dracula-theme.theme-dracula"
Expand All @@ -61,7 +61,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte
module "code-server" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/code-server/coder"
version = "1.3.1"
version = "1.3.2"
agent_id = coder_agent.example.id
extensions = ["dracula-theme.theme-dracula"]
settings = {
Expand All @@ -78,7 +78,7 @@ Just run code-server in the background, don't fetch it from GitHub:
module "code-server" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/code-server/coder"
version = "1.3.1"
version = "1.3.2"
agent_id = coder_agent.example.id
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
}
Expand All @@ -94,7 +94,7 @@ Run an existing copy of code-server if found, otherwise download from GitHub:
module "code-server" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/code-server/coder"
version = "1.3.1"
version = "1.3.2"
agent_id = coder_agent.example.id
use_cached = true
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
Expand All @@ -107,7 +107,7 @@ Just run code-server in the background, don't fetch it from GitHub:
module "code-server" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/code-server/coder"
version = "1.3.1"
version = "1.3.2"
agent_id = coder_agent.example.id
offline = true
}
Expand Down
2 changes: 2 additions & 0 deletions registry/coder/modules/code-server/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function extension_installed() {
if [ "${USE_CACHED_EXTENSIONS}" != true ]; then
return 1
fi
# shellcheck disable=SC2066
for _extension in "$${EXTENSIONS_ARRAY[@]}"; do
if [ "$_extension" == "$1" ]; then
echo "Extension $1 was already installed."
Expand All @@ -99,6 +100,7 @@ function extension_installed() {

# Install each extension...
IFS=',' read -r -a EXTENSIONLIST <<< "$${EXTENSIONS}"
# shellcheck disable=SC2066
for extension in "$${EXTENSIONLIST[@]}"; do
if [ -z "$extension" ]; then
continue
Expand Down
2 changes: 1 addition & 1 deletion registry/coder/modules/devcontainers-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The devcontainers-cli module provides an easy way to install [`@devcontainers/cl
```tf
module "devcontainers-cli" {
source = "registry.coder.com/coder/devcontainers-cli/coder"
version = "1.0.32"
version = "1.0.33"
agent_id = coder_agent.example.id
}
```
2 changes: 1 addition & 1 deletion registry/coder/modules/devcontainers-cli/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# might contain a `package.json` with `packageManager` set to something
# other than the detected package manager. When this happens, it can
# cause the installation to fail.
cd "$CODER_SCRIPT_DATA_DIR"
cd "$CODER_SCRIPT_DATA_DIR" || exit

# If @devcontainers/cli is already installed, we can skip
if command -v devcontainer > /dev/null 2>&1; then
Expand Down
12 changes: 6 additions & 6 deletions registry/coder/modules/dotfiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/
module "dotfiles" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/dotfiles/coder"
version = "1.2.1"
version = "1.2.2"
agent_id = coder_agent.example.id
}
```
Expand All @@ -31,7 +31,7 @@ module "dotfiles" {
module "dotfiles" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/dotfiles/coder"
version = "1.2.1"
version = "1.2.2"
agent_id = coder_agent.example.id
}
```
Expand All @@ -42,7 +42,7 @@ module "dotfiles" {
module "dotfiles" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/dotfiles/coder"
version = "1.2.1"
version = "1.2.2"
agent_id = coder_agent.example.id
user = "root"
}
Expand All @@ -54,14 +54,14 @@ module "dotfiles" {
module "dotfiles" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/dotfiles/coder"
version = "1.2.1"
version = "1.2.2"
agent_id = coder_agent.example.id
}

module "dotfiles-root" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/dotfiles/coder"
version = "1.2.1"
version = "1.2.2"
agent_id = coder_agent.example.id
user = "root"
dotfiles_uri = module.dotfiles.dotfiles_uri
Expand All @@ -76,7 +76,7 @@ You can set a default dotfiles repository for all users by setting the `default_
module "dotfiles" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/dotfiles/coder"
version = "1.2.1"
version = "1.2.2"
agent_id = coder_agent.example.id
default_dotfiles_uri = "https://github.com/coder/dotfiles"
}
Expand Down
1 change: 1 addition & 0 deletions registry/coder/modules/dotfiles/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -euo pipefail
DOTFILES_URI="${DOTFILES_URI}"
DOTFILES_USER="${DOTFILES_USER}"

# shellcheck disable=SC2157
if [ -n "$${DOTFILES_URI// }" ]; then
if [ -z "$DOTFILES_USER" ]; then
DOTFILES_USER="$USER"
Expand Down
Loading
Loading