From 53be98bc60fb6362cf2040787f05772ba9f98e8e Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 27 Jun 2024 21:17:27 -0600 Subject: [PATCH 1/4] use ops.kibana.dev cluster --- .buildkite/scripts/lifecycle/print_agent_links.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/lifecycle/print_agent_links.ts b/.buildkite/scripts/lifecycle/print_agent_links.ts index 428ec3dc0aaff..f84ea284be726 100644 --- a/.buildkite/scripts/lifecycle/print_agent_links.ts +++ b/.buildkite/scripts/lifecycle/print_agent_links.ts @@ -20,14 +20,14 @@ import { BuildkiteClient } from '#pipeline-utils'; const twoHours = new Date(startTime.getTime() + 2 * 60 * 60 * 1000); const METRICS_URL = [ - `https://kibana-ops-buildkite-monitoring.kb.us-central1.gcp.cloud.es.io:9243`, + `https://ops.kibana.dev/s/ci`, `/app/metrics/link-to/host-detail/${process.env.BUILDKITE_AGENT_NAME}`, `?to=${twoHours.getTime()}`, `&from=${startTime.getTime()}`, ].join(''); const LOGS_URL = [ - `https://kibana-ops-buildkite-monitoring.kb.us-central1.gcp.cloud.es.io:9243`, + `https://ops.kibana.dev/s/ci`, `/app/logs/link-to/host-logs/${process.env.BUILDKITE_AGENT_NAME}`, `?time=${startTime.getTime()}`, ].join(''); From df74faa81a4aed51c6f21aa5b3ebb8ded439656b Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 27 Jun 2024 21:18:05 -0600 Subject: [PATCH 2/4] remove ssh info --- .buildkite/scripts/lifecycle/pre_command.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index c0b08f474bbd2..f7a257feb6635 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -12,17 +12,10 @@ else source .buildkite/scripts/common/setup_node.sh source .buildkite/scripts/common/setup_buildkite_deps.sh - echo '--- Agent Debug/SSH Info' + echo '--- Agent Debug' ts-node .buildkite/scripts/lifecycle/print_agent_links.ts || true fi -if [[ "$(curl -is metadata.google.internal || true)" ]]; then - echo "" - echo "To SSH into this agent, run:" - echo "gcloud compute ssh --tunnel-through-iap --project elastic-kibana-ci --zone \"$(curl -sH Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/zone)\" \"$(curl -sH Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/name)\"" - echo "" -fi - if [[ "${BUILDKITE_LABEL:-}" == *"Run Dynamic Pipeline"* || "${BUILDKITE_LABEL:-}" == *"Upload Pipeline"* ]]; then cat << EOF | buildkite-agent annotate --context "ctx-gobld-metrics" --style "info"
From 6fa3493ca307d9c5b459f77a9528a27840564668 Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 27 Jun 2024 21:49:43 -0600 Subject: [PATCH 3/4] add word --- .buildkite/scripts/lifecycle/pre_command.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index f7a257feb6635..e57a0dc9a5018 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -12,7 +12,7 @@ else source .buildkite/scripts/common/setup_node.sh source .buildkite/scripts/common/setup_buildkite_deps.sh - echo '--- Agent Debug' + echo '--- Agent Debug Info' ts-node .buildkite/scripts/lifecycle/print_agent_links.ts || true fi From 8883324866e901aec892c8bdbf3eb7014e378055 Mon Sep 17 00:00:00 2001 From: Brad White Date: Mon, 8 Jul 2024 13:43:54 -0600 Subject: [PATCH 4/4] remove old agent debug info --- .buildkite/scripts/lifecycle/post_command.sh | 7 --- .buildkite/scripts/lifecycle/pre_command.sh | 3 -- .../scripts/lifecycle/print_agent_links.ts | 47 ------------------- 3 files changed, 57 deletions(-) delete mode 100644 .buildkite/scripts/lifecycle/print_agent_links.ts diff --git a/.buildkite/scripts/lifecycle/post_command.sh b/.buildkite/scripts/lifecycle/post_command.sh index b22293dbcb8b6..47e118a402408 100755 --- a/.buildkite/scripts/lifecycle/post_command.sh +++ b/.buildkite/scripts/lifecycle/post_command.sh @@ -6,13 +6,6 @@ echo '--- Log out of gcloud' ./.buildkite/scripts/common/activate_service_account.sh --unset-impersonation || echo "Failed to unset impersonation" ./.buildkite/scripts/common/activate_service_account.sh --logout-gcloud || echo "Failed to log out of gcloud" -if [[ "${SKIP_NODE_SETUP:-}" =~ ^(1|true)$ ]]; then - echo '--- Skipping Agent Debug Info' -else - echo '--- Agent Debug Info' - ts-node .buildkite/scripts/lifecycle/print_agent_links.ts || true -fi - IS_TEST_EXECUTION_STEP="$(buildkite-agent meta-data get "${BUILDKITE_JOB_ID}_is_test_execution_step" --default '')" if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index e57a0dc9a5018..3b2a3dcdcdad1 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -11,9 +11,6 @@ if [[ "${SKIP_NODE_SETUP:-}" =~ ^(1|true)$ ]]; then else source .buildkite/scripts/common/setup_node.sh source .buildkite/scripts/common/setup_buildkite_deps.sh - - echo '--- Agent Debug Info' - ts-node .buildkite/scripts/lifecycle/print_agent_links.ts || true fi if [[ "${BUILDKITE_LABEL:-}" == *"Run Dynamic Pipeline"* || "${BUILDKITE_LABEL:-}" == *"Upload Pipeline"* ]]; then diff --git a/.buildkite/scripts/lifecycle/print_agent_links.ts b/.buildkite/scripts/lifecycle/print_agent_links.ts deleted file mode 100644 index f84ea284be726..0000000000000 --- a/.buildkite/scripts/lifecycle/print_agent_links.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { BuildkiteClient } from '#pipeline-utils'; - -(async () => { - try { - const client = new BuildkiteClient(); - const build = await client.getCurrentBuild(); - - const job = build.jobs.find((j) => j.id === process.env.BUILDKITE_JOB_ID); - const startTime = job - ? new Date(job.started_at) - : new Date(new Date().getTime() - 60 * 60 * 1000); - const twoHours = new Date(startTime.getTime() + 2 * 60 * 60 * 1000); - - const METRICS_URL = [ - `https://ops.kibana.dev/s/ci`, - `/app/metrics/link-to/host-detail/${process.env.BUILDKITE_AGENT_NAME}`, - `?to=${twoHours.getTime()}`, - `&from=${startTime.getTime()}`, - ].join(''); - - const LOGS_URL = [ - `https://ops.kibana.dev/s/ci`, - `/app/logs/link-to/host-logs/${process.env.BUILDKITE_AGENT_NAME}`, - `?time=${startTime.getTime()}`, - ].join(''); - - console.log('Agent Metrics:'); - console.log('\u001b]1339;' + `url='${METRICS_URL}'\u0007`); - console.log('Agent Logs:'); - console.log('\u001b]1339;' + `url='${LOGS_URL}'\u0007`); - } catch (ex) { - // Probably don't need to fail the build for this failure, just log it - console.error('Buildkite API Error', ex.message); - if (ex.response) { - console.error('HTTP Error Response Status', ex.response.status); - console.error('HTTP Error Response Body', ex.response.data); - } - } -})();