Files
nomad/enos/modules/upgrade_client/scripts/set_metadata.sh
Juana De La Cuesta 2dadf9fe6c Improve stability (#25244)
* func: add dependencies to avoid race conditions and move the update to each client to the main upgrade scenario

* Update enos/enos-scenario-upgrade.hcl

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* Update enos/enos-scenario-upgrade.hcl

Co-authored-by: Tim Gross <tgross@hashicorp.com>

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2025-03-04 16:23:07 +01:00

19 lines
520 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
set -euo pipefail
if ! client_id=$(nomad node status -address "https://$CLIENT_IP:4646" -self -json | jq '.ID' | tr -d '"'); then
echo "No client found at $CLIENT_IP"
exit 1
fi
if ! nomad node meta apply \
-node-id "$client_id" node_ip="$CLIENT_IP" nomad_addr="$NOMAD_ADDR"; then
echo "Failed to set metadata for node: $client_id at $CLIENT_IP"
exit 1
fi
echo "Metadata updated in $client_id at $CLIENT_IP"