diff --git a/.github/scripts/check.sh b/.github/scripts/check.sh index 5c1e83d4..01bf3e41 100755 --- a/.github/scripts/check.sh +++ b/.github/scripts/check.sh @@ -48,7 +48,7 @@ update_component_status() { # Function to create an incident create_incident() { - local incident_name="Testing Instatus" + 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" @@ -59,7 +59,7 @@ create_incident() { component_status="MAJOROUTAGE" fi # see https://instatus.com/help/api/incidents - response=$(curl -s -X POST "https://api.instatus.com/v1/$INSTATUS_PAGE_ID/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 "{ @@ -74,10 +74,25 @@ create_incident() { \"status\": \"PARTIALOUTAGE\" } ] - }") + }" | jq -r '.id') - incident_id=$(echo "$response" | jq -r '.id') - echo "$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 } force_redeploy_registry () { @@ -174,9 +189,10 @@ else update_component_status "PARTIALOUTAGE" fi - # Create a new incident - incident_id=$(create_incident) - echo "Created incident with ID: $incident_id" + # 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 diff --git a/code-server/README.md b/code-server/README.md index 330661c2..2238793f 100644 --- a/code-server/README.md +++ b/code-server/README.md @@ -14,7 +14,7 @@ Automatically install [code-server](https://github.com/coder/code-server) in a w ```tf module "code-server" { source = "registry.coder.com/modules/code-server/coder" - version = "1.0.18" + version = "1.0.26" agent_id = coder_agent.example.id } ``` @@ -28,7 +28,7 @@ module "code-server" { ```tf module "code-server" { source = "registry.coder.com/modules/code-server/coder" - version = "1.0.18" + version = "1.0.26" agent_id = coder_agent.example.id install_version = "4.8.3" } @@ -41,7 +41,7 @@ Install the Dracula theme from [OpenVSX](https://open-vsx.org/): ```tf module "code-server" { source = "registry.coder.com/modules/code-server/coder" - version = "1.0.18" + version = "1.0.26" agent_id = coder_agent.example.id extensions = [ "dracula-theme.theme-dracula" @@ -58,7 +58,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte ```tf module "code-server" { source = "registry.coder.com/modules/code-server/coder" - version = "1.0.18" + version = "1.0.26" agent_id = coder_agent.example.id extensions = ["dracula-theme.theme-dracula"] settings = { @@ -74,7 +74,7 @@ Just run code-server in the background, don't fetch it from GitHub: ```tf module "code-server" { source = "registry.coder.com/modules/code-server/coder" - version = "1.0.18" + version = "1.0.26" agent_id = coder_agent.example.id extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"] } @@ -89,7 +89,7 @@ Run an existing copy of code-server if found, otherwise download from GitHub: ```tf module "code-server" { source = "registry.coder.com/modules/code-server/coder" - version = "1.0.18" + version = "1.0.26" agent_id = coder_agent.example.id use_cached = true extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"] @@ -101,7 +101,7 @@ Just run code-server in the background, don't fetch it from GitHub: ```tf module "code-server" { source = "registry.coder.com/modules/code-server/coder" - version = "1.0.18" + version = "1.0.26" agent_id = coder_agent.example.id offline = true } diff --git a/code-server/main.tf b/code-server/main.tf index 99616934..c80e5378 100644 --- a/code-server/main.tf +++ b/code-server/main.tf @@ -39,7 +39,7 @@ variable "slug" { } variable "settings" { - type = map(string) + type = any description = "A map of settings to apply to code-server." default = {} } diff --git a/vscode-web/README.md b/vscode-web/README.md index 8b5fa688..48b8e119 100644 --- a/vscode-web/README.md +++ b/vscode-web/README.md @@ -14,7 +14,7 @@ Automatically install [Visual Studio Code Server](https://code.visualstudio.com/ ```tf module "vscode-web" { source = "registry.coder.com/modules/vscode-web/coder" - version = "1.0.22" + version = "1.0.26" agent_id = coder_agent.example.id accept_license = true } @@ -29,7 +29,7 @@ module "vscode-web" { ```tf module "vscode-web" { source = "registry.coder.com/modules/vscode-web/coder" - version = "1.0.22" + version = "1.0.26" agent_id = coder_agent.example.id install_prefix = "/home/coder/.vscode-web" folder = "/home/coder" @@ -42,7 +42,7 @@ module "vscode-web" { ```tf module "vscode-web" { source = "registry.coder.com/modules/vscode-web/coder" - version = "1.0.22" + version = "1.0.26" agent_id = coder_agent.example.id extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"] accept_license = true @@ -56,7 +56,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte ```tf module "vscode-web" { source = "registry.coder.com/modules/vscode-web/coder" - version = "1.0.22" + version = "1.0.26" agent_id = coder_agent.example.id extensions = ["dracula-theme.theme-dracula"] settings = { diff --git a/vscode-web/main.tf b/vscode-web/main.tf index 207450e5..4a2f04ea 100644 --- a/vscode-web/main.tf +++ b/vscode-web/main.tf @@ -92,7 +92,7 @@ variable "order" { } variable "settings" { - type = map(string) + type = any description = "A map of settings to apply to VS Code web." default = {} }