diff --git a/.gitignore b/.gitignore index 124dd4b..fb0c4ad 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,14 @@ node_modules/ output dist .history/ + +#pax ignore +.pax/* +!.pax/.keep +!.pax/pre-packaging.sh +!.pax/post-packaging.sh +!.pax/prepare-workspace.sh +!.pax/catchall-packaging.sh + +# jenkin ignore +**/*@tmp/ diff --git a/.pax/prepare-workspace.sh b/.pax/prepare-workspace.sh index c9283cd..75ceb28 100755 --- a/.pax/prepare-workspace.sh +++ b/.pax/prepare-workspace.sh @@ -19,15 +19,15 @@ # contants SCRIPT_NAME=$(basename "$0") BASEDIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) +ROOT_DIR=$(cd "$SCRIPT_DIR" && cd .. && pwd) PAX_WORKSPACE_DIR=.pax +cd "${ROOT_DIR}" PACKAGE_NAME=$(node -e "console.log(require('./package.json').name)") PACKAGE_VERSION=$(node -e "console.log(require('./package.json').version)") PACKAGE_DESC=$(node -e "console.log(require('./package.json').description)") ZOWE_PLUGIN_ID="com.ibm.${PACKAGE_NAME}" -cd $BASEDIR -cd .. -ROOT_DIR=$(pwd) # prepare pax workspace echo "[${SCRIPT_NAME}] cleaning PAX workspace ..." @@ -40,6 +40,16 @@ cp LICENSE "${PAX_WORKSPACE_DIR}/content" # build client echo "[${SCRIPT_NAME}] building client ..." +# build client +if [ ! -d "dist" ] || [ -z "$(ls -1 dist/src/index.js)" ]; then + echo "[${SCRIPT_NAME}] building client ..." + if [ ! -d "node_modules" ]; then + npm install + fi + echo "[${SCRIPT_NAME}] run build ..." + npm run build +fi + cd "dist" npm install --only=prod @@ -77,4 +87,18 @@ rsync -rv \ "${PAX_WORKSPACE_DIR}/ascii" echo "[${SCRIPT_NAME}] ${PAX_WORKSPACE_DIR} folder is prepared." + +echo "[${SCRIPT_NAME}] ${PAX_WORKSPACE_DIR} prepare local-build and *.tar.gz" +cd "${PAX_WORKSPACE_DIR}" +# remove folder for local build & tar +rm -fr "sample-node-api" +rm -f "sample-node-api.tar.gz" + +# copy ascii to sample-node-api +cp -r "ascii" "sample-node-api" + +# tar sample-node-api +tar -zcvf "sample-node-api.tar.gz" "sample-node-api" +echo "[${SCRIPT_NAME}] ${PAX_WORKSPACE_DIR} local-build and *.tar.gz is generated" + exit 0 diff --git a/README.md b/README.md index b4be571..5c0d885 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ ssh ibmuser@my.mainframe.com ### 2) install component using zowe-install-component.sh script ``` -.//bin/zowe-install-component.sh -d -i -o -l +.//bin/zowe-install-component.sh -i -o -l ``` ``` - Directory that will hold all external extensions installed onto zowe @@ -86,7 +86,7 @@ We expect following in service folder `start.sh`. In our case its bin folder wit ### 4) Access newly deployed webservice -Please see static definition file `sample-node-api.yml` +Please see static definition file `sample-node-api.yaml.template` It configures service endpoint as `sample-node-api` with property `serviceId` We also provide api gateway base path `api\v1` with property `gatewayUrl` in same file. diff --git a/manifest.yaml b/manifest.yaml index 6357d13..5264f62 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -15,4 +15,4 @@ commands: start: bin/start.sh apimlServices: static: - - file: sample-node-api.yml \ No newline at end of file + - file: sample-node-api.yaml.template \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index bc796de..7514091 100644 --- a/package-lock.json +++ b/package-lock.json @@ -403,7 +403,7 @@ }, "decamelize": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decompress-response": { @@ -1092,7 +1092,7 @@ }, "path-exists": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" }, "path-is-absolute": { @@ -1214,7 +1214,7 @@ }, "require-directory": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" }, "require-main-filename": { @@ -1313,7 +1313,7 @@ }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "setprototypeof": { @@ -1502,7 +1502,7 @@ }, "which-module": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, "widest-line": { diff --git a/package.json b/package.json index 293e9d9..6a4d1fd 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "nodemon src/index.js", "dev:https": "nodemon src/index.js --key sslcert/server.key --cert sslcert/server.cert", "start": "node src/index.js", - "build": "npm run clean && cp -r src dist/src && cp -r bin dist/bin && cp *.yml dist && cp *.yaml dist && cp *.json dist && cp README.md dist && cp LICENSE dist", + "build": "npm run clean && cp -r src dist/src && cp -r bin dist/bin && cp *.yaml.template dist && cp *.yaml dist && cp *.json dist && cp README.md dist && cp LICENSE dist", "clean": "rimraf dist && mkdirp dist" }, "author": "", diff --git a/sample-node-api.yml b/sample-node-api.yaml.template similarity index 74% rename from sample-node-api.yml rename to sample-node-api.yaml.template index 9d0af3c..f59ffd5 100644 --- a/sample-node-api.yml +++ b/sample-node-api.yaml.template @@ -5,7 +5,7 @@ services: description: Sample Node API catalogUiTileId: sample-node-api instanceBaseUrls: - - http://mymainframe.ibm.com:18000/ + - https://${ZOWE_EXPLORER_HOST}:18000/ homePageRelativeUrl: # Home page is at the same URL routedServices: - gatewayUrl: api/v1 # [api/ui/ws]/v{majorVersion} @@ -14,8 +14,8 @@ services: - apiId: com.ibm.sample-node-api gatewayUrl: api/v1 version: 1.0.0 - swaggerUrl: http://mymainframe.ibm.com:18000/api-docs - documentationUrl: http://mymainframe.ibm.com:18000/api-docs-ui + swaggerUrl: https://${ZOWE_EXPLORER_HOST}:18000/api-docs + documentationUrl: https://${ZOWE_EXPLORER_HOST}:18000/api-docs-ui catalogUiTiles: sample-node-api: diff --git a/start-sample.sh b/start-sample.sh index e2d00a0..11b94b8 100644 --- a/start-sample.sh +++ b/start-sample.sh @@ -3,13 +3,17 @@ node src/index.js --service sample-node-api --port 8080 --key sslcert/server.key cd ~/zowe/extenders/sample-node-api ## start on z/os uss -KEYSTORE_DIRECTORY=~/zowe/keystore +KEYSTORE_DIRECTORY=/u/nakul/zowe/keystore KEYSTORE_ALIAS=localhost KEYSTORE_PREFIX="${KEYSTORE_DIRECTORY}/${KEYSTORE_ALIAS}/${KEYSTORE_ALIAS}.keystore" KEYSTORE_KEY=${KEYSTORE_PREFIX}.key KEYSTORE_CERTIFICATE=${KEYSTORE_PREFIX}.cer-ebcdic +export __UNTAGGED_READ_MODE=V6 node src/index.js --service sample-node-api --port 18000 --key ${KEYSTORE_KEY} --cert ${KEYSTORE_CERTIFICATE} -v +/usr/lpp/IBM/cnj/v12r0/IBM/node-v12.14.1-os390-s390x/bin/node src/index.js --service jes --path /ui/v1/explorer-jes --dir /u/nakul/zowe/runtime/components/explorer-jes/bin/app --port 48546 --key ${KEYSTORE_KEY} --cert ${KEYSTORE_CERTIFICATE} --csp tvt5003.svl.ibm.com:* +/usr/lpp/IBM/cnj/v8r0/IBM/node-v8.17.0.1-os390-s390x/bin/node src/index.js --service jes --path /ui/v1/explorer-jes --dir /u/nakul/zowe/runtime/components/explorer-jes/bin/app --port 48546 --key ${KEYSTORE_KEY} --cert ${KEYSTORE_CERTIFICATE} --csp tvt5003.svl.ibm.com:* + # register with API ML layer cd ~/zowe/extenders/sample-node-api iconv -f IBM-1047 -t IBM-850 sample-node-api.yml > ~/zowe/instance/workspace/api-mediation/api-defs/sample-node-api.yml \ No newline at end of file