From 3b927f4e3a52127d85912da2908c1cc484dd9779 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Tue, 24 Feb 2026 19:42:56 +0000 Subject: [PATCH 01/10] cortex config --- src/vscode-docker/.devcontainer.json | 2 +- src/vscode-docker/create-cortex-config.sh | 90 +++++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 src/vscode-docker/create-cortex-config.sh diff --git a/src/vscode-docker/.devcontainer.json b/src/vscode-docker/.devcontainer.json index 7a57f43c..b47feed3 100644 --- a/src/vscode-docker/.devcontainer.json +++ b/src/vscode-docker/.devcontainer.json @@ -5,7 +5,7 @@ "shutdownAction": "none", "workspaceFolder": "/workspace", "postCreateCommand": - "./startupscript/post-startup.sh abc /config \"${templateOption:cloud}\" \"${templateOption:login}\"", + "./startupscript/post-startup.sh abc /config \"${templateOption:cloud}\" \"${templateOption:login}\"; bash ./create-cortex-config.sh /config", // re-mount bucket files on container start up "postStartCommand": [ "./startupscript/remount-on-restart.sh", diff --git a/src/vscode-docker/create-cortex-config.sh b/src/vscode-docker/create-cortex-config.sh new file mode 100644 index 00000000..0c61dd42 --- /dev/null +++ b/src/vscode-docker/create-cortex-config.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +# create-cortex-config.sh +# +# Creates cortex.yaml configuration file in the container user's home directory +# This script runs inside the container and attempts to retrieve GCP metadata + +set -o errexit +set -o nounset +set -o pipefail + +# Wait for metadata server to be ready +echo "Waiting 5 seconds for metadata server to be ready..." +sleep 5 + +if [[ $# -ne 1 ]]; then + echo "Usage: $0 " + exit 1 +fi + +readonly HOME_DIR="${1}" +readonly CORTEX_CONFIG_PATH="${HOME_DIR}/cortex.yaml" + +echo "Creating cortex.yaml configuration..." + +# Try to get GCP project ID from metadata server +# Note: This may not work from inside the container depending on network configuration +GCP_PROJECT_ID="" +GCP_REGION="" + +if GCP_PROJECT_ID=$(curl --retry 3 --max-time 5 -s -f \ + -H "Metadata-Flavor: Google" \ + "http://metadata.google.internal/computeMetadata/v1/project/project-id" 2>/dev/null); then + echo "Successfully retrieved GCP project ID: ${GCP_PROJECT_ID}" + + # Also try to get the region + if ZONE=$(curl --retry 3 --max-time 5 -s -f \ + -H "Metadata-Flavor: Google" \ + "http://metadata.google.internal/computeMetadata/v1/instance/zone" 2>/dev/null); then + GCP_REGION=$(echo "${ZONE}" | awk -F'/' '{print $4}' | sed 's/-[^-]*$//') + echo "Successfully retrieved GCP region: ${GCP_REGION}" + fi +else + echo "Warning: Could not retrieve GCP project ID from metadata server" + echo "The metadata server may not be accessible from inside the container" + + # Check if gcloud is available and authenticated as a fallback + if command -v gcloud &> /dev/null; then + if GCP_PROJECT_ID=$(gcloud config get-value project 2>/dev/null) && [[ -n "${GCP_PROJECT_ID}" ]]; then + echo "Retrieved project ID from gcloud config: ${GCP_PROJECT_ID}" + GCP_REGION=$(gcloud config get-value compute/region 2>/dev/null || echo "") + fi + fi +fi + +# Create the cortex.yaml file +if [[ -n "${GCP_PROJECT_ID}" ]]; then + cat > "${CORTEX_CONFIG_PATH}" << EOF +# Cortex configuration +# Generated on $(date -u +"%Y-%m-%d %H:%M:%S UTC") +gcp: + project_id: ${GCP_PROJECT_ID} +EOF + + if [[ -n "${GCP_REGION}" ]]; then + cat >> "${CORTEX_CONFIG_PATH}" << EOF + region: ${GCP_REGION} +EOF + fi + + echo "cortex.yaml created successfully at ${CORTEX_CONFIG_PATH}" + cat "${CORTEX_CONFIG_PATH}" +else + echo "Warning: Could not determine GCP project ID" + echo "Creating cortex.yaml with placeholder values" + cat > "${CORTEX_CONFIG_PATH}" << EOF +# Cortex configuration +# Generated on $(date -u +"%Y-%m-%d %H:%M:%S UTC") +# WARNING: Could not automatically determine GCP project ID +gcp: + project_id: "UNKNOWN" + # Please update this file with the correct project ID +EOF + echo "cortex.yaml created with placeholder at ${CORTEX_CONFIG_PATH}" +fi + +# Ensure proper ownership +if [[ -f "${CORTEX_CONFIG_PATH}" ]]; then + chmod 644 "${CORTEX_CONFIG_PATH}" +fi From 970d2d8ecf20607790bc1b19ea3754d584f2f902 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Tue, 24 Feb 2026 19:50:42 +0000 Subject: [PATCH 02/10] modifications to cortex.yaml --- src/vscode-docker/create-cortex-config.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/vscode-docker/create-cortex-config.sh b/src/vscode-docker/create-cortex-config.sh index 0c61dd42..9579daed 100644 --- a/src/vscode-docker/create-cortex-config.sh +++ b/src/vscode-docker/create-cortex-config.sh @@ -58,16 +58,11 @@ if [[ -n "${GCP_PROJECT_ID}" ]]; then cat > "${CORTEX_CONFIG_PATH}" << EOF # Cortex configuration # Generated on $(date -u +"%Y-%m-%d %H:%M:%S UTC") -gcp: - project_id: ${GCP_PROJECT_ID} +gcp_project_id: ${GCP_PROJECT_ID} +gcp_region: ${GCP_REGION:-UNKNOWN} +profiles_repo: shared-artifacts-a2hhlz EOF - if [[ -n "${GCP_REGION}" ]]; then - cat >> "${CORTEX_CONFIG_PATH}" << EOF - region: ${GCP_REGION} -EOF - fi - echo "cortex.yaml created successfully at ${CORTEX_CONFIG_PATH}" cat "${CORTEX_CONFIG_PATH}" else @@ -77,9 +72,10 @@ else # Cortex configuration # Generated on $(date -u +"%Y-%m-%d %H:%M:%S UTC") # WARNING: Could not automatically determine GCP project ID -gcp: - project_id: "UNKNOWN" - # Please update this file with the correct project ID +gcp_project_id: "UNKNOWN" +gcp_region: "UNKNOWN" +profiles_repo: shared-artifacts-a2hhlz +# Please update this file with the correct values EOF echo "cortex.yaml created with placeholder at ${CORTEX_CONFIG_PATH}" fi From fbdb36bf80c8a8af1a3e2938ab848c53823a87ee Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Tue, 24 Feb 2026 21:57:20 +0000 Subject: [PATCH 03/10] install gh directly from release, avoid apt versioning issues --- src/vscode-docker/Dockerfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/vscode-docker/Dockerfile b/src/vscode-docker/Dockerfile index 98e0e657..15ee59eb 100644 --- a/src/vscode-docker/Dockerfile +++ b/src/vscode-docker/Dockerfile @@ -56,12 +56,10 @@ RUN wget https://go.dev/dl/go1.23.5.linux-amd64.tar.gz && \ rm go1.23.5.linux-amd64.tar.gz # Install gh (GitHub CLI version 2.86.0) -RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \ - chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \ - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \ - apt-get update && \ - apt-get install -y gh=2.86.0 && \ - rm -rf /var/lib/apt/lists/* +ARG GH_CLI_VERSION=2.86.0 +RUN curl -L "https://github.com/cli/cli/releases/download/v${GH_CLI_VERSION}/gh_${GH_CLI_VERSION}_linux_amd64.tar.gz" -o gh.tar.gz && \ + tar -xf gh.tar.gz --strip-components=1 -C /usr/local bin/gh && \ + rm gh.tar.gz # Install uv (Python package manager version 0.9.27) RUN curl -LsSf https://astral.sh/uv/0.9.27/install.sh | sh && \ From 7f18f78124ca34bafd496e6e3aeeea23ff10cfe7 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Tue, 24 Feb 2026 22:19:55 +0000 Subject: [PATCH 04/10] tarball extraction fix --- src/vscode-docker/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vscode-docker/Dockerfile b/src/vscode-docker/Dockerfile index 15ee59eb..0c540f4d 100644 --- a/src/vscode-docker/Dockerfile +++ b/src/vscode-docker/Dockerfile @@ -58,8 +58,9 @@ RUN wget https://go.dev/dl/go1.23.5.linux-amd64.tar.gz && \ # Install gh (GitHub CLI version 2.86.0) ARG GH_CLI_VERSION=2.86.0 RUN curl -L "https://github.com/cli/cli/releases/download/v${GH_CLI_VERSION}/gh_${GH_CLI_VERSION}_linux_amd64.tar.gz" -o gh.tar.gz && \ - tar -xf gh.tar.gz --strip-components=1 -C /usr/local bin/gh && \ - rm gh.tar.gz + tar -xzf gh.tar.gz && \ + mv gh_${GH_CLI_VERSION}_linux_amd64/bin/gh /usr/local/bin/ && \ + rm -rf gh.tar.gz gh_${GH_CLI_VERSION}_linux_amd64 # Install uv (Python package manager version 0.9.27) RUN curl -LsSf https://astral.sh/uv/0.9.27/install.sh | sh && \ From 8941ed074548736acd2da74e7fdd0902a1c17c79 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Tue, 24 Feb 2026 23:18:49 +0000 Subject: [PATCH 05/10] install cortex-cli as part of startup --- src/vscode-docker/.devcontainer.json | 2 +- src/vscode-docker/Dockerfile | 2 +- src/vscode-docker/install-cortex-cli.sh | 75 +++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 src/vscode-docker/install-cortex-cli.sh diff --git a/src/vscode-docker/.devcontainer.json b/src/vscode-docker/.devcontainer.json index b47feed3..e9e8bf33 100644 --- a/src/vscode-docker/.devcontainer.json +++ b/src/vscode-docker/.devcontainer.json @@ -5,7 +5,7 @@ "shutdownAction": "none", "workspaceFolder": "/workspace", "postCreateCommand": - "./startupscript/post-startup.sh abc /config \"${templateOption:cloud}\" \"${templateOption:login}\"; bash ./create-cortex-config.sh /config", + "./startupscript/post-startup.sh abc /config \"${templateOption:cloud}\" \"${templateOption:login}\"; bash ./create-cortex-config.sh /config; bash ./install-cortex-cli.sh", // re-mount bucket files on container start up "postStartCommand": [ "./startupscript/remount-on-restart.sh", diff --git a/src/vscode-docker/Dockerfile b/src/vscode-docker/Dockerfile index 0c540f4d..2194a26e 100644 --- a/src/vscode-docker/Dockerfile +++ b/src/vscode-docker/Dockerfile @@ -68,8 +68,8 @@ RUN curl -LsSf https://astral.sh/uv/0.9.27/install.sh | sh && \ mv $HOME/.local/bin/uvx /usr/local/bin/ # Set up environment variables -ENV PATH="/usr/local/go/bin:${PATH}" ENV GOPATH="/config/go" +ENV PATH="/usr/local/go/bin:${GOPATH}/bin:${PATH}" ENV GOPRIVATE="github.com/verily-src/*" ENV SUDO_PASSWORD="pwd" diff --git a/src/vscode-docker/install-cortex-cli.sh b/src/vscode-docker/install-cortex-cli.sh new file mode 100644 index 00000000..89b2b856 --- /dev/null +++ b/src/vscode-docker/install-cortex-cli.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +# install-cortex-cli.sh +# +# Installs cortex-cli from the verily1 monorepo if it exists +# This script runs inside the container after the postCreateCommand + +set -o errexit +set -o nounset +set -o pipefail + +echo "Checking for verily1 monorepo..." + +# Check multiple possible locations for verily1 repo +VERILY1_PATH="" +for path in "/workspace/repos/verily1" "/config/repos/verily1" "$HOME/repos/verily1"; do + if [[ -d "${path}" ]]; then + VERILY1_PATH="${path}" + break + fi +done + +if [[ -z "${VERILY1_PATH}" ]]; then + echo "verily1 repository not found in any of the expected locations:" + echo " - /workspace/repos/verily1" + echo " - /config/repos/verily1" + echo " - \$HOME/repos/verily1" + echo "Skipping cortex-cli installation" + exit 0 +fi + +readonly VERILY1_PATH + +echo "Found verily1 repository at ${VERILY1_PATH}" + +# Verify Go is installed +if ! command -v go &> /dev/null; then + echo "Error: Go is not installed or not in PATH" + exit 1 +fi + +echo "Go version: $(go version)" + +# Set up Go environment if not already set +export GOPATH="${GOPATH:-/config/go}" +export PATH="${PATH}:${GOPATH}/bin" + +echo "GOPATH: ${GOPATH}" +echo "Installing cortex-cli..." + +# Navigate to verily1 and install cortex-cli +cd "${VERILY1_PATH}" + +if [[ ! -d "cortex/tools/cortex-cli" ]]; then + echo "Error: cortex-cli source not found at cortex/tools/cortex-cli" + exit 1 +fi + +# Install cortex-cli +if go install ./cortex/tools/cortex-cli; then + echo "cortex-cli installed successfully to ${GOPATH}/bin/cortex-cli" + + # Verify installation + if [[ -f "${GOPATH}/bin/cortex-cli" ]]; then + echo "Verifying cortex-cli installation..." + "${GOPATH}/bin/cortex-cli" --help || echo "cortex-cli binary exists but --help failed" + else + echo "Warning: cortex-cli binary not found at expected location ${GOPATH}/bin/cortex-cli" + fi +else + echo "Error: Failed to install cortex-cli" + exit 1 +fi + +echo "cortex-cli installation complete" From f4a4305a41e6d5b8ff2a7964b3e254d08ccb9009 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Tue, 24 Feb 2026 23:59:14 +0000 Subject: [PATCH 06/10] install cortex as abc user --- src/vscode-docker/install-cortex-cli.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vscode-docker/install-cortex-cli.sh b/src/vscode-docker/install-cortex-cli.sh index 89b2b856..f835c4bc 100644 --- a/src/vscode-docker/install-cortex-cli.sh +++ b/src/vscode-docker/install-cortex-cli.sh @@ -56,8 +56,9 @@ if [[ ! -d "cortex/tools/cortex-cli" ]]; then exit 1 fi -# Install cortex-cli -if go install ./cortex/tools/cortex-cli; then +# Install cortex-cli as user abc (where SSH keys are configured) +echo "Installing cortex-cli as user abc (root doesn't have SSH keys)..." +if su - abc -c "export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:\${GOPATH}/bin:\${PATH} && cd ${VERILY1_PATH} && go install ./cortex/tools/cortex-cli"; then echo "cortex-cli installed successfully to ${GOPATH}/bin/cortex-cli" # Verify installation From d14c315334681ab6d83a604e3b1ab98271aa3d91 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Wed, 25 Feb 2026 18:54:47 +0000 Subject: [PATCH 07/10] verbose output for cortex install --- src/vscode-docker/install-cortex-cli.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vscode-docker/install-cortex-cli.sh b/src/vscode-docker/install-cortex-cli.sh index f835c4bc..1d2e7f63 100644 --- a/src/vscode-docker/install-cortex-cli.sh +++ b/src/vscode-docker/install-cortex-cli.sh @@ -58,7 +58,11 @@ fi # Install cortex-cli as user abc (where SSH keys are configured) echo "Installing cortex-cli as user abc (root doesn't have SSH keys)..." -if su - abc -c "export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:\${GOPATH}/bin:\${PATH} && cd ${VERILY1_PATH} && go install ./cortex/tools/cortex-cli"; then +echo "GOPATH is set to: ${GOPATH}" +echo "Running: su - abc -c 'export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:\${GOPATH}/bin:\${PATH} && cd ${VERILY1_PATH} && go install ./cortex/tools/cortex-cli'" + +# Capture both stdout and stderr +if su - abc -c "export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:\${GOPATH}/bin:\${PATH} && cd ${VERILY1_PATH} && go install ./cortex/tools/cortex-cli" 2>&1; then echo "cortex-cli installed successfully to ${GOPATH}/bin/cortex-cli" # Verify installation @@ -67,9 +71,13 @@ if su - abc -c "export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:\${GOPA "${GOPATH}/bin/cortex-cli" --help || echo "cortex-cli binary exists but --help failed" else echo "Warning: cortex-cli binary not found at expected location ${GOPATH}/bin/cortex-cli" + echo "Checking if it installed elsewhere..." + find /config -name "cortex-cli" 2>/dev/null || echo "cortex-cli not found in /config" fi else - echo "Error: Failed to install cortex-cli" + EXIT_CODE=$? + echo "Error: Failed to install cortex-cli (exit code: ${EXIT_CODE})" + echo "The error output should be visible above" exit 1 fi From 7f6a82b274fd51224c0b950736a29de21fb9f445 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Wed, 25 Feb 2026 20:04:55 +0000 Subject: [PATCH 08/10] pipe output from cortex install --- src/vscode-docker/install-cortex-cli.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/vscode-docker/install-cortex-cli.sh b/src/vscode-docker/install-cortex-cli.sh index 1d2e7f63..ac233991 100644 --- a/src/vscode-docker/install-cortex-cli.sh +++ b/src/vscode-docker/install-cortex-cli.sh @@ -59,10 +59,23 @@ fi # Install cortex-cli as user abc (where SSH keys are configured) echo "Installing cortex-cli as user abc (root doesn't have SSH keys)..." echo "GOPATH is set to: ${GOPATH}" -echo "Running: su - abc -c 'export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:\${GOPATH}/bin:\${PATH} && cd ${VERILY1_PATH} && go install ./cortex/tools/cortex-cli'" -# Capture both stdout and stderr -if su - abc -c "export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:\${GOPATH}/bin:\${PATH} && cd ${VERILY1_PATH} && go install ./cortex/tools/cortex-cli" 2>&1; then +# Create a temporary script to run as abc user +# This ensures we capture all output properly +INSTALL_SCRIPT="/tmp/install-cortex-cli-inner.sh" +cat > "${INSTALL_SCRIPT}" << 'EOF' +#!/bin/bash +set -x # Show commands being executed +export GOPATH=/config/go +export PATH=/usr/local/go/bin:${GOPATH}/bin:${PATH} +cd /config/repos/verily1 +exec go install ./cortex/tools/cortex-cli 2>&1 +EOF + +chmod +x "${INSTALL_SCRIPT}" + +echo "Running go install as user abc..." +if su abc -c "bash ${INSTALL_SCRIPT}"; then echo "cortex-cli installed successfully to ${GOPATH}/bin/cortex-cli" # Verify installation @@ -74,10 +87,13 @@ if su - abc -c "export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:\${GOPA echo "Checking if it installed elsewhere..." find /config -name "cortex-cli" 2>/dev/null || echo "cortex-cli not found in /config" fi + + rm -f "${INSTALL_SCRIPT}" else EXIT_CODE=$? echo "Error: Failed to install cortex-cli (exit code: ${EXIT_CODE})" - echo "The error output should be visible above" + echo "Check the output above for errors from go install" + rm -f "${INSTALL_SCRIPT}" exit 1 fi From 386c9e1a1d8820f39bc5893871fc846344fc4df3 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Wed, 25 Feb 2026 21:21:48 +0000 Subject: [PATCH 09/10] further attempts to see output from cortex install --- src/vscode-docker/install-cortex-cli.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/vscode-docker/install-cortex-cli.sh b/src/vscode-docker/install-cortex-cli.sh index ac233991..e885e3cd 100644 --- a/src/vscode-docker/install-cortex-cli.sh +++ b/src/vscode-docker/install-cortex-cli.sh @@ -75,7 +75,18 @@ EOF chmod +x "${INSTALL_SCRIPT}" echo "Running go install as user abc..." -if su abc -c "bash ${INSTALL_SCRIPT}"; then +echo "Temp script location: ${INSTALL_SCRIPT}" +echo "Temp script contents:" +cat "${INSTALL_SCRIPT}" +echo "---" +echo "Testing if user abc exists:" +id abc || echo "User abc does not exist!" +echo "Testing if bash exists:" +which bash || echo "bash not found!" +echo "Now running the install script..." +set -x +if su abc -c "bash ${INSTALL_SCRIPT}" 2>&1; then +set +x echo "cortex-cli installed successfully to ${GOPATH}/bin/cortex-cli" # Verify installation From e929ac576fcc0fbda6373221791a905a31a0da87 Mon Sep 17 00:00:00 2001 From: Tucker Reinhardt Date: Wed, 25 Feb 2026 21:34:17 +0000 Subject: [PATCH 10/10] run as abc user directly, not su --- src/vscode-docker/install-cortex-cli.sh | 36 ++++--------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/src/vscode-docker/install-cortex-cli.sh b/src/vscode-docker/install-cortex-cli.sh index e885e3cd..a64d5000 100644 --- a/src/vscode-docker/install-cortex-cli.sh +++ b/src/vscode-docker/install-cortex-cli.sh @@ -57,36 +57,13 @@ if [[ ! -d "cortex/tools/cortex-cli" ]]; then fi # Install cortex-cli as user abc (where SSH keys are configured) +# Use the same pattern as post-startup.sh: sudo -u USER bash -l -c echo "Installing cortex-cli as user abc (root doesn't have SSH keys)..." echo "GOPATH is set to: ${GOPATH}" +echo "Running go install with verbose output..." -# Create a temporary script to run as abc user -# This ensures we capture all output properly -INSTALL_SCRIPT="/tmp/install-cortex-cli-inner.sh" -cat > "${INSTALL_SCRIPT}" << 'EOF' -#!/bin/bash -set -x # Show commands being executed -export GOPATH=/config/go -export PATH=/usr/local/go/bin:${GOPATH}/bin:${PATH} -cd /config/repos/verily1 -exec go install ./cortex/tools/cortex-cli 2>&1 -EOF - -chmod +x "${INSTALL_SCRIPT}" - -echo "Running go install as user abc..." -echo "Temp script location: ${INSTALL_SCRIPT}" -echo "Temp script contents:" -cat "${INSTALL_SCRIPT}" -echo "---" -echo "Testing if user abc exists:" -id abc || echo "User abc does not exist!" -echo "Testing if bash exists:" -which bash || echo "bash not found!" -echo "Now running the install script..." -set -x -if su abc -c "bash ${INSTALL_SCRIPT}" 2>&1; then -set +x +# Use sudo instead of su - matches the RUN_AS_LOGIN_USER pattern from post-startup.sh +if sudo -u abc bash -l -c "cd ${VERILY1_PATH} && export GOPATH=${GOPATH} && export PATH=/usr/local/go/bin:${GOPATH}/bin:\$PATH && go install -v ./cortex/tools/cortex-cli"; then echo "cortex-cli installed successfully to ${GOPATH}/bin/cortex-cli" # Verify installation @@ -98,13 +75,10 @@ set +x echo "Checking if it installed elsewhere..." find /config -name "cortex-cli" 2>/dev/null || echo "cortex-cli not found in /config" fi - - rm -f "${INSTALL_SCRIPT}" else EXIT_CODE=$? echo "Error: Failed to install cortex-cli (exit code: ${EXIT_CODE})" - echo "Check the output above for errors from go install" - rm -f "${INSTALL_SCRIPT}" + echo "Error output should be visible above" exit 1 fi