Skip to content

Commit 70ca76e

Browse files
ci: add shellcheck step (#484)
1 parent 7c4ef92 commit 70ca76e

File tree

55 files changed

+731
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+731
-238
lines changed

.github/scripts/check_registry_site_health.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ create_incident() {
8282
# Function to check for existing unresolved incidents
8383
check_existing_incident() {
8484
# Fetch the latest incidents with status not equal to "RESOLVED"
85-
local unresolved_incidents=$(curl -s -X GET "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/incidents" \
85+
local unresolved_incidents
86+
unresolved_incidents=$(curl -s -X GET "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/incidents" \
8687
-H "Authorization: Bearer $INSTATUS_API_KEY" \
8788
-H "Content-Type: application/json" | jq -r '.incidents[] | select(.status != "RESOLVED") | .id')
8889

.github/workflows/ci.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ jobs:
2929
- 'scripts/ts_test_auto.sh'
3030
- 'scripts/terraform_test_all.sh'
3131
- 'scripts/terraform_validate.sh'
32+
- 'scripts/shellcheck_validate.sh'
3233
modules:
3334
- 'registry/**/modules/**'
35+
shell:
36+
- '**/*.sh'
3437
all:
3538
- '**'
3639
- name: Set up Terraform
@@ -64,6 +67,14 @@ jobs:
6467
SHARED_CHANGED: ${{ steps.filter.outputs.shared }}
6568
MODULE_CHANGED_FILES: ${{ steps.filter.outputs.modules_files }}
6669
run: bun terraform-validate
70+
- name: Run ShellCheck
71+
env:
72+
ALL_CHANGED_FILES: ${{ steps.filter.outputs.all_files }}
73+
SHARED_CHANGED: ${{ steps.filter.outputs.shared }}
74+
SHELL_CHANGED_FILES: ${{ steps.filter.outputs.shell_files }}
75+
run: bun shellcheck
76+
- name: Validate set -u ordering
77+
run: ./scripts/validate_set_u_order.sh
6778
validate-style:
6879
name: Check for typos and unformatted code
6980
runs-on: ubuntu-latest

.shellcheckrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ShellCheck configuration for Coder Registry
2+
# https://www.shellcheck.net/wiki/
3+
4+
# Set default shell dialect to bash (most scripts use bash)
5+
shell=bash
6+
7+
# Disable checks that conflict with Terraform templating syntax
8+
# Many scripts use Terraform's templatefile() function with $${VAR} escape syntax
9+
disable=SC2154 # Variable is referenced but not assigned (injected by Terraform)
10+
disable=SC2034 # Variable appears unused (used via $${VAR} syntax)
11+
disable=SC1083 # Literal braces (Terraform's $${VAR} escape syntax)
12+
disable=SC2193 # Comparison arguments never equal (Terraform interpolation)
13+
disable=SC2125 # Brace expansion/globs in assignments (Terraform syntax)
14+
disable=SC2157 # Argument to -n/-z is always true/false (Terraform $${VAR} syntax)
15+
disable=SC2066 # Loop will only run once (Terraform $${VAR} array syntax)
16+
17+
# Disable checks that conflict with intentional patterns
18+
disable=SC2076 # Quoted regex in =~ (intentional literal string match, not regex, for array membership checks)
19+
20+
# Enable all optional checks for thorough analysis
21+
enable=all
22+

bun.lock

Lines changed: 243 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"terraform-validate": "./scripts/terraform_validate.sh",
77
"tftest": "./scripts/terraform_test_all.sh",
88
"tstest": "./scripts/ts_test_auto.sh",
9+
"shellcheck": "./scripts/shellcheck_validate.sh",
910
"update-version": "./update-version.sh"
1011
},
1112
"devDependencies": {
@@ -16,7 +17,8 @@
1617
"marked": "^16.2.0",
1718
"prettier": "^3.6.2",
1819
"prettier-plugin-sh": "^0.18.0",
19-
"prettier-plugin-terraform-formatter": "^1.2.1"
20+
"prettier-plugin-terraform-formatter": "^1.2.1",
21+
"shellcheck": "^4.1.0"
2022
},
2123
"peerDependencies": {
2224
"typescript": "^5.8.3"

registry/anomaly/modules/tmux/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ up a default or custom tmux configuration with session save/restore capabilities
1515
```tf
1616
module "tmux" {
1717
source = "registry.coder.com/anomaly/tmux/coder"
18-
version = "1.0.2"
19-
agent_id = coder_agent.main.id
18+
version = "1.0.3"
19+
agent_id = coder_agent.example.id
2020
}
2121
```
2222

@@ -39,8 +39,8 @@ module "tmux" {
3939
```tf
4040
module "tmux" {
4141
source = "registry.coder.com/anomaly/tmux/coder"
42-
version = "1.0.2"
43-
agent_id = coder_agent.main.id
42+
version = "1.0.3"
43+
agent_id = coder_agent.example.id
4444
tmux_config = "" # Optional: custom tmux.conf content
4545
save_interval = 1 # Optional: save interval in minutes
4646
sessions = ["default", "dev", "ops"] # Optional: list of tmux sessions
@@ -78,7 +78,7 @@ This module can provision multiple tmux sessions, each as a separate app in the
7878
```tf
7979
module "tmux" {
8080
source = "registry.coder.com/anomaly/tmux/coder"
81-
version = "1.0.2"
81+
version = "1.0.3"
8282
agent_id = var.agent_id
8383
sessions = ["default", "dev", "anomaly"]
8484
tmux_config = <<-EOT

registry/anomaly/modules/tmux/scripts/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ main() {
144144
printf "$${BOLD}✅ tmux setup complete! \n\n"
145145

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

150150
}

registry/coder-labs/modules/archive/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ This module installs small, robust scripts in your workspace to create and extra
1414
module "archive" {
1515
count = data.coder_workspace.me.start_count
1616
source = "registry.coder.com/coder-labs/archive/coder"
17-
version = "0.0.2"
18-
agent_id = coder_agent.main.id
17+
version = "0.0.3"
18+
agent_id = coder_agent.example.id
1919
2020
paths = ["./projects", "./code"]
2121
}
@@ -43,8 +43,8 @@ Basic example:
4343
module "archive" {
4444
count = data.coder_workspace.me.start_count
4545
source = "registry.coder.com/coder-labs/archive/coder"
46-
version = "0.0.2"
47-
agent_id = coder_agent.main.id
46+
version = "0.0.3"
47+
agent_id = coder_agent.example.id
4848
4949
# Paths to include in the archive (files or directories).
5050
directory = "~"
@@ -61,8 +61,8 @@ Customize compression and output:
6161
module "archive" {
6262
count = data.coder_workspace.me.start_count
6363
source = "registry.coder.com/coder-labs/archive/coder"
64-
version = "0.0.2"
65-
agent_id = coder_agent.main.id
64+
version = "0.0.3"
65+
agent_id = coder_agent.example.id
6666
6767
directory = "/"
6868
paths = ["/etc", "/home"]
@@ -78,8 +78,8 @@ Enable auto-archive on stop:
7878
module "archive" {
7979
count = data.coder_workspace.me.start_count
8080
source = "registry.coder.com/coder-labs/archive/coder"
81-
version = "0.0.2"
82-
agent_id = coder_agent.main.id
81+
version = "0.0.3"
82+
agent_id = coder_agent.example.id
8383
8484
# Creates /tmp/coder-archive.tar.gz of the users home directory (defaults).
8585
create_on_stop = true
@@ -92,8 +92,8 @@ Extract on start:
9292
module "archive" {
9393
count = data.coder_workspace.me.start_count
9494
source = "registry.coder.com/coder-labs/archive/coder"
95-
version = "0.0.2"
96-
agent_id = coder_agent.main.id
95+
version = "0.0.3"
96+
agent_id = coder_agent.example.id
9797
9898
# Where to look for the archive file to extract:
9999
output_dir = "/tmp"

registry/coder-labs/modules/archive/run.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ EXTRACT_ON_START="${TF_EXTRACT_ON_START}"
66
EXTRACT_WAIT_TIMEOUT="${TF_EXTRACT_WAIT_TIMEOUT}"
77

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

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

6768
archive_wait_and_extract "$EXTRACT_WAIT_TIMEOUT" quiet || {

registry/coder-labs/modules/auggie/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Run Auggie CLI in your workspace to access Augment's AI coding assistant with ad
1414
module "auggie" {
1515
source = "registry.coder.com/coder-labs/auggie/coder"
1616
version = "0.2.2"
17-
agent_id = coder_agent.main.id
17+
agent_id = coder_agent.example.id
1818
folder = "/home/coder/project"
1919
}
2020
```
@@ -41,14 +41,14 @@ data "coder_parameter" "ai_prompt" {
4141
module "coder-login" {
4242
count = data.coder_workspace.me.start_count
4343
source = "registry.coder.com/coder/coder-login/coder"
44-
version = "1.0.31"
45-
agent_id = coder_agent.main.id
44+
version = "0.2.2"
45+
agent_id = coder_agent.example.id
4646
}
4747
4848
module "auggie" {
4949
source = "registry.coder.com/coder-labs/auggie/coder"
5050
version = "0.2.2"
51-
agent_id = coder_agent.main.id
51+
agent_id = coder_agent.example.id
5252
folder = "/home/coder/project"
5353
5454
# Authentication
@@ -57,7 +57,7 @@ module "auggie" {
5757
EOF # Required for tasks
5858
5959
# Version
60-
auggie_version = "0.3.0"
60+
auggie_version = "0.2.2"
6161
6262
# Task configuration
6363
ai_prompt = data.coder_parameter.ai_prompt.value
@@ -74,7 +74,6 @@ EOF # Required for tasks
7474
"command": "npx",
7575
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/coder/project"]
7676
}
77-
7877
}
7978
}
8079
EOF
@@ -105,7 +104,7 @@ EOF
105104
module "auggie" {
106105
source = "registry.coder.com/coder-labs/auggie/coder"
107106
version = "0.2.2"
108-
agent_id = coder_agent.main.id
107+
agent_id = coder_agent.example.id
109108
folder = "/home/coder/project"
110109
111110
# Multiple MCP configuration files
@@ -128,7 +127,6 @@ module "auggie" {
128127
],
129128
"timeout": 600
130129
}
131-
132130
}
133131
}
134132
EOF

0 commit comments

Comments
 (0)