diff --git a/README.md b/README.md index 526a1f8652..6b389b95fd 100644 --- a/README.md +++ b/README.md @@ -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). + +
Hosting infrastructure for this project is supported by:
++ + + +
diff --git a/bin/libs/zosmf.ts b/bin/libs/zosmf.ts index 89bddfa108..949c0eddf6 100644 --- a/bin/libs/zosmf.ts +++ b/bin/libs/zosmf.ts @@ -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 diff --git a/pswi/05_test.sh b/pswi/05_test.sh index 523458b3c3..079ba78efc 100644 --- a/pswi/05_test.sh +++ b/pswi/05_test.sh @@ -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 @@ -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 diff --git a/pswi/scripts/tmp_mounts.sh b/pswi/scripts/tmp_mounts.sh index c2e5f89370..23fa144cdb 100644 --- a/pswi/scripts/tmp_mounts.sh +++ b/pswi/scripts/tmp_mounts.sh @@ -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 @@ -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 diff --git a/pswi/scripts/wf_run_test.sh b/pswi/scripts/wf_run_test.sh new file mode 100755 index 0000000000..5987aeef41 --- /dev/null +++ b/pswi/scripts/wf_run_test.sh @@ -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}" $? diff --git a/workflows/files/ZWECONF.xml b/workflows/files/ZWECONF.xml index 8a44349963..f0961c356b 100644 --- a/workflows/files/ZWECONF.xml +++ b/workflows/files/ZWECONF.xml @@ -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"