From 04efcedcb4e49133a207391e30bcac8aa842e01b Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 10 Aug 2023 07:36:06 +0000 Subject: [PATCH 1/4] make preferred region the first in list --- site/src/components/Resources/AgentLatency.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/site/src/components/Resources/AgentLatency.tsx b/site/src/components/Resources/AgentLatency.tsx index 04f790980c977..9be53f106cc2f 100644 --- a/site/src/components/Resources/AgentLatency.tsx +++ b/site/src/components/Resources/AgentLatency.tsx @@ -69,14 +69,9 @@ export const AgentLatency: FC<{ agent: WorkspaceAgent }> = ({ agent }) => { - {Object.keys(agent.latency).map((regionName) => { - if (!agent.latency) { - throw new Error("No latency found on agent") - } - - const region = agent.latency[regionName] - - return ( + {Object.entries(agent.latency) + .sort(([, a], [, b]) => (a.preferred ? -1 : b.preferred ? 1 : 0)) + .map(([regionName, region]) => ( = ({ agent }) => { {regionName} {Math.round(region.latency_ms)}ms - ) - })} + ))} From 2f946d573173ec362af28681a5df918caf6a9aa3 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 10 Aug 2023 08:03:35 +0000 Subject: [PATCH 2/4] update DERP config for testing --- .github/workflows/pr-deploy.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index adc0e2d25c376..535bd04d62e30 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -217,7 +217,7 @@ jobs: needs: [build, get_info] # Run deploy job only if build job was successful or skipped if: | - always() && (needs.build.result == 'success' || needs.build.result == 'skipped') && + always() && (needs.build.result == 'success' || needs.build.result == 'skipped') && (github.event_name == 'workflow_dispatch' || needs.get_info.outputs.NEW == 'false') runs-on: "ubuntu-latest" env: @@ -358,6 +358,8 @@ jobs: value: "${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }}" - name: "CODER_OAUTH2_GITHUB_ALLOWED_ORGS" value: "coder" + - name: "CODER_DERP_CONFIG_URL" + value: "https://controlplane.tailscale.com/derpmap/default" EOF - name: Install/Upgrade Helm chart From c380bd5a9cf5a96d162c3bdbe71211c90e2efbf1 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 10 Aug 2023 08:25:06 +0000 Subject: [PATCH 3/4] revert back --- .github/workflows/pr-deploy.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 535bd04d62e30..dd6dcc8a07701 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -358,8 +358,6 @@ jobs: value: "${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }}" - name: "CODER_OAUTH2_GITHUB_ALLOWED_ORGS" value: "coder" - - name: "CODER_DERP_CONFIG_URL" - value: "https://controlplane.tailscale.com/derpmap/default" EOF - name: Install/Upgrade Helm chart From 76baa3ada9e8ca27736a35300f9e87ec5d685ddf Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 10 Aug 2023 15:55:38 +0300 Subject: [PATCH 4/4] Discard changes to .github/workflows/pr-deploy.yaml --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index dd6dcc8a07701..adc0e2d25c376 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -217,7 +217,7 @@ jobs: needs: [build, get_info] # Run deploy job only if build job was successful or skipped if: | - always() && (needs.build.result == 'success' || needs.build.result == 'skipped') && + always() && (needs.build.result == 'success' || needs.build.result == 'skipped') && (github.event_name == 'workflow_dispatch' || needs.get_info.outputs.NEW == 'false') runs-on: "ubuntu-latest" env: