Skip to content

Commit

Permalink
set NODE_ENV=production for bin/* (#139649)
Browse files Browse the repository at this point in the history
* Set NODE_ENV=production for bin/*

* add tests

* Revert "Set NODE_ENV=production for bin/*"

This reverts commit 8012ed6.

* Revert "Revert "Set NODE_ENV=production for bin/*""

This reverts commit 2fd499c.
  • Loading branch information
jbudz authored Aug 30, 2022
1 parent 53b5593 commit 04d1ffe
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana-encryption-keys
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ if [ -f "${CONFIG_DIR}/node.options" ]; then
KBN_NODE_OPTS="$(grep -v ^# < ${CONFIG_DIR}/node.options | xargs)"
fi
NODE_OPTIONS="$KBN_NODE_OPTS $NODE_OPTIONS" "${NODE}" "${DIR}/src/cli_encryption_keys/dist" "$@"
NODE_OPTIONS="$KBN_NODE_OPTS $NODE_OPTIONS" NODE_ENV=production "${NODE}" "${DIR}/src/cli_encryption_keys/dist" "$@"
1 change: 1 addition & 0 deletions src/dev/build/tasks/bin/scripts/kibana-encryption-keys.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI

set NODE=%DIR%\node\node.exe
set NODE_ENV=production

If Not Exist "%NODE%" (
Echo unable to find usable node.js executable.
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana-keystore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ if [ -f "${CONFIG_DIR}/node.options" ]; then
KBN_NODE_OPTS="$(grep -v ^# < ${CONFIG_DIR}/node.options | xargs)"
fi
NODE_OPTIONS="$KBN_NODE_OPTS $NODE_OPTIONS" "${NODE}" "${DIR}/src/cli_keystore/dist" "$@"
NODE_OPTIONS="$KBN_NODE_OPTS $NODE_OPTIONS" NODE_ENV=production "${NODE}" "${DIR}/src/cli_keystore/dist" "$@"
1 change: 1 addition & 0 deletions src/dev/build/tasks/bin/scripts/kibana-keystore.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI

set NODE=%DIR%\node\node.exe
set NODE_ENV=production

If Not Exist "%NODE%" (
Echo unable to find usable node.js executable.
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana-setup
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ if [ -f "${CONFIG_DIR}/node.options" ]; then
KBN_NODE_OPTS="$(grep -v ^# < ${CONFIG_DIR}/node.options | xargs)"
fi
NODE_OPTIONS="$KBN_NODE_OPTS $NODE_OPTIONS" "${NODE}" "${DIR}/src/cli_setup/dist" "$@"
NODE_OPTIONS="$KBN_NODE_OPTS $NODE_OPTIONS" NODE_ENV=production "${NODE}" "${DIR}/src/cli_setup/dist" "$@"
1 change: 1 addition & 0 deletions src/dev/build/tasks/bin/scripts/kibana-setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI

set NODE=%DIR%\node\node.exe
set NODE_ENV=production

If Not Exist "%NODE%" (
Echo unable to find usable node.js executable.
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana-verification-code
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ if [ -f "${CONFIG_DIR}/node.options" ]; then
KBN_NODE_OPTS="$(grep -v ^# < ${CONFIG_DIR}/node.options | xargs)"
fi
NODE_OPTIONS="$KBN_NODE_OPTS $NODE_OPTIONS" "${NODE}" "${DIR}/src/cli_verification_code/dist" "$@"
NODE_OPTIONS="$KBN_NODE_OPTS $NODE_OPTIONS" NODE_ENV=production "${NODE}" "${DIR}/src/cli_verification_code/dist" "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI

set NODE=%DIR%\node\node.exe
set NODE_ENV=production

If Not Exist "%NODE%" (
Echo unable to find usable node.js executable.
Expand Down
1 change: 0 additions & 1 deletion src/dev/build/tasks/bin/scripts/kibana.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI

set NODE=%DIR%\node\node.exe

set NODE_ENV=production

If Not Exist "%NODE%" (
Expand Down
4 changes: 4 additions & 0 deletions test/package/deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
- install_kibana_deb
- assert_keystore_available
- assert_keystore_cli
- assert_encryption_keys_cli
- assert_plugin_cli
- assert_setup_cli
- assert_verification_code_cli
- assert_kibana_yml
- assert_kibana_listening
- assert_kibana_available
Expand Down
13 changes: 13 additions & 0 deletions test/package/roles/assert_encryption_keys_cli/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: "help generate"
become: true
command:
cmd: /usr/share/kibana/bin/kibana-encryption-keys help generate
register: kibana_encryption_keys_help_generate

- debug:
msg: "{{ kibana_encryption_keys_help_generate }}"

- name: assert kibana-encryption-keys provides help
assert:
that:
- kibana_encryption_keys_help_generate.failed == false
10 changes: 5 additions & 5 deletions test/package/roles/assert_keystore_cli/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
- name: "add server.name: package-testing"
become: yes
command:
become: true
command:
cmd: /usr/share/kibana/bin/kibana-keystore add server.name --stdin
stdin: package-testing
register: kibana_keystore_add

- debug:
msg: "{{ kibana_keystore_add.stdout }}"
msg: "{{ kibana_keystore_add }}"

- name: register kibana-keystore list
become: yes
become: true
command: /usr/share/kibana/bin/kibana-keystore list
register: kibana_keystore_list

- debug:
msg: "{{ kibana_keystore_list.stdout }}"
msg: "{{ kibana_keystore_list }}"

- name: assert kibana-keystore list contains server.name
assert:
Expand Down
14 changes: 14 additions & 0 deletions test/package/roles/assert_plugin_cli/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- name: "list"
become: true
command:
cmd: /usr/share/kibana/bin/kibana-plugin list
register: kibana_plugin_list

- debug:
msg: "{{ kibana_plugin_list }}"

- name: assert kibana-plugin lists installed plugins
assert:
that:
- kibana_plugin_list.failed == false
- kibana_plugin_list.stdout == "No plugins installed."
13 changes: 13 additions & 0 deletions test/package/roles/assert_setup_cli/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: "--help"
become: true
command:
cmd: /usr/share/kibana/bin/kibana-setup --help
register: kibana_setup_help

- debug:
msg: "{{ kibana_setup_help }}"

- name: assert kibana-setup provides help text
assert:
that:
- kibana_setup_help.failed == false
13 changes: 13 additions & 0 deletions test/package/roles/assert_verification_code_cli/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: "--help"
become: true
command:
cmd: /usr/share/kibana/bin/kibana-verification-code --help
register: kibana_verification_code_help

- debug:
msg: "{{ kibana_verification_code_help }}"

- name: assert kibana-verification-code provides help
assert:
that:
- kibana_verification_code_help.failed == false
4 changes: 4 additions & 0 deletions test/package/rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
- install_kibana_rpm
- assert_keystore_available
- assert_keystore_cli
- assert_encryption_keys_cli
- assert_plugin_cli
- assert_setup_cli
- assert_verification_code_cli
- assert_kibana_yml
- assert_kibana_listening
- assert_kibana_available
Expand Down

0 comments on commit 04d1ffe

Please sign in to comment.