Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,8 @@ tests:
cluster_profile: openshift-org-gcp
env:
COMPUTE_NODE_TYPE: n2-standard-8
RESOURCE_EVENT_COLLECTION_ENABLED: "true"
RESOURCE_WATCH_ENABLED: "true"
RT_ENABLED: "true"
observers:
enable:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,9 @@ tests:
cluster_profile: openshift-org-gcp
env:
COMPUTE_NODE_TYPE: n2-standard-8
RESOURCE_EVENT_COLLECTION_ENABLED: "true"
RESOURCE_MONITOR_ENABLED: "true"
RESOURCE_WATCH_ENABLED: "true"
RT_ENABLED: "true"
observers:
enable:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ then
echo "using additional run-monitor args ${MONITOR_ARGS}"
fi

openshift-tests run-resourcewatch > "${ARTIFACT_DIR}/run-resourcewatch.log" 2>&1 &
DISABLED_MONITOR_TESTS="apiserver-new-disruption-invariant,disruption-summary-serializer,incluster-disruption-serializer,pod-network-avalibility"
openshift-tests run-monitor ${MONITOR_ARGS:-} --artifact-dir $STORE_PATH --disable-monitor=${DISABLED_MONITOR_TESTS} > "${ARTIFACT_DIR}/run-monitor.log" 2>&1 &
EVENTS_FLAG=""
if [[ "${RESOURCE_EVENT_COLLECTION_ENABLED:-false}" == "true" ]]; then
EVENTS_FLAG="--enable-events"
fi
openshift-tests run-resourcewatch ${EVENTS_FLAG} > "${ARTIFACT_DIR}/run-resourcewatch.log" 2>&1 &

if [[ "${RESOURCE_MONITOR_ENABLED:-false}" == "true" ]]; then
DISABLED_MONITOR_TESTS="apiserver-new-disruption-invariant,disruption-summary-serializer,incluster-disruption-serializer,pod-network-avalibility"
openshift-tests run-monitor ${MONITOR_ARGS:-} --artifact-dir $STORE_PATH --disable-monitor=${DISABLED_MONITOR_TESTS} > "${ARTIFACT_DIR}/run-monitor.log" 2>&1 &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e
file="$(fd -i -t f 'observers-resource-watch-commands\.sh$' . | head -n 1)"
printf '%s\n' "FILE=$file"
wc -l "$file"
cat -n "$file"
printf '\n--- lifecycle references ---\n'
rg -n 'run-monitor|STORE_PATH|wait|kill|ARTIFACT_DIR|DISABLED_MONITOR_TESTS|MONITOR_ARGS' "$file"

Repository: openshift/release

Length of output: 5081


🏁 Script executed:

#!/bin/bash
set -euo pipefail

probe() {
  local label="$1"
  local store_path="$2"
  STORE_PATH="$store_path"
  MONITOR_ARGS=""
  DISABLED_MONITOR_TESTS="disabled"
  openshift-tests() {
    printf '%s argc=%s\n' "$label" "$#"
    printf '  <%s>\n' "$@" 
  }
  export -f openshift-tests
  bash -c '
    openshift-tests run-monitor ${MONITOR_ARGS:-} --artifact-dir $STORE_PATH --disable-monitor=${DISABLED_MONITOR_TESTS} > /dev/null
  ' 2>/dev/null || true
}

probe "whitespace-unquoted" "/tmp/path with spaces"
probe "glob-unquoted" "/tmp/*"

printf '\nquoted controls\n'
probe_quoted() {
  local label="$1"
  local store_path="$2"
  STORE_PATH="$store_path"
  MONITOR_ARGS=""
  DISABLED_MONITOR_TESTS="disabled"
  openshift-tests() {
    printf '%s argc=%s\n' "$label" "$#"
    printf '  <%s>\n' "$@"
  }
  openshift-tests run-monitor ${MONITOR_ARGS:-} --artifact-dir "$STORE_PATH" --disable-monitor="${DISABLED_MONITOR_TESTS}" > /dev/null
}
probe_quoted "whitespace-quoted" "/tmp/path with spaces"
probe_quoted "glob-quoted" "/tmp/*"

printf '\nSTORE_PATH occurrences\n'
rg -n '\$STORE_PATH|STORE_PATH' ci-operator/step-registry/observers/resource-watch/observers-resource-watch-commands.sh

Repository: openshift/release

Length of output: 825


🏁 Script executed:

#!/bin/bash
set -euo pipefail

openshift-tests() {
  printf '%s argc=%s\n' "$1" "$#" >&2
  shift
  printf '  <%s>\n' "$@" >&2
}

run_unquoted() {
  local label="$1"
  STORE_PATH="$2"
  MONITOR_ARGS=""
  DISABLED_MONITOR_TESTS="disabled"
  printf '%s STORE_PATH=%q\n' "$label" "$STORE_PATH"
  openshift-tests run-monitor ${MONITOR_ARGS:-} --artifact-dir $STORE_PATH --disable-monitor=${DISABLED_MONITOR_TESTS} > /dev/null
}

run_quoted() {
  local label="$1"
  STORE_PATH="$2"
  MONITOR_ARGS=""
  DISABLED_MONITOR_TESTS="disabled"
  printf '%s STORE_PATH=%q\n' "$label" "$STORE_PATH"
  openshift-tests run-monitor ${MONITOR_ARGS:-} --artifact-dir "$STORE_PATH" --disable-monitor="${DISABLED_MONITOR_TESTS}" > /dev/null
}

run_unquoted "whitespace-unquoted" "/tmp/path with spaces"
run_unquoted "glob-unquoted" "/tmp/*"
run_quoted "whitespace-quoted" "/tmp/path with spaces"
run_quoted "glob-quoted" "/tmp/*"

printf '\nSTORE_PATH occurrences:\n'
rg -n '\$STORE_PATH|STORE_PATH' ci-operator/step-registry/observers/resource-watch/observers-resource-watch-commands.sh

Repository: openshift/release

Length of output: 1904


Quote STORE_PATH in all command uses.

If STORE_PATH contains whitespace or glob characters, shell expansion changes the arguments. Quote it in run-monitor and in the cleanup commands at lines 31–32.

🧰 Tools
🪛 Shellcheck (0.11.0)

[info] 84-84: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 84-84: Double quote to prevent globbing and word splitting.

(SC2086)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/observers/resource-watch/observers-resource-watch-commands.sh`
at line 84, Quote STORE_PATH in the run-monitor invocation and the cleanup
commands so its value is passed as a single literal argument, preserving
whitespace and preventing glob expansion; update each command use consistently.

Source: Linters/SAST tools

fi
wait
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ observer:
documentation: |-
Set to "true" to enable the resource watch observer. When "false", the observer
exits immediately without collecting any data.
- name: RESOURCE_MONITOR_ENABLED
default: "false"
documentation: |-
Set to "true" to enable the openshift-tests run-monitor process within the
resource watch observer. When "false", only run-resourcewatch is started.
- name: RESOURCE_EVENT_COLLECTION_ENABLED
default: "false"
documentation: |-
Set to "true" to enable event collection (events.k8s.io/v1) in
run-resourcewatch by passing the --enable-events flag.
timeout: 24h
grace_period: 1h
documentation: |-
Expand Down