From a2c2a04e46aef14a504e2c9f49e2b868cfc1f5b6 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 19:29:31 +0000 Subject: [PATCH 01/10] chore: add prettier/typo check to CI --- .github/typos.toml | 2 ++ .github/workflows/ci.yaml | 22 ++++++++++++++++++++++ package.json | 4 ++-- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .github/typos.toml diff --git a/.github/typos.toml b/.github/typos.toml new file mode 100644 index 00000000..65b4251a --- /dev/null +++ b/.github/typos.toml @@ -0,0 +1,2 @@ +[default.extend-words] +muc = "muc" # For Munich location code \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 159e8c97..1f1a1b0b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,6 +8,7 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: validate-readme-files: + name: Validate README files runs-on: ubuntu-latest steps: - name: Check out code @@ -21,6 +22,7 @@ jobs: - name: Remove build file artifact run: rm ./contributors test-terraform: + name: Validate Terraform output runs-on: ubuntu-latest steps: - name: Check out code @@ -40,3 +42,23 @@ jobs: run: bun install - name: Run tests run: bun test + validate-style: + name: Check for typos and unformatted code + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Install Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - name: Install dependencies + run: bun install + - name: Validate formatting + run: bun fmt:ci + - name: Check for typos + uses: crate-ci/typos@v1.31.1 + with: + config: .github/typos.toml + - name: Lint + run: bun lint diff --git a/package.json b/package.json index aa3c7e22..a00e8bd8 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "modules", "scripts": { "test": "bun test", - "fmt": "bun x prettier -w **/*.sh .sample/run.sh new.sh **/*.ts **/*.md *.md && terraform fmt **/*.tf .sample/main.tf", - "fmt:ci": "bun x prettier --check **/*.sh .sample/run.sh new.sh **/*.ts **/*.md *.md && terraform fmt -check **/*.tf .sample/main.tf", + "fmt": "bun x prettier --write **/*.sh **/*.ts **/*.md *.md && terraform fmt **/*.tf", + "fmt:ci": "bun x prettier --check **/*.sh **/*.ts **/*.md *.md && terraform fmt -check **/*.tf", "update-version": "./update-version.sh" }, "devDependencies": { From 9b58b6ec1fb4f1f86bc063b8ba345469ffac9d0e Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 19:32:26 +0000 Subject: [PATCH 02/10] fix: main CI steps dependent --- .github/workflows/ci.yaml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1f1a1b0b..b7fe9bc2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,20 +7,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: - validate-readme-files: - name: Validate README files - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.23.2" - - name: Validate contributors - run: go build ./scripts/contributors && ./contributors - - name: Remove build file artifact - run: rm ./contributors test-terraform: name: Validate Terraform output runs-on: ubuntu-latest @@ -62,3 +48,21 @@ jobs: config: .github/typos.toml - name: Lint run: bun lint + validate-readme-files: + name: Validate README files + runs-on: ubuntu-latest + + # We want to do some basic README checks first before we try analyzing the + # contents + needs: validate-style + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.23.2" + - name: Validate contributors + run: go build ./scripts/contributors && ./contributors + - name: Remove build file artifact + run: rm ./contributors From 8b73f760bbd52da6578fea7b38e9ee9fbf90b1a9 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 19:35:53 +0000 Subject: [PATCH 03/10] fix: add TF install step --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b7fe9bc2..b04ec924 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,6 +38,9 @@ jobs: uses: oven-sh/setup-bun@v2 with: bun-version: latest + # Need Terraform for its formatter + - name: Install Terraform + uses: coder/coder/.github/actions/setup-tf@main - name: Install dependencies run: bun install - name: Validate formatting From 3c9668f6833c06cf7e535f4875f8495970b0b863 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 19:56:45 +0000 Subject: [PATCH 04/10] refactor: format site check script --- .github/scripts/check_registry_site_health.sh | 276 +++++++++--------- 1 file changed, 138 insertions(+), 138 deletions(-) diff --git a/.github/scripts/check_registry_site_health.sh b/.github/scripts/check_registry_site_health.sh index d1bdea97..0ad742ec 100644 --- a/.github/scripts/check_registry_site_health.sh +++ b/.github/scripts/check_registry_site_health.sh @@ -4,23 +4,23 @@ set -u VERBOSE="${VERBOSE:-0}" if [[ "${VERBOSE}" -ne "0" ]]; then - set -x + set -x fi # List of required environment variables required_vars=( - "INSTATUS_API_KEY" - "INSTATUS_PAGE_ID" - "INSTATUS_COMPONENT_ID" - "VERCEL_API_KEY" + "INSTATUS_API_KEY" + "INSTATUS_PAGE_ID" + "INSTATUS_COMPONENT_ID" + "VERCEL_API_KEY" ) # Check if each required variable is set for var in "${required_vars[@]}"; do - if [[ -z "${!var:-}" ]]; then - echo "Error: Environment variable '$var' is not set." - exit 1 - fi + if [[ -z "${!var:-}" ]]; then + echo "Error: Environment variable '$var' is not set." + exit 1 + fi done REGISTRY_BASE_URL="${REGISTRY_BASE_URL:-https://registry.coder.com}" @@ -31,38 +31,38 @@ declare -a failures=() # Collect all module directories containing a main.tf file for path in $(find . -maxdepth 2 -not -path '*/.*' -type f -name main.tf | cut -d '/' -f 2 | sort -u); do - modules+=("${path}") + modules+=("${path}") done echo "Checking modules: ${modules[*]}" # Function to update the component status on Instatus update_component_status() { - local component_status=$1 - # see https://instatus.com/help/api/components - (curl -X PUT "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/components/$INSTATUS_COMPONENT_ID" \ - -H "Authorization: Bearer $INSTATUS_API_KEY" \ - -H "Content-Type: application/json" \ - -d "{\"status\": \"$component_status\"}") + local component_status=$1 + # see https://instatus.com/help/api/components + (curl -X PUT "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/components/$INSTATUS_COMPONENT_ID" \ + -H "Authorization: Bearer $INSTATUS_API_KEY" \ + -H "Content-Type: application/json" \ + -d "{\"status\": \"$component_status\"}") } # Function to create an incident create_incident() { - local incident_name="Degraded Service" - local message="The following modules are experiencing issues:\n" - for i in "${!failures[@]}"; do - message+="$((i + 1)). ${failures[$i]}\n" - done - - component_status="PARTIALOUTAGE" - if ((${#failures[@]} == ${#modules[@]})); then - component_status="MAJOROUTAGE" - fi - # see https://instatus.com/help/api/incidents - incident_id=$(curl -s -X POST "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/incidents" \ - -H "Authorization: Bearer $INSTATUS_API_KEY" \ - -H "Content-Type: application/json" \ - -d "{ + local incident_name="Degraded Service" + local message="The following modules are experiencing issues:\n" + for i in "${!failures[@]}"; do + message+="$((i + 1)). ${failures[$i]}\n" + done + + component_status="PARTIALOUTAGE" + if ((${#failures[@]} == ${#modules[@]})); then + component_status="MAJOROUTAGE" + fi + # see https://instatus.com/help/api/incidents + incident_id=$(curl -s -X POST "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/incidents" \ + -H "Authorization: Bearer $INSTATUS_API_KEY" \ + -H "Content-Type: application/json" \ + -d "{ \"name\": \"$incident_name\", \"message\": \"$message\", \"components\": [\"$INSTATUS_COMPONENT_ID\"], @@ -76,129 +76,129 @@ create_incident() { ] }" | jq -r '.id') - echo "Created incident with ID: $incident_id" + echo "Created incident with ID: $incident_id" } # 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" \ - -H "Authorization: Bearer $INSTATUS_API_KEY" \ - -H "Content-Type: application/json" | jq -r '.incidents[] | select(.status != "RESOLVED") | .id') - - if [[ -n "$unresolved_incidents" ]]; then - echo "Unresolved incidents found: $unresolved_incidents" - return 0 # Indicate that there are unresolved incidents - else - echo "No unresolved incidents found." - return 1 # Indicate that no unresolved incidents exist - fi + # 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" \ + -H "Authorization: Bearer $INSTATUS_API_KEY" \ + -H "Content-Type: application/json" | jq -r '.incidents[] | select(.status != "RESOLVED") | .id') + + if [[ -n "$unresolved_incidents" ]]; then + echo "Unresolved incidents found: $unresolved_incidents" + return 0 # Indicate that there are unresolved incidents + else + echo "No unresolved incidents found." + return 1 # Indicate that no unresolved incidents exist + fi } force_redeploy_registry() { - # These are not secret values; safe to just expose directly in script - local VERCEL_TEAM_SLUG="codercom" - local VERCEL_TEAM_ID="team_tGkWfhEGGelkkqUUm9nXq17r" - local VERCEL_APP="registry" - - local latest_res - latest_res=$( - curl "https://api.vercel.com/v6/deployments?app=$VERCEL_APP&limit=1&slug=$VERCEL_TEAM_SLUG&teamId=$VERCEL_TEAM_ID&target=production&state=BUILDING,INITIALIZING,QUEUED,READY" \ - --fail \ - --silent \ - --header "Authorization: Bearer $VERCEL_API_KEY" \ - --header "Content-Type: application/json" - ) - - # If we have zero deployments, something is VERY wrong. Make the whole - # script exit with a non-zero status code - local latest_id - latest_id=$(echo "${latest_res}" | jq -r '.deployments[0].uid') - if [[ "${latest_id}" = "null" ]]; then - echo "Unable to pull any previous deployments for redeployment" - echo "Please redeploy the latest deployment manually in Vercel." - echo "https://vercel.com/codercom/registry/deployments" - exit 1 - fi - - local latest_date_ts_seconds - latest_date_ts_seconds=$(echo "${latest_res}" | jq -r '.deployments[0].createdAt/1000|floor') - local current_date_ts_seconds - current_date_ts_seconds="$(date +%s)" - local max_redeploy_interval_seconds=7200 # 2 hours - if ((current_date_ts_seconds - latest_date_ts_seconds < max_redeploy_interval_seconds)); then - echo "The registry was deployed less than 2 hours ago." - echo "Not automatically re-deploying the regitstry." - echo "A human reading this message should decide if a redeployment is necessary." - echo "Please check the Vercel dashboard for more information." - echo "https://vercel.com/codercom/registry/deployments" - exit 1 - fi - - local latest_deployment_state - latest_deployment_state="$(echo "${latest_res}" | jq -r '.deployments[0].state')" - if [[ "${latest_deployment_state}" != "READY" ]]; then - echo "Last deployment was not in READY state. Skipping redeployment." - echo "A human reading this message should decide if a redeployment is necessary." - echo "Please check the Vercel dashboard for more information." - echo "https://vercel.com/codercom/registry/deployments" - exit 1 - fi - - echo "=============================================================" - echo "!!! Redeploying registry with deployment ID: ${latest_id} !!!" - echo "=============================================================" - - if ! curl -X POST "https://api.vercel.com/v13/deployments?forceNew=1&skipAutoDetectionConfirmation=1&slug=$VERCEL_TEAM_SLUG&teamId=$VERCEL_TEAM_ID" \ - --fail \ - --header "Authorization: Bearer $VERCEL_API_KEY" \ - --header "Content-Type: application/json" \ - --data-raw "{ \"deploymentId\": \"${latest_id}\", \"name\": \"${VERCEL_APP}\", \"target\": \"production\" }"; then - echo "DEPLOYMENT FAILED! Please check the Vercel dashboard for more information." - echo "https://vercel.com/codercom/registry/deployments" - exit 1 - fi + # These are not secret values; safe to just expose directly in script + local VERCEL_TEAM_SLUG="codercom" + local VERCEL_TEAM_ID="team_tGkWfhEGGelkkqUUm9nXq17r" + local VERCEL_APP="registry" + + local latest_res + latest_res=$( + curl "https://api.vercel.com/v6/deployments?app=$VERCEL_APP&limit=1&slug=$VERCEL_TEAM_SLUG&teamId=$VERCEL_TEAM_ID&target=production&state=BUILDING,INITIALIZING,QUEUED,READY" \ + --fail \ + --silent \ + --header "Authorization: Bearer $VERCEL_API_KEY" \ + --header "Content-Type: application/json" + ) + + # If we have zero deployments, something is VERY wrong. Make the whole + # script exit with a non-zero status code + local latest_id + latest_id=$(echo "${latest_res}" | jq -r '.deployments[0].uid') + if [[ "${latest_id}" = "null" ]]; then + echo "Unable to pull any previous deployments for redeployment" + echo "Please redeploy the latest deployment manually in Vercel." + echo "https://vercel.com/codercom/registry/deployments" + exit 1 + fi + + local latest_date_ts_seconds + latest_date_ts_seconds=$(echo "${latest_res}" | jq -r '.deployments[0].createdAt/1000|floor') + local current_date_ts_seconds + current_date_ts_seconds="$(date +%s)" + local max_redeploy_interval_seconds=7200 # 2 hours + if ((current_date_ts_seconds - latest_date_ts_seconds < max_redeploy_interval_seconds)); then + echo "The registry was deployed less than 2 hours ago." + echo "Not automatically re-deploying the regitstry." + echo "A human reading this message should decide if a redeployment is necessary." + echo "Please check the Vercel dashboard for more information." + echo "https://vercel.com/codercom/registry/deployments" + exit 1 + fi + + local latest_deployment_state + latest_deployment_state="$(echo "${latest_res}" | jq -r '.deployments[0].state')" + if [[ "${latest_deployment_state}" != "READY" ]]; then + echo "Last deployment was not in READY state. Skipping redeployment." + echo "A human reading this message should decide if a redeployment is necessary." + echo "Please check the Vercel dashboard for more information." + echo "https://vercel.com/codercom/registry/deployments" + exit 1 + fi + + echo "=============================================================" + echo "!!! Redeploying registry with deployment ID: ${latest_id} !!!" + echo "=============================================================" + + if ! curl -X POST "https://api.vercel.com/v13/deployments?forceNew=1&skipAutoDetectionConfirmation=1&slug=$VERCEL_TEAM_SLUG&teamId=$VERCEL_TEAM_ID" \ + --fail \ + --header "Authorization: Bearer $VERCEL_API_KEY" \ + --header "Content-Type: application/json" \ + --data-raw "{ \"deploymentId\": \"${latest_id}\", \"name\": \"${VERCEL_APP}\", \"target\": \"production\" }"; then + echo "DEPLOYMENT FAILED! Please check the Vercel dashboard for more information." + echo "https://vercel.com/codercom/registry/deployments" + exit 1 + fi } # Check each module's accessibility for module in "${modules[@]}"; do - # Trim leading/trailing whitespace from module name - module=$(echo "${module}" | xargs) - url="${REGISTRY_BASE_URL}/modules/${module}" - printf "=== Checking module %s at %s\n" "${module}" "${url}" - status_code=$(curl --output /dev/null --head --silent --fail --location "${url}" --retry 3 --write-out "%{http_code}") - if ((status_code != 200)); then - printf "==> FAIL(%s)\n" "${status_code}" - status=1 - failures+=("${module}") - else - printf "==> OK(%s)\n" "${status_code}" - fi + # Trim leading/trailing whitespace from module name + module=$(echo "${module}" | xargs) + url="${REGISTRY_BASE_URL}/modules/${module}" + printf "=== Checking module %s at %s\n" "${module}" "${url}" + status_code=$(curl --output /dev/null --head --silent --fail --location "${url}" --retry 3 --write-out "%{http_code}") + if ((status_code != 200)); then + printf "==> FAIL(%s)\n" "${status_code}" + status=1 + failures+=("${module}") + else + printf "==> OK(%s)\n" "${status_code}" + fi done # Determine overall status and update Instatus component if ((status == 0)); then - echo "All modules are operational." - # set to - update_component_status "OPERATIONAL" + echo "All modules are operational." + # set to + update_component_status "OPERATIONAL" else - echo "The following modules have issues: ${failures[*]}" - # check if all modules are down - if ((${#failures[@]} == ${#modules[@]})); then - update_component_status "MAJOROUTAGE" - else - update_component_status "PARTIALOUTAGE" - fi - - # Check if there is an existing incident before creating a new one - if ! check_existing_incident; then - create_incident - fi - - # If a module is down, force a reployment to try getting things back online - # ASAP - # EDIT: registry.coder.com is no longer hosted on vercel - #force_redeploy_registry + echo "The following modules have issues: ${failures[*]}" + # check if all modules are down + if ((${#failures[@]} == ${#modules[@]})); then + update_component_status "MAJOROUTAGE" + else + update_component_status "PARTIALOUTAGE" + fi + + # Check if there is an existing incident before creating a new one + if ! check_existing_incident; then + create_incident + fi + + # If a module is down, force a reployment to try getting things back online + # ASAP + # EDIT: registry.coder.com is no longer hosted on vercel + #force_redeploy_registry fi exit "${status}" From caf1a05b9e02d1b4c68fac152b4eaa2a255338a1 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 20:03:39 +0000 Subject: [PATCH 05/10] fix: update commands for package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a00e8bd8..5d324cae 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "modules", "scripts": { "test": "bun test", - "fmt": "bun x prettier --write **/*.sh **/*.ts **/*.md *.md && terraform fmt **/*.tf", - "fmt:ci": "bun x prettier --check **/*.sh **/*.ts **/*.md *.md && terraform fmt -check **/*.tf", + "fmt": "bun x prettier --write **/*.sh **/*.ts **/*.md *.md && terraform fmt -recursive -diff", + "fmt:ci": "bun x prettier --check **/*.sh **/*.ts **/*.md *.md && terraform fmt -check -recursive -diff", "update-version": "./update-version.sh" }, "devDependencies": { From 251ac37d216de99a8e6c7fc32c3cf49515f02ee6 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 20:08:05 +0000 Subject: [PATCH 06/10] fix: make typo exceptions for HashiCorp --- .github/typos.toml | 4 +++- .github/workflows/ci.yaml | 1 - examples/modules/run.sh | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/typos.toml b/.github/typos.toml index 65b4251a..5889c7d7 100644 --- a/.github/typos.toml +++ b/.github/typos.toml @@ -1,2 +1,4 @@ [default.extend-words] -muc = "muc" # For Munich location code \ No newline at end of file +muc = "muc" # For Munich location code +Hashi = "Hashi" +HashiCorp = "HashiCorp" \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b04ec924..0bd44e57 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,7 +54,6 @@ jobs: validate-readme-files: name: Validate README files runs-on: ubuntu-latest - # We want to do some basic README checks first before we try analyzing the # contents needs: validate-style diff --git a/examples/modules/run.sh b/examples/modules/run.sh index f50f6baa..c5a265ed 100644 --- a/examples/modules/run.sh +++ b/examples/modules/run.sh @@ -11,7 +11,7 @@ BOLD='\033[0;1m' printf "$${BOLD}Installing MODULE_NAME ...\n\n" # Add code here -# Use varibles from the templatefile function in main.tf +# Use variables from the templatefile function in main.tf # e.g. LOG_PATH, PORT, etc. printf "🥳 Installation comlete!\n\n" @@ -21,6 +21,6 @@ printf "👷 Starting MODULE_NAME in background...\n\n" # 1. Use & to run it in background # 2. redirct stdout and stderr to log files -./app > "$${LOG_PATH}" 2>&1 & +./app >"$${LOG_PATH}" 2>&1 & printf "check logs at %s\n\n" "$${LOG_PATH}" From a78e2c81c5477adc66634b26c4f3ab4929e85890 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 20:09:32 +0000 Subject: [PATCH 07/10] fix: remove typo in 'complete' --- examples/modules/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/modules/run.sh b/examples/modules/run.sh index c5a265ed..3d4aaf07 100644 --- a/examples/modules/run.sh +++ b/examples/modules/run.sh @@ -14,7 +14,7 @@ printf "$${BOLD}Installing MODULE_NAME ...\n\n" # Use variables from the templatefile function in main.tf # e.g. LOG_PATH, PORT, etc. -printf "🥳 Installation comlete!\n\n" +printf "🥳 Installation complete!\n\n" printf "👷 Starting MODULE_NAME in background...\n\n" # Start the app in here From c5bb685f62fcd66b51d773202fd9393de38d14c3 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 20:11:19 +0000 Subject: [PATCH 08/10] fix: update Bash formatting --- examples/modules/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/modules/run.sh b/examples/modules/run.sh index 3d4aaf07..a15fcf6c 100644 --- a/examples/modules/run.sh +++ b/examples/modules/run.sh @@ -21,6 +21,6 @@ printf "👷 Starting MODULE_NAME in background...\n\n" # 1. Use & to run it in background # 2. redirct stdout and stderr to log files -./app >"$${LOG_PATH}" 2>&1 & +./app > "$${LOG_PATH}" 2>&1 & printf "check logs at %s\n\n" "$${LOG_PATH}" From 88cb8ce7e5ae24f896c2feb904e5f517e0a1bf35 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 22 Apr 2025 20:12:43 +0000 Subject: [PATCH 09/10] fix: remove bad script reference --- .github/workflows/ci.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0bd44e57..c724fbae 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,8 +49,6 @@ jobs: uses: crate-ci/typos@v1.31.1 with: config: .github/typos.toml - - name: Lint - run: bun lint validate-readme-files: name: Validate README files runs-on: ubuntu-latest From a57155d63a3e60149153c0a5dbe93ecc96661f99 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 29 Apr 2025 14:06:21 +0000 Subject: [PATCH 10/10] fix: format new sh file --- scripts/terraform_validate.sh | 46 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/scripts/terraform_validate.sh b/scripts/terraform_validate.sh index 2c28a0da..8b22d4af 100755 --- a/scripts/terraform_validate.sh +++ b/scripts/terraform_validate.sh @@ -3,35 +3,35 @@ set -euo pipefail validate_terraform_directory() { - local dir="$1" - echo "Running \`terraform validate\` in $dir" - pushd "$dir" - terraform init -upgrade - terraform validate - popd + local dir="$1" + echo "Running \`terraform validate\` in $dir" + pushd "$dir" + terraform init -upgrade + terraform validate + popd } main() { - # Get the directory of the script - local script_dir=$(dirname "$(readlink -f "$0")") + # Get the directory of the script + local script_dir=$(dirname "$(readlink -f "$0")") - # Code assumes that registry directory will always be in same position - # relative to the main script directory - local registry_dir="$script_dir/../registry" + # Code assumes that registry directory will always be in same position + # relative to the main script directory + local registry_dir="$script_dir/../registry" - # Get all subdirectories in the registry directory. Code assumes that - # Terraform directories won't begin to appear until three levels deep into - # the registry (e.g., registry/coder/modules/coder-login, which will then - # have a main.tf file inside it) - local subdirs=$(find "$registry_dir" -mindepth 3 -type d | sort) + # Get all subdirectories in the registry directory. Code assumes that + # Terraform directories won't begin to appear until three levels deep into + # the registry (e.g., registry/coder/modules/coder-login, which will then + # have a main.tf file inside it) + local subdirs=$(find "$registry_dir" -mindepth 3 -type d | sort) - for dir in $subdirs; do - # Skip over any directories that obviously don't have the necessary - # files - if test -f "$dir/main.tf"; then - validate_terraform_directory "$dir" - fi - done + for dir in $subdirs; do + # Skip over any directories that obviously don't have the necessary + # files + if test -f "$dir/main.tf"; then + validate_terraform_directory "$dir" + fi + done } main