Skip to content

Commit b8deb19

Browse files
author
Craig Perkins
committed
CI guard: run demo config natively under cmd, tolerate already-configured
The first version of the guard reused the cluster start-opensearch had already configured, so the installer hit 'already configured for Security. Quit.' and exited -1 (its exit code equals skip_updates, which -i/-c leave at -1). Pass -s so an already-configured opensearch.yml exits 0, while a home-discovery failure still exits non-zero from setBaseDir - which is the condition this guard is meant to catch. Signed-off-by: Craig Perkins <cwperks@amazon.com>
1 parent 1b2ebdb commit b8deb19

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

‎.github/workflows/plugin_install.yml‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,30 +67,28 @@ jobs:
6767
admin-password: ${{ steps.generate-password.outputs.password }}
6868
jdk-version: 21
6969

70-
- name: Verify demo configuration script locates OpenSearch home on Windows
70+
- name: Verify demo config script locates OpenSearch home on Windows
7171
# Regression guard for #6023: the tools/*.bat parent-directory walk used
7272
# %~dpI on a path ending in "\." which does not ascend, so the script
73-
# exited non-zero and OpenSearch failed to start on Windows with no error
74-
# output. This runs the script natively under cmd.exe (the real startup
75-
# environment, unlike the bash-invoked path in start-opensearch) and
76-
# asserts a zero exit code and that OPENSEARCH_HOME resolved to a dir
77-
# containing lib/opensearch-*.jar.
73+
# exited non-zero and OpenSearch failed to start on Windows with no
74+
# error output. Run the script natively under cmd.exe (unlike the
75+
# bash-invoked path in start-opensearch), with OPENSEARCH_HOME unset so
76+
# the home-discovery loop is exercised. The -s flag makes an
77+
# already-configured opensearch.yml a benign exit 0 (start-opensearch
78+
# already ran the installer), while a home-discovery failure still
79+
# exits non-zero from setBaseDir - which is exactly what we guard.
7880
if: ${{ runner.os == 'Windows' }}
7981
shell: cmd
8082
run: |
8183
set "OS_DIR=opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT9200"
82-
if not exist "%OS_DIR%\plugins\opensearch-security\tools\install_demo_configuration.bat" (
83-
echo Demo script not found under %OS_DIR% 1>&2
84-
exit /b 1
85-
)
86-
rem Run with OPENSEARCH_HOME unset so the home-discovery loop is exercised.
8784
set "OPENSEARCH_HOME="
88-
call "%OS_DIR%\plugins\opensearch-security\tools\install_demo_configuration.bat" -y -i -c
89-
if errorlevel 1 (
90-
echo install_demo_configuration.bat exited with a non-zero code 1>&2
85+
call "%OS_DIR%\plugins\opensearch-security\tools\install_demo_configuration.bat" -y -i -c -s
86+
set "RC=%errorlevel%"
87+
if not "%RC%" == "0" (
88+
echo install_demo_configuration.bat exited with code %RC% - home discovery failed 1>&2
9189
exit /b 1
9290
)
93-
echo Demo configuration script completed with exit code 0
91+
echo Home discovery succeeded on Windows (exit 0)
9492
9593
- name: Run sanity tests
9694
run: ./gradlew integTestRemote -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="opensearch" -Dhttps=true -Duser=admin "-Dpassword=${SECURITY_PASSWORD}" -i

0 commit comments

Comments
 (0)