Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zwe support in typescript #4147

Merged
merged 28 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
eb2c970
Initial commit
Martin-Zeithaml Jan 22, 2025
415716e
Missing cli
Martin-Zeithaml Jan 22, 2025
382c7e7
Missing import
Martin-Zeithaml Jan 22, 2025
bfc859d
Typo in import
Martin-Zeithaml Jan 22, 2025
d16bb77
Help update and types
Martin-Zeithaml Jan 22, 2025
489c59e
Wrong error code
Martin-Zeithaml Jan 22, 2025
d307a04
Do not exit if called from support
Martin-Zeithaml Jan 22, 2025
34fcb11
Zss PC check
Martin-Zeithaml Jan 23, 2025
ae94ffb
Remove item
Martin-Zeithaml Jan 23, 2025
bffe497
Grep update
Martin-Zeithaml Jan 23, 2025
2d52634
Node fix
Martin-Zeithaml Jan 23, 2025
2ba5f40
zOSMF check
Martin-Zeithaml Jan 23, 2025
dfeefba
zOSMF check in help
Martin-Zeithaml Jan 24, 2025
0e0132b
Changelog update
Martin-Zeithaml Jan 24, 2025
c5483aa
PARMLIB example
Martin-Zeithaml Jan 27, 2025
7cf9769
Merge branch 'v3.x/staging' into v3.x/feature/supportTS
MarkAckert Jan 27, 2025
a7146cf
Node check
Martin-Zeithaml Jan 27, 2025
6389321
Typo and indentation
Martin-Zeithaml Jan 29, 2025
0b7168a
Check java version to match defined MIN
Martin-Zeithaml Jan 29, 2025
3cd0d31
Move independent java function to separate module
Martin-Zeithaml Jan 30, 2025
9c639cd
Merge branch 'v3.x/staging' into v3.x/feature/supportTS
Martin-Zeithaml Jan 30, 2025
069aef8
Missing update
Martin-Zeithaml Jan 30, 2025
b1992fc
Verify java version
Martin-Zeithaml Jan 31, 2025
9044036
Merge branch 'v3.x/staging' into v3.x/feature/supportTS
MarkAckert Feb 4, 2025
faedf57
update fingerprints to use JAVA_HOME from playbooks
MarkAckert Feb 5, 2025
eacc10d
empty output means no issues found via comm, print it
MarkAckert Feb 5, 2025
4da1b2e
add note to changelog
MarkAckert Feb 5, 2025
7d2141c
Member name ZWEYAML in example
Martin-Zeithaml Feb 6, 2025
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
All notable changes to the Zowe Installer will be documented in this file.

## `3.2.0`
- Enhancement: `zwe support` command collecting more environment details [#4147](https://github.com/zowe/zowe-install-packaging/pull/4147)
- Enhancement: Added new library function formatZosVersion() [#4134](https://github.com/zowe/zowe-install-packaging/pull/4134)
- `zwe support verify-fingerprints` no longer requires a `zowe.yaml` to be passed as a command-line parameter.

## `3.1.0`
- Bugfix: When logging `zwe` command, sometimes the log has wrong file tag and the log is unreadable. [#4071](https://github.com/zowe/zowe-install-packaging/pull/4071)
Expand Down
3 changes: 2 additions & 1 deletion bin/commands/internal/start/prepare/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import * as config from '../../../../libs/config';
import * as component from '../../../../libs/component';
import * as varlib from '../../../../libs/var';
import * as java from '../../../../libs/java';
import * as javaCI from '../../../../libs/java_ci';
import * as node from '../../../../libs/node';
import * as zosmf from '../../../../libs/zosmf';

Expand Down Expand Up @@ -148,7 +149,7 @@ function globalValidate(enabledComponents:string[]): void {
// validate java for some core components
//TODO this should be a manifest parameter that you require java, not a hardcoded list. What if extensions require it?
if (enabledComponents.includes('gateway') || enabledComponents.includes('zaas') || enabledComponents.includes('discovery') || enabledComponents.includes('api-catalog') || enabledComponents.includes('caching-service')) {
let javaOk = java.validateJavaHome();
let javaOk = javaCI.validateJavaHome();
if (!javaOk) {
privateErrors++;
common.printFormattedError('ZWELS', "zwe-internal-start-prepare,global_validate", `Could not validate java home`);
Expand Down
2 changes: 2 additions & 0 deletions bin/commands/support/.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ZWEL0150E|150|Failed to find file %s. Zowe runtimeDirectory is invalid.
ZWEL0151E|151|Failed to create temporary file %s. Please check permission or volume free space.
5 changes: 5 additions & 0 deletions bin/commands/support/.examples
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
zwe support -c /path/to/zowe.yaml

zwe support -c /path/to/zowe.yaml --target-dir /path/to/save/support/results

zwe support --config 'FILE(/path/to/zowe.yaml):PARMLIB(ZOWE.PARMLIB(ZWEYAML))'
5 changes: 4 additions & 1 deletion bin/commands/support/.help
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ This command will collect these information:
- Environment
* z/OS version
* Java version
* Java keytool TLS information
* Node.js version
* zOSMF status
* External Security Manager
* CEE Runtime Options
* Filesystem flags
* ZSS Program Controlled extended attribute
- Zowe configurations
* Zowe manifest.json
* Zowe configuration file
Expand All @@ -17,5 +21,4 @@ This command will collect these information:
* Zowe APIML static registration files under "`zowe.workspaceDirectory`/api-mediation/api-defs"
- Zowe runtime
* Active running Zowe processes
* Zowe job log
- Zowe fingerprints and validation result
14 changes: 14 additions & 0 deletions bin/commands/support/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
This program and the accompanying materials are made available
under the terms of the Eclipse Public License v2.0 which
accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html

SPDX-License-Identifier: EPL-2.0

Copyright Contributors to the Zowe Project.
*/

import * as index from './index';

index.execute();
134 changes: 1 addition & 133 deletions bin/commands/support/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,136 +11,4 @@
# Copyright Contributors to the Zowe Project.
#######################################################################

print_message_file() {
msg="${1}"
out_file="${2}"
print_message "- ${msg}"
echo "${msg}" >> "${out_file}"
}

print_level0_message "Collect information for Zowe support"

###############################
# constants
DATE=`date +%Y-%m-%d-%H-%M-%S`
target_dir="${ZWE_CLI_PARAMETER_TARGET_DIR}"
if [ -z "${target_dir}" ]; then
target_dir=$(get_tmp_dir)
else
curr_pwd=$(pwd)
cd "${target_dir}"
target_dir=$(pwd)
cd "${curr_pwd}"
fi
tmp_file_prefix=zwe-support
tmp_pax="${target_dir}/${tmp_file_prefix}.${DATE}.pax"
tmp_dir=$(create_tmp_file "${tmp_file_prefix}" "${target_dir}")

###############################
# validate
require_java
require_node
require_zowe_yaml

###############################
print_message "Started at ${DATE}"
mkdir "${tmp_dir}"
chmod 700 "${tmp_dir}"
print_debug "Temporary directory created: ${tmp_dir}"
print_message

###############################
print_level1_message "Collecting various environment information"
ENVIRONMENT_FILE="${tmp_dir}/environment_output"
echo "[Environment information]" > "${ENVIRONMENT_FILE}"
ZOS_VERSION=`operator_command "D IPLINFO" | grep -i release | xargs`
if [ -z "${ZOS_VERSION}" ]; then
ZOS_VERSION=`sysvar SYSOSLVL`
fi
JAVA_VERSION=`${JAVA_HOME}/bin/java -version 2>&1 | head -n 1`
NODE_VERSION=`${NODE_HOME}/bin/node --version`
ESM=`"${ZWE_zowe_runtimeDirectory}/bin/utils/getesm"`
CEE_OPTIONS=`tsocmd "OMVS RUNOPTS('RPTOPTS(ON)')" 2>&1`

print_message_file "z/OS version: ${ZOS_VERSION}" "${ENVIRONMENT_FILE}"
print_message_file "Java version: ${JAVA_VERSION}" "${ENVIRONMENT_FILE}"
print_message_file "NodeJS version: ${NODE_VERSION}" "${ENVIRONMENT_FILE}"
print_message_file "External Security Manager: ${ESM}" "${ENVIRONMENT_FILE}"
print_message_file "CEE Runtime Options: ${CEE_OPTIONS}" "${ENVIRONMENT_FILE}"
print_message

###############################
print_level1_message "Collecting Zowe configurations"
print_message "- manifest.json"
cp "${ZWE_zowe_runtimeDirectory}/manifest.json" "${tmp_dir}"
print_message "- zowe.yaml"
cp "${ZWE_CLI_PARAMETER_CONFIG}" "${tmp_dir}"
ZWE_zowe_workspaceDirectory=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.workspaceDirectory")
if [ -d "${ZWE_zowe_workspaceDirectory}/.env" ]; then
print_message "- <workspace>/.env"
mkdir -p "${tmp_dir}/workspace"
cp -r "${ZWE_zowe_workspaceDirectory}/.env" "${tmp_dir}/workspace"
fi
if [ -d "${ZWE_zowe_workspaceDirectory}/api-mediation/api-defs" ]; then
print_message "- <workspace>/api-mediation/api-defs"
mkdir -p "${tmp_dir}/workspace"
cp -r "${ZWE_zowe_workspaceDirectory}/api-mediation/api-defs" "${tmp_dir}/workspace"
fi
ZWE_zowe_setup_certificate_pkcs12_directory=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.certificate.pkcs12.directory")
if [ -d "${ZWE_zowe_setup_certificate_pkcs12_directory}" ]; then
print_message "- ${ZWE_zowe_setup_certificate_pkcs12_directory}"
mkdir -p "${tmp_dir}/keystore"
cp -r "${ZWE_zowe_setup_certificate_pkcs12_directory}" "${tmp_dir}/keystore"
fi
print_message

###############################
print_level1_message "Collecting Zowe file fingerprints"
print_message "- copy original fingerprints"
cp -r "${ZWE_zowe_runtimeDirectory}/fingerprint" "${tmp_dir}"
print_message "- verify fingerprints"
result=$(export ZWE_PRIVATE_LOG_FILE="${tmp_dir}/verify-fingerprints.log" && export ZWE_PRIVATE_LOG_LEVEL_ZWELS=TRACE && touch "${ZWE_PRIVATE_LOG_FILE}" && . "${ZWE_zowe_runtimeDirectory}/bin/commands/support/verify-fingerprints/index.sh" 2>/dev/null 1>/dev/null)
print_message

###############################
job_name=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.job.name")
job_prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.job.prefix")
print_level1_message "Collecting current process information based on the job prefix ${job_prefix} and job name ${job_name}"
PS_OUTPUT_FILE=${tmp_dir}"/ps_output"

# Collect process information
print_message "- Adding ${PS_OUTPUT_FILE}"
ps -A -o pid,ppid,time,etime,user,jobname,args | grep -e "^[[:space:]]*PID" -e "${job_prefix}" -e "${job_name}" > $PS_OUTPUT_FILE
print_message

###############################
# TODO: job log
# To avoid of using SDSF, we used to use TSO output command to export job log
# but it always fails with below error for me:
# IKJ56328I JOB ZWE1SV REJECTED - JOBNAME MUST BE YOUR USERID OR MUST START WITH YOUR USERID
# REF: https://www.ibm.com/docs/en/zos/2.3.0?topic=subcommands-output-command
# REF: https://www.ibm.com/docs/en/zos/2.3.0?topic=ikj-ikj56328i

###############################
# Collect instance logs
log_dir=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.logDirectory")
print_level1_message "Collecting logs from ${log_dir}"
if [ -d "${log_dir}" ]; then
cp -r "${log_dir}" "${tmp_dir}"
fi
print_message

###############################
print_level1_message "Create support package and clean up"
curr_pwd=$(pwd)
cd "${tmp_dir}"
pax -w -v -o saveext -f "${tmp_pax}" .
compress "${tmp_pax}"
chmod 700 "${tmp_pax}"*
cd "${curr_pwd}"
rm -fr "${tmp_dir}"
print_message

###############################
# exit message
print_level1_message "Zowe support package is generated as ${tmp_pax}.Z"
_CEE_RUNOPTS="XPLINK(ON)" ${ZWE_zowe_runtimeDirectory}/bin/utils/configmgr -script "${ZWE_zowe_runtimeDirectory}/bin/commands/support/cli.js"
Loading
Loading