File tree Expand file tree Collapse file tree
actions/install-bot-engine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,12 +113,13 @@ runs:
113113 if [ -s "$JFROG_NPMRC_FILE" ]; then
114114 NPM_ARGS=(--userconfig "$JFROG_NPMRC_FILE")
115115 fi
116+ source "${{ github.action_path }}/redact-command-output.sh"
116117 # pip reads PIP_INDEX_URL from the env setup-jfrog exported. REF mode
117118 # resolves the published engine's deps unpinned + installs the SDK/CLI by
118119 # version (a consumer can't see the engine's hash-locked requirements).
119120 # SDK_VERSION/CLI_VERSION track the engine at ENGINE_REF.
120- python -m pip install --upgrade pip
121- pip install "databricks-bot-engine @ git+https://github.com/${ENGINE_REPO}@${ENGINE_REF}"
122- pip install "claude-agent-sdk==${SDK_VERSION}"
123- npm install "${NPM_ARGS[@]}" -g "@anthropic-ai/claude-code@${CLI_VERSION}"
121+ run_with_redacted_url_queries python -m pip install --upgrade pip
122+ run_with_redacted_url_queries pip install "databricks-bot-engine @ git+https://github.com/${ENGINE_REPO}@${ENGINE_REF}"
123+ run_with_redacted_url_queries pip install "claude-agent-sdk==${SDK_VERSION}"
124+ run_with_redacted_url_queries npm install "${NPM_ARGS[@]}" -g "@anthropic-ai/claude-code@${CLI_VERSION}"
124125 echo "$(npm prefix -g)/bin" >> "$GITHUB_PATH"
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ run_with_redacted_url_queries () {
4+ local previous_shell_options=" $- "
5+ local command_status
6+
7+ set +e
8+ " $@ " 2>&1 \
9+ | sed -E ' s#([Hh][Tt][Tt][Pp][Ss]?://[^?[:space:]]+)\?[^[:space:]]+#\1?[REDACTED]#g'
10+ command_status=${PIPESTATUS[0]}
11+ if [[ " $previous_shell_options " == * e* ]]; then
12+ set -e
13+ fi
14+
15+ return " $command_status "
16+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " && pwd)
6+ source " $SCRIPT_DIR /redact-command-output.sh"
7+
8+ test_redacts_url_query_and_preserves_host_and_path () {
9+ local output
10+
11+ output=$( run_with_redacted_url_queries bash -c \
12+ ' printf "%s\n" "Downloading https://packages.example.test/artifacts/pkg.whl?X-Amz-Algorithm=DUMMY&X-Amz-Credential=DUMMY"' )
13+
14+ [[ " $output " == ' Downloading https://packages.example.test/artifacts/pkg.whl?[REDACTED]' ]]
15+ }
16+
17+ test_preserves_command_exit_code () {
18+ local output
19+ local status
20+
21+ set +e
22+ output=$( run_with_redacted_url_queries bash -c \
23+ ' printf "%s\n" "Failed https://packages.example.test/pkg.tgz?X-Amz-Signature=DUMMY" >&2; exit 37' )
24+ status=$?
25+ set -e
26+
27+ [[ " $status " -eq 37 ]]
28+ [[ " $output " == ' Failed https://packages.example.test/pkg.tgz?[REDACTED]' ]]
29+ }
30+
31+ test_redacts_url_query_and_preserves_host_and_path
32+ test_preserves_command_exit_code
Original file line number Diff line number Diff line change 6363 steps :
6464 - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6565
66+ - name : Test install-log URL redaction
67+ run : bash .github/actions/install-bot-engine/redact-command-output_test.sh
68+
6669 - uses : actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
6770 with :
6871 toolchain : stable
You can’t perform that action at this time.
0 commit comments