Skip to content

Commit

Permalink
Merge branch 'v3.x/staging' into struga0258-patch-18
Browse files Browse the repository at this point in the history
  • Loading branch information
struga0258 authored Aug 29, 2024
2 parents 39b3e26 + 75c0629 commit 926b899
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 89 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,10 @@ Please check details in [playbooks folder](playbooks/README.md).
## Quick Sanity Check on Your Zowe Instance

Please check details in [sanity test folder](tests/sanity/README.md).

<p>Hosting infrastructure for this project is supported by:</p>
<p>
<a href="https://www.digitalocean.com/?refcode=77a4454d32a1&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge">
<img src="https://opensource.nyc3.cdn.digitaloceanspaces.com/attribution/assets/SVG/DO_Logo_horizontal_blue.svg" width="201px">
</a>
</p>
2 changes: 1 addition & 1 deletion bin/libs/zosmf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function validateZosmfHostAndPort(zosmfHost: string, zosmfPort: number):
common.printError(`Warning: Could not validate if z/OS MF is available on 'https://${zosmfHost}:${zosmfPort}/zosmf/info'. NODE_HOME is not defined.`);
zosmfCheckPassed=false;
} else {
let execReturn = shell.execOutSync(`${std.getenv('NODE_HOME')}/bin/node`, `${std.getenv('ZWE_zowe_runtimeDirectory')}/bin/utils/curl.js`, `"https://${zosmfHost}:${zosmfPort}/zosmf/info"`, `-k`, `-H`, `"X-CSRF-ZOSMF-HEADER: true"`, `--response-type`, `status`);
const execReturn = shell.execOutSync(`${std.getenv('NODE_HOME')}/bin/node`, `${std.getenv('ZWE_zowe_runtimeDirectory')}/bin/utils/curl.js`, `https://${zosmfHost}:${zosmfPort}/zosmf/info`, `-k`, `-H`, `X-CSRF-ZOSMF-HEADER: true`, `--response-type`, `status`);
if (execReturn.rc || !execReturn.out) {
common.printError(`Warning: Could not validate if z/OS MF is available on 'https://${zosmfHost}:${zosmfPort}/zosmf/info'. No response code from z/OSMF server.`);
zosmfCheckPassed=false
Expand Down
97 changes: 11 additions & 86 deletions pswi/05_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,91 +60,6 @@ sh scripts/submit_jcl.sh "`cat JCL`"
if [ $? -gt 0 ];then exit -1;fi
rm JCL


if [ "$ZOSMF_V" = "2.4" ]; then
echo "Not covering deployment on z/OSMF 2.4 yet."
#TODO: it's same as for 2.3 without work zfs - manage this in deploy_test_2_3.py and add api call to register PSWI
# z/OSMF 2.4

# Delete Portable Software Instance if it already exists
# No check of return code because if it does not exist the script would fail (return code 404)
#echo 'Invoking REST API to delete the portable software instance if the previous test did not delete it.'
#
#RESP=`curl -s ${BASE_URL}/zosmf/swmgmt/pswi/${ZOSMF_SYSTEM}/${PSWI} -k -X "DELETE" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS `
#
## The response is in format "statusurl":"https:\/\/:ZOSMF_URL:post\/restofurl"
#echo 'Invoking REST API to register a Portable Software Instance'
#
#RESP=`curl -s ${BASE_URL}/zosmf/swmgmt/pswi -k -X "POST" -d "$NEW_PSWI_JSON" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS `
#sh scripts/check_response.sh "${RESP}" $?
#if [ $? -gt 0 ];then exit -1;fi
#
#EXPORT_STATUS_URL=`echo $RESP | grep -o '"statusurl":".*"' | cut -f4 -d\" | tr -d '\' 2>/dev/null`
#if [ "$EXPORT_STATUS_URL" == "" ]
#then
# echo "No response from the REST API call."
# exit -1
#fi
#
#STATUS=""
#until [ "$STATUS" == "complete" ]
#do
#RESP=`curl -s $EXPORT_STATUS_URL -k -X "GET" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
#sh scripts/check_response.sh "${RESP}" $?
#if [ $? -gt 0 ];then exit -1;fi
#
#STATUS=`echo $RESP | grep -o '"status":".*"' | cut -f4 -d\"`
#echo "The status is: "$STATUS
#
#if [ "$STATUS" != "complete" ] && [ "$STATUS" != "running" ]
#then
# echo "Registration of PSWI in z/OSMF failed."
# exit -1
#fi
#sleep 3
#done
#
#google-chrome --version
#RC=$?
#
#if [ $RC -gt 0 ];
#then
#echo "Checking if the system is CentOS or RHEL."
#yum version
#RC=$?
#
#if [ $RC -gt 0 ];
#then
# echo "Installing Chrome on Debian/Ubuntu."
# wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# sudo apt-get install ./google-chrome-stable_current_*.rpm
#else
# echo "Installing Chrome on CentOS or RHEL."
# wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
# sudo yum install ./google-chrome-stable_current_*.rpm
#fi
#fi
#
#echo "Downloading Chromedriver"
#version=`google-chrome --product-version`
#url="https://chromedriver.storage.googleapis.com/"${version}"/chromedriver_linux64.zip"
#rm chromedriver.zip
#rm chromedriver
#wget $url -nc -O chromedriver.zip
#
## Run the deployment test
#echo " Running the deployment test for z/OSMF version 2.4"
#DIR=`pwd`
#PATH=$DIR/scripts/spool_files.sh:$PATH
#pip install selenium
#pip install requests
#
#export HEADLESS="true"
#python ../PSI_testing/deploy_test.py
#
#rm chromedriver

else
# z/OSMF 2.3

# Check if work zFS for PSWI is mounted
Expand All @@ -158,4 +73,14 @@ echo " Running the deployment test for z/OSMF version 2.3"
pip install requests
python scripts/deploy_test_2_3.py

fi
echo "Mounting ${TEST_HLQ}.ZFS"
sh scripts/tmp_mounts.sh "${TEST_HLQ}.ZFS" "${TEST_MOUNT}"
if [ $? -gt 0 ];then exit -1;fi

echo "Registering/testing the configuration workflow ${TEST_HLQ}.WORKFLOW(ZWECONF)"
sh scripts/wf_run_test.sh "${TEST_HLQ}.WORKFLOW(ZWECONF)"
if [ $? -gt 0 ];then exit -1;fi

echo "Registering/testing the configuration workflow ${TEST_MOUNT}/content/files/workflows/ZWECONF.xml"
sh scripts/wf_run_test.sh "${TEST_MOUNT}/files/workflows/ZWECONF.xml"
if [ $? -gt 0 ];then exit -1;fi
4 changes: 2 additions & 2 deletions pswi/scripts/tmp_mounts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fi
if [ "$MOUNTED" = false ]
then
# Check if data set exists
echo "Checking if temporary zFS ${TMP_ZFS} exists."
echo "Checking if temporary zFS ${ZFS} exists."
RESP=`curl -s "${BASE_URL}/zosmf/restfiles/ds?dslevel=${ZFS}" -k -X "GET" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
sh scripts/check_response.sh "${RESP}" $?
if [ $? -gt 0 ];then exit -1;fi
Expand All @@ -61,7 +61,7 @@ then
#TODO: also check the first dsname because it can be something that just has tmp_zfs as HLQ
echo
fi
# Mount zFS to TMP_MOUNT
# Mount zFS to MOUNT
echo "Mounting zFS ${ZFS} to ${MOUNT} mount point with JCL because REST API doesn't allow AGGRGROW parm."

echo ${JOBST1} > JCL
Expand Down
88 changes: 88 additions & 0 deletions pswi/scripts/wf_run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/sh
#version=1.0

export BASE_URL="${ZOSMF_URL}:${ZOSMF_PORT}"
WF_DEF_FILE=$1
run=$2

echo ""
echo ""
echo "Script for testing workflow and if specified running with defaults as well..."
echo "Host :" $ZOSMF_URL
echo "Port :" $ZOSMF_PORT
echo "z/OSMF system :" $ZOSMF_SYSTEM
echo "Workflow definition file :" $WF_DEF_FILE

WF_NAME="Testing workflows"
# URLs
CREATE_WF_URL="${BASE_URL}/zosmf/workflow/rest/1.0/workflows"
WF_LIST_URL="${BASE_URL}/zosmf/workflow/rest/1.0/workflows?owner=${ZOSMF_USER}&workflowName=${WF_NAME}"

# JSONs

ADD_WORKFLOW_JSON='{"workflowName":"'$WF_NAME'",
"workflowDefinitionFile":"'${WF_DEF_FILE}'",
"system":"'$ZOSMF_SYSTEM'",
"owner":"'$ZOSMF_USER'",
"assignToOwner" :true}'

# Get workflowKey for the workflow owned by user
echo "Get workflowKey for the workflow if it exists."

RESP=`curl -s $WF_LIST_URL -k -X "GET" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
WFKEY=`echo $RESP | grep -o '"workflowKey":".*"' | cut -f4 -d\"`

if [ -n "$WFKEY" ]
then
WORKFLOW_URL="${CREATE_WF_URL}/${WFKEY}"

echo "Deleting the workflow."
RESP=`curl -s $WORKFLOW_URL -k -X "DELETE" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
sh scripts/check_response.sh "${RESP}" $?
fi

set -ex
# Create workflow with REST API
echo 'Invoking REST API to create the workflow.'

RESP=`curl -s $CREATE_WF_URL -k -X "POST" -d "$ADD_WORKFLOW_JSON" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
sh scripts/check_response.sh "${RESP}" $?
if [ $? -gt 0 ];then exit -1;fi
WFKEY=`echo $RESP | grep -o '"workflowKey":".*"' | cut -f4 -d\"`
WORKFLOW_URL="${CREATE_WF_URL}/${WFKEY}"

if [ -n "${run}" ]
then
# Run workflow
echo "Invoking REST API to start the workflow."

RESP=`curl -s ${WORKFLOW_URL}/operations/start -k -X "PUT" -d "{}" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
sh scripts/check_response.sh "${RESP}" $?
if [ $? -gt 0 ];then exit -1;fi
STATUS=""
until [ "$STATUS" = "FINISHED" ]
do
sleep 20


# Get the result of the workflow
RESP=`curl -s ${WORKFLOW_URL} -k -X "GET" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
if [ $? -gt 0 ];then exit -1;fi
STATUS_NAME=`echo $RESP | grep -o '"statusName":".*"' | cut -f4 -d\"`

if [ "$STATUS_NAME" = "in-progress" ]
then
echo "Workflow ended with an error."
echo $RESP
exit -1
elif [ "$STATUS_NAME" = "complete" ]
then
echo "Workflow finished successfully."
STATUS="FINISHED"
fi
done
fi

echo "Deleting the workflow."
RESP=`curl -s $WORKFLOW_URL -k -X "DELETE" -H "Content-Type: application/json" -H "X-CSRF-ZOSMF-HEADER: A" --user $ZOSMF_USER:$ZOSMF_PASS`
sh scripts/check_response.sh "${RESP}" $?
4 changes: 4 additions & 0 deletions workflows/files/ZWECONF.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,11 @@ echo ' # VSAM configurations if you are using VSAM as Caching Service storage
echo ' vsam:' >> "${instance-zowe_runtimeDirectory}/zowe.yaml"
echo ' # VSAM data set with Record-Level-Sharing enabled or not' >> "${instance-zowe_runtimeDirectory}/zowe.yaml"
echo ' # Valid values could be: NONRLS or RLS.' >> "${instance-zowe_runtimeDirectory}/zowe.yaml"
#if (${instance-zowe_setup_vsam_mode})
echo ' mode: $!{instance-zowe_setup_vsam_mode}' >> "${instance-zowe_runtimeDirectory}/zowe.yaml"
#else
echo ' mode: NONRLS' >> "${instance-zowe_runtimeDirectory}/zowe.yaml"
#end
echo ' # Volume name if you are using VSAM in NONRLS mode' >> "${instance-zowe_runtimeDirectory}/zowe.yaml"
echo ' volume: "$!{instance-zowe_setup_vsam_volume}"' >> "${instance-zowe_runtimeDirectory}/zowe.yaml"
echo ' # Storage class name if you are using VSAM in RLS mode' >> "${instance-zowe_runtimeDirectory}/zowe.yaml"
Expand Down

0 comments on commit 926b899

Please sign in to comment.