diff --git a/.dependency/zwe_doc_generation/.gitignore b/.dependency/zwe_doc_generation/.gitignore new file mode 100644 index 0000000000..b2c31875fe --- /dev/null +++ b/.dependency/zwe_doc_generation/.gitignore @@ -0,0 +1,4 @@ +# ignore generated documentation +generated/* +# keep the folder but nothing else +!generated/.gitkeep \ No newline at end of file diff --git a/.dependency/zwe_doc_generation/README.md b/.dependency/zwe_doc_generation/README.md new file mode 100644 index 0000000000..8f79002039 --- /dev/null +++ b/.dependency/zwe_doc_generation/README.md @@ -0,0 +1,5 @@ +# ZWE CLI Documentation Generation + +Run `node index.js` to generate documentation for the `zwe` cli in `md` format. The command [documentation files](../../bin/README.md#command-assistant-files) are used to generate documentation. + +Generated documentation is added to the `generated/` folder. Files in this folder are not tracked in git. \ No newline at end of file diff --git a/.dependency/zwe_doc_generation/doc-tree.js b/.dependency/zwe_doc_generation/doc-tree.js new file mode 100644 index 0000000000..affe974004 --- /dev/null +++ b/.dependency/zwe_doc_generation/doc-tree.js @@ -0,0 +1,38 @@ +/** + * 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 IBM Corporation 2021 +*/ +const path = require('path'); +const fs = require('fs'); +const { EXPERIMENTAL, HELP, EXAMPLES, EXCLUSIVE_PARAMETERS, PARAMETERS, ERRORS } = require('./dot-file-structure'); + +const documentationTypes = [EXPERIMENTAL, HELP, EXAMPLES, EXCLUSIVE_PARAMETERS, PARAMETERS, ERRORS]; + +function getDocumentationTree(commandDirectory) { + const documentationNode = { children: [], command: commandDirectory.command }; + const objectsInDirectory = fs.readdirSync(commandDirectory.dir); + + for (const file of objectsInDirectory) { + const objectPath = path.join(commandDirectory.dir, file); + + if (fs.statSync(objectPath).isDirectory()) { + documentationNode.children.push(getDocumentationTree({ dir: objectPath, command: path.basename(objectPath) })); + } else { + const docFileType = documentationTypes.find((df) => df.fileName === file); + if (docFileType) { + documentationNode[docFileType.fileName] = objectPath; + } + } + } + + return documentationNode; +} + +module.exports = { + getDocumentationTree +}; diff --git a/.dependency/zwe_doc_generation/dot-file-structure.js b/.dependency/zwe_doc_generation/dot-file-structure.js new file mode 100644 index 0000000000..b1a420c410 --- /dev/null +++ b/.dependency/zwe_doc_generation/dot-file-structure.js @@ -0,0 +1,97 @@ +/** + * 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 IBM Corporation 2021 + */ + +const DOT_FILE_TABLE_ENTRY_DELIMITER = '|'; +const DOT_FILE_TABLE_ROW_DELIMITER = '\n'; + +const parameterTable = { + delimiter: '|', + orderedSegments: [ + { + position: 1, + meaning: 'Full name', + transform: (content) => content ? `--${content.replace(/,/g, ',--')}` : '' // other full name options are comma delimited + }, + { + position: 2, + meaning: 'Alias', + transform: (content) => content ? `-${content.replace(/,/g, ',-')}` : '' // other alias options are comma delimited + }, + { + position: 3, + meaning: 'Type' + }, + { + position: 4, + meaning: 'Required', + transform: (content) => content === 'required' ? 'yes' : 'no' + }, + { + position: 5, + meaning: 'Reserved for future use', + ignore: true + }, + { + position: 6, + meaning: 'Reserved for future use', + ignore: true + }, + { + position: 7, + meaning: 'Help message' + } + ] +} + +const EXPERIMENTAL = { + inherit: true, + fileName: '.experimental', + meaning: 'WARNING: This command is for experimental purposes and may not fully function.' +}; +const HELP = { + fileName: '.help', +}; +const EXAMPLES = { + fileName: '.examples', +}; +const EXCLUSIVE_PARAMETERS = { + fileName: '.exclusive-parameters', + table: parameterTable +}; +const PARAMETERS = { + inherit: true, + fileName: '.parameters', + table: parameterTable +}; +const ERRORS = { + inherit: true, + fileName: '.errors', + table: { + delimiter: '|', + orderedSegments: [ + { + position: 1, + meaning: 'Error code', + }, + { + position: 2, + meaning: 'Exit code', + }, + { + position: 3, + meaning: 'Error message', + } + ] + } +}; + +module.exports = { + EXPERIMENTAL, HELP, EXAMPLES, EXCLUSIVE_PARAMETERS, PARAMETERS, ERRORS, DOT_FILE_TABLE_ENTRY_DELIMITER, DOT_FILE_TABLE_ROW_DELIMITER +}; diff --git a/.dependency/zwe_doc_generation/generated/.gitkeep b/.dependency/zwe_doc_generation/generated/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.dependency/zwe_doc_generation/index.js b/.dependency/zwe_doc_generation/index.js new file mode 100644 index 0000000000..fd402b3b32 --- /dev/null +++ b/.dependency/zwe_doc_generation/index.js @@ -0,0 +1,29 @@ +/** + * 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 IBM Corporation 2021 + */ +const fs = require('fs'); +const path = require('path'); +const { getDocumentationTree } = require('./doc-tree'); +const { generateDocumentationForNode } = require('./md-content'); + +const generatedDocDirectory = path.join(__dirname, './generated') + +const rootDocNode = getDocumentationTree({ dir: path.join(__dirname, '../../bin/commands'), command: 'zwe' }); +writeMdFiles(rootDocNode); + +function writeMdFiles(docNode, writtenParentNode = {}) { + const { mdContent, parts } = generateDocumentationForNode(docNode, writtenParentNode); + fs.writeFileSync(`${generatedDocDirectory}/${parts.fileName}.md`, mdContent); + + if (docNode.children && docNode.children.length) { + for (const child of docNode.children) { + writeMdFiles(child, parts); + } + } +} \ No newline at end of file diff --git a/.dependency/zwe_doc_generation/md-content.js b/.dependency/zwe_doc_generation/md-content.js new file mode 100644 index 0000000000..81dab19504 --- /dev/null +++ b/.dependency/zwe_doc_generation/md-content.js @@ -0,0 +1,166 @@ +/** + * 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 IBM Corporation 2021 + */ +const fs = require('fs'); +const { EXPERIMENTAL, HELP, EXAMPLES, EXCLUSIVE_PARAMETERS, PARAMETERS, ERRORS, DOT_FILE_TABLE_ENTRY_DELIMITER, DOT_FILE_TABLE_ROW_DELIMITER } = require('./dot-file-structure'); + +const SEPARATOR = '\n\n'; +const SECTION_HEADER_PREFIX = '## '; +const SUB_SECTION_HEADER_PREFIX = '#' + SECTION_HEADER_PREFIX; +const MD_TABLE_ROW_DELIMITER = '\n'; +const MD_TABLE_ENTRY_DELIMITER = '|'; + +// order content will appear, with prefix/postfix as needed +const orderedDocumentationTypes = [ + { ...HELP, prefix: SECTION_HEADER_PREFIX + 'Description' + SEPARATOR }, + { ...EXPERIMENTAL }, + { ...EXAMPLES, prefix: SECTION_HEADER_PREFIX + 'Examples' + SEPARATOR }, + { ...EXCLUSIVE_PARAMETERS, prefix: SECTION_HEADER_PREFIX + 'Parameters only for this command' + SEPARATOR }, + { ...PARAMETERS, prefix: SECTION_HEADER_PREFIX + 'Parameters' + SEPARATOR }, + { ...ERRORS, prefix: SECTION_HEADER_PREFIX + 'Errors' + SEPARATOR } +]; + +function generateDocumentationForNode(curNode, assembledParentNode) { + const assembledDocNode = assembleDocumentationElementsForNode(curNode, assembledParentNode); + const { command, linkCommand, children, fileName } = assembledDocNode; + + let mdContent = '# ' + command + SEPARATOR + linkCommand + SEPARATOR + '\t' + command; + + if (children.length) { + mdContent += ' [sub-command [sub-command]...] [parameter [parameter]...]' + SEPARATOR; + mdContent += SECTION_HEADER_PREFIX + 'Sub-commands' + SEPARATOR + children.map(c => `* [${c.command}](./${getFileName(c.command, fileName)})`).join('\n'); + } else { + mdContent += ' [parameter [parameter]...]'; + } + + for (const docType of orderedDocumentationTypes) { + let docContent = ''; + if (hasDocType(assembledDocNode, docType)) { + docContent += createDocContent(assembledDocNode[docType.fileName].content, docType); + const parentDocContent = createDocContent(assembledDocNode[docType.fileName].parentContent, docType); + if (parentDocContent) { + docContent += SUB_SECTION_HEADER_PREFIX + 'Inherited from parent command' + SEPARATOR + parentDocContent; + } + } + + if (docContent) { + mdContent += SEPARATOR; + if (docType.prefix) { + mdContent += docType.prefix; + } + mdContent += docContent; + if (docType.postfix) { + mdContent += docType.postfix; + } + } + } + + return { + parts: assembledDocNode, + mdContent: mdContent + }; +} + +function assembleDocumentationElementsForNode(curNode, assembledParentNode) { + const fileName = getFileName(curNode.command, assembledParentNode.fileName); + const command = assembledParentNode.command ? assembledParentNode.command + ' ' + curNode.command : curNode.command; + const link = `[${curNode.command}](./${fileName})`; + const linkCommand = assembledParentNode.linkCommand ? `${assembledParentNode.linkCommand} > ${link}` : link; + + const docElements = { + fileName, + command, + linkCommand, + children: curNode.children, + }; + + for (const docType of orderedDocumentationTypes) { + const docForType = { content: '', parentContent: '' }; + + if (hasDocType(curNode, docType)) { + if (docType.meaning) { + docForType.content = docType.meaning; + } else { + const docFileContent = fs.readFileSync(curNode[docType.fileName], 'utf-8'); + if (docType.table) { + // filter out ignored table entries + docForType.content = docFileContent.split(/$/gm).map(line => + line + .trim() + .split(docType.table.delimiter) + .filter((_, index) => !docType.table.orderedSegments[index] || !docType.table.orderedSegments[index].ignore) + .join(DOT_FILE_TABLE_ENTRY_DELIMITER) + ) + .join(DOT_FILE_TABLE_ROW_DELIMITER); + } else { + docForType.content = docFileContent; + } + } + } + + if (hasDocType(assembledParentNode, docType) && docType.inherit) { + let parentContent = ''; + if (assembledParentNode[docType.fileName].content) { + parentContent += assembledParentNode[docType.fileName].content; + } + if (assembledParentNode[docType.fileName].parentContent) { + parentContent += assembledParentNode[docType.fileName].parentContent; + } + docForType.parentContent = parentContent; + } + + docElements[docType.fileName] = docForType; + } + + return docElements +} + +function createDocContent(rawContent, docType) { + let docContent = ''; + if (rawContent) { + if (docType.table) { + docContent += createMdTable(rawContent, docType.table); + } else { + docContent += rawContent; + } + } + return docContent; +} + +function createMdTable(rawContent, docFileTableSyntax) { + const filteredSegments = docFileTableSyntax.orderedSegments.filter(o => !o.ignore); + + let docContent = ''; + docContent += filteredSegments.map(o => o.meaning).join(MD_TABLE_ENTRY_DELIMITER) + MD_TABLE_ROW_DELIMITER; // Set table headings + docContent += filteredSegments.map(_ => '|---').join('') + MD_TABLE_ROW_DELIMITER; // Set table separator between headings and fields + + docContent += rawContent.split(DOT_FILE_TABLE_ROW_DELIMITER).map(line => line.trim().split(DOT_FILE_TABLE_ENTRY_DELIMITER) // transform table entries + .map((segment, index) => { + if (docFileTableSyntax.orderedSegments[index] && docFileTableSyntax.orderedSegments[index].transform) { + return docFileTableSyntax.orderedSegments[index].transform(segment); + } + return segment; + }) + .join(MD_TABLE_ENTRY_DELIMITER)) // join fields in a row + .join(MD_TABLE_ROW_DELIMITER); // join rows with newline + + return docContent; +} + +function getFileName(command, parentFileName) { + return parentFileName ? `${parentFileName}-${command}` : command; +} + +function hasDocType(docNode, type) { + return docNode[type.fileName] !== null & docNode[type.fileName] !== undefined; +} + +module.exports = { + generateDocumentationForNode +}; diff --git a/.github/workflows/build-packaging.yml b/.github/workflows/build-packaging.yml new file mode 100644 index 0000000000..cef6d806de --- /dev/null +++ b/.github/workflows/build-packaging.yml @@ -0,0 +1,357 @@ +name: Zowe Build and Packaging +on: + push: + branches: + - v2.x/staging + pull_request: + types: [opened, synchronize] + + workflow_dispatch: + inputs: + BUILD_SMPE: + description: 'Build SMPE' + required: false + default: false + type: boolean + BUILD_PSWI_SMPE: + description: 'Build PSWI and SMPE' + required: false + default: false + type: boolean + BUILD_KUBERNETES: + description: 'Build Kubernetes' + required: false + default: false + type: boolean + KEEP_TEMP_PAX_FOLDER: + description: 'do we need to keep temp pax folder?' + required: false + default: false + type: boolean + RANDOM_DISPATCH_EVENT_ID: + description: 'random dispatch event id' + required: false + type: string + +jobs: + display-dispatch-event-id: + if: github.event.inputs.RANDOM_DISPATCH_EVENT_ID != '' + runs-on: ubuntu-latest + steps: + - name: RANDOM_DISPATCH_EVENT_ID is ${{ github.event.inputs.RANDOM_DISPATCH_EVENT_ID }} + run: echo "prints random dispatch event id sent from workflow dispatch event" + + check-permission: + runs-on: ubuntu-latest + steps: + # this action will fail the whole workflow if permission check fails + - name: check permission + uses: zowe-actions/shared-actions/permission-check@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + regular-build: + runs-on: ubuntu-latest + needs: check-permission + steps: + - name: '[Prep 1] Checkout' + uses: actions/checkout@v2 + + - name: '[Prep 2] Setup jFrog CLI' + uses: jfrog/setup-jfrog-cli@v2 + env: + JF_ARTIFACTORY_1: ${{ secrets.JF_ARTIFACTORY_TOKEN }} + + - name: '[Prep 3] Convert manifest template to manifest.json' + run: | + COMMIT_HASH=$(git rev-parse --verify HEAD) + CURRENT_TIME=$(date +%s) + if [[ -z "${{ github.event.pull_request.number }}" ]]; then + # meaning the workflow is NOT triggered from pull_request + # sometimes user can manually trigger a workflow on a branch that a PR is open, + # thus try to find out if a PR is opened against this running branch + pr_num=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ github.ref }} | jq -r '.[] | .number') + if [[ -z "$pr_num" ]]; then + # meaning PR is not open, we collect the branch name + CURRENT_BRANCH=${GITHUB_REF_NAME} + else + CURRENT_BRANCH=PR-$pr_num + fi + else + CURRENT_BRANCH=PR-${{ github.event.pull_request.number }} + fi + + sed -e "s#{BUILD_BRANCH}#${CURRENT_BRANCH}#g" \ + -e "s#{BUILD_NUMBER}#${{ github.run_number }}#g" \ + -e "s#{BUILD_COMMIT_HASH}#${COMMIT_HASH}#g" \ + -e "s#{BUILD_TIMESTAMP}#${CURRENT_TIME}#g" \ + manifest.json.template > manifest.json + + echo "Current manifest.json is:" + cat manifest.json + + - name: '[Prep 4] Validate package.json' + uses: zowe-actions/shared-actions/validate-package-json@main + + - name: '[Prep 5] Prepare workflow' + uses: zowe-actions/shared-actions/prepare-workflow@main + with: + package-name: org.zowe + extra-init: | + const fs = require('fs'); + var mjson = '${{ github.workspace }}/manifest.json'; + var _manifestObject = JSON.parse(fs.readFileSync(mjson)); + if (!_manifestObject || !_manifestObject['name'] || _manifestObject['name'] != 'Zowe' || !_manifestObject['version']) { + console.error('Cannot read manifest or manifest is invalid.'); + } + + - name: '[Prep 6] Process github.event.inputs' + id: process-inputs + run: | + BUILD_WHAT="PAX" + + echo INPUTS_BUILD_SMPE=${{ github.event.inputs.BUILD_SMPE }} >> $GITHUB_ENV + if [[ "${{ github.event.inputs.BUILD_SMPE }}" == true ]]; then + BUILD_WHAT=$BUILD_WHAT", SMPE" + fi + + echo INPUTS_BUILD_PSWI_SMPE=${{ github.event.inputs.BUILD_PSWI_SMPE }} >> $GITHUB_ENV + if [[ "${{ github.event.inputs.BUILD_PSWI_SMPE }}" == true ]]; then + BUILD_WHAT=$BUILD_WHAT", PSWI+SMPE" + fi + + echo INPUTS_BUILD_KUBERNETES=${{ github.event.inputs.BUILD_KUBERNETES }} >> $GITHUB_ENV + if [[ "${{ github.event.inputs.BUILD_KUBERNETES }}" == true ]]; then + BUILD_WHAT=$BUILD_WHAT", K8S" + fi + + echo INPUTS_KEEP_TEMP_PAX_FOLDER=${{ github.event.inputs.KEEP_TEMP_PAX_FOLDER }} >> $GITHUB_ENV + + echo ::set-output name=BUILD_WHAT::$BUILD_WHAT + + - name: '[Prep 7] Comment on PR to indicate build is started' + uses: actions/github-script@v5 + id: create-comment + if: (github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request') && startsWith(env.CURRENT_BRANCH, 'PR-') + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + var base_pax_bld_time = 8 + var smpe_bld_time_addon = 21 + var docker_bld_time_addon = 11 + var total_bld_time = 0 + + total_bld_time += base_pax_bld_time + + if ('${{ github.event_name }}' == 'workflow_dispatch' && '${{ github.event.inputs.BUILD_SMPE }}' == 'true') { + total_bld_time += smpe_bld_time_addon + } + + const finish_time = new Date(new Date().getTime() + total_bld_time*60*1000); + + const finish_time_EST = finish_time.toLocaleString('en-CA', { timeZone: 'Canada/Eastern' }).split(', ')[1] + " EST" + const finish_time_CET = finish_time.toLocaleString('en-EU', { timeZone: 'Europe/Prague' }).split(', ')[1] + " CET" + const finish_time_UTC = finish_time.toLocaleString('en-GB', { timeZone: 'Europe/London' }).split(', ')[1] + " GMT" + const finish_time_PST = finish_time.toLocaleString('en-US', { timeZone: 'America/Los_Angeles' }).split(', ')[1] + " PST" + + const prNum='${{ env.CURRENT_BRANCH }}'.split('-')[1] + + const { data: comment } = await github.rest.issues.createComment({ + issue_number: prNum, + owner: context.repo.owner, + repo: context.repo.repo, + body: `${{ steps.process-inputs.outputs.BUILD_WHAT }} build ${context.runNumber} is started, please wait... \n Estimated build time: ${total_bld_time} mins. Check back around: \n ${finish_time_EST} | ${finish_time_CET} | ${finish_time_UTC} | ${finish_time_PST} \n (This comment will get updated once build result is out) \n Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + }); + return comment.id; + + - name: '[PAX/SMPE Download 1] Download from jfrog according to manifest' + timeout-minutes: 5 + uses: zowe-actions/shared-actions/jfrog-download@main + with: + manifest-file-path: ${{ github.workspace }}/manifest.json + default-target-path: .pax/binaryDependencies/ + expected-count: 26 + + # this step is not doing a publish, we are just utilizing this actions to get the PUBLISH_TARGET_PATH, + # and it will be used in the next step: [Download 3] Download SMPE build log + - name: '[SMPE Download 2] Get publish target path' + timeout-minutes: 5 + if: env.INPUTS_BUILD_SMPE == 'true' || env.INPUTS_BUILD_PSWI_SMPE == 'true' + uses: zowe-actions/shared-actions/publish@main + + - name: '[SMPE Download 3] Download SMPE build log' + timeout-minutes: 5 + if: env.INPUTS_BUILD_SMPE == 'true' || env.INPUTS_BUILD_PSWI_SMPE == 'true' + uses: zowe-actions/shared-actions/jfrog-download@main + with: + source-path-or-pattern: ${{ env.PUBLISH_TARGET_PATH }}smpe-build-logs-*.pax.Z + default-target-path: .pax/content/smpe/ + extra-options: --flat=true --sort-by=created --sort-order=desc --limit=1 + bypass-validation: true + + - name: '[PAX/SMPE 1] Pre-packaging' + id: pax-prep + run: | + if [ "${{ env.INPUTS_BUILD_SMPE }}" == "true" ] || [ "${{ env.INPUTS_BUILD_PSWI_SMPE }}" == "true" ] ; then + echo ::set-output name=EXTRA_FILES::zowe-smpe.zip,fmid.zip,pd.htm,smpe-promote.tar,smpe-build-logs.pax.Z,rename-back.sh + echo ::set-output name=BUILD_SMPE::yes + else + echo ::set-output name=EXTRA_FILES:: + echo ::set-output name=BUILD_SMPE:: + fi + + if [ "${{ env.INPUTS_KEEP_TEMP_PAX_FOLDER }}" == "true" ] ; then + echo ::set-output name=KEEP_TEMP_FOLDER::yes + else + echo ::set-output name=KEEP_TEMP_FOLDER:: + fi + + - name: '[PAX/SMPE Pax 2] Packaging' + timeout-minutes: 60 + uses: zowe-actions/shared-actions/make-pax@main + with: + pax-name: zowe + pax-options: '-o saveext' + pax-ssh-username: ${{ secrets.SSH_MARIST_USERNAME }} + pax-ssh-password: ${{ secrets.SSH_MARIST_RACF_PASSWORD }} + keep-temp-folders: ${{ env.INPUTS_KEEP_TEMP_PAX_FOLDER }} + extra-files: ${{ steps.pax-prep.outputs.EXTRA_FILES }} + extra-environment-vars: | + ZOWE_VERSION=${{ env.P_VERSION }} + BUILD_SMPE=${{ steps.pax-prep.outputs.BUILD_SMPE }} + KEEP_TEMP_FOLDER=${{ steps.pax-prep.outputs.KEEP_TEMP_FOLDER }} + + - name: '[SMPE Pax 3] Post-make pax' + if: env.INPUTS_BUILD_SMPE == 'true' || env.INPUTS_BUILD_PSWI_SMPE == 'true' + run: | + cd .pax + chmod +x rename-back.sh + cat rename-back.sh + ./rename-back.sh + + - name: '[PSI-LOCK] Lock marist servers to build PSWI' + uses: zowe-actions/shared-actions/lock-resource@main + if: env.INPUTS_BUILD_PSWI_SMPE == 'true' + with: + lock-repository: ${{ github.repository }} + github-token: ${{ secrets.GITHUB_TOKEN }} + lock-resource-name: zowe-psi-build-zzow03-lock + lock-avg-retry-interval: 60 + + - name: '[SMPE Pax 4] Build PSWI' + if: env.INPUTS_BUILD_PSWI_SMPE == 'true' + timeout-minutes: 60 + run: | + cd pswi + chmod +x PSWI-marist.sh + ./PSWI-marist.sh + env: + ZOSMF_USER: ${{ secrets.ZOWE_PSWI_BUILD_USR }} + ZOSMF_PASS: ${{ secrets.ZOWE_PSWI_BUILD_PASSWD }} + VERSION: ${{ env.P_VERSION }} + + - name: '[PAX/SMPE Publish] Upload to artifactory' + id: publish + timeout-minutes: 5 + uses: zowe-actions/shared-actions/publish@main + with: + artifacts: | + .pax/zowe.pax + .pax/zowe-smpe.zip + .pax/smpe-promote.tar + .pax/pd.htm + .pax/smpe-build-logs.pax.Z + .pax/AZWE* + .pax/zowe-PSWI* + # env: + # DEBUG: 'zowe-actions:shared-actions:publish' + + - name: '[K8S 1] Build Kubernetes' + timeout-minutes: 10 + if: env.INPUTS_BUILD_KUBERNETES == 'true' + working-directory: containers + run: | + ./build/parse-manifest-to-deployment.sh + zip -r zowe-containerization.zip kubernetes + + - name: '[K8S 2] Upload k8s zip to artifactory' + timeout-minutes: 5 + if: env.INPUTS_BUILD_KUBERNETES == 'true' + uses: zowe-actions/shared-actions/publish@main + with: + artifacts: containers/zowe-containerization.zip + + - name: '[Post Prep 7] Update PR comment to indicate build succeeded' + uses: actions/github-script@v5 + if: steps.create-comment.outputs.result != '' && success() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: ${{ steps.create-comment.outputs.result }}, + body: `${{ steps.process-inputs.outputs.BUILD_WHAT }} build ${context.runNumber} SUCCEEDED. \n Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + }); + + - name: '[Post Prep 7] Update PR comment to indicate build failed' + uses: actions/github-script@v5 + if: steps.create-comment.outputs.result != '' && failure() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: ${{ steps.create-comment.outputs.result }}, + body: `${{ steps.process-inputs.outputs.BUILD_WHAT }} build ${context.runNumber} FAILED. \n Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + }); + + - name: '[Post Prep 7] Update PR comment to indicate build cancelled' + uses: actions/github-script@v5 + if: steps.create-comment.outputs.result != '' && cancelled() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: ${{ steps.create-comment.outputs.result }}, + body: `${{ steps.process-inputs.outputs.BUILD_WHAT }} build ${context.runNumber} CANCELLED. \n Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + }); + + # only run auto integration tests when the workflow is triggered by pull request + # default running Convenience Pax on any zzow server + call-integration-test: + needs: regular-build + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' || (github.event_name == 'push' && contains(github.ref, 'staging')) + steps: + - name: 'Determine branch name' + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV + else + echo "BRANCH_NAME=$(echo ${GITHUB_REF_NAME})" >> $GITHUB_ENV + fi + + - name: 'Call test workflow' + uses: zowe-actions/shared-actions/workflow-remote-call-wait@main + id: call-test + with: + github-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} + owner: zowe + repo: zowe-install-packaging + workflow-filename: cicd-test.yml + branch-name: ${{ env.BRANCH_NAME }} + poll-frequency: 3 + inputs-json-string: '{"custom-zowe-artifactory-pattern-or-build-number":"${{ github.run_number }}"}' + # env: + # DEBUG: 'workflow-remote-call-wait' + + - name: 'Report test failure if applied' + if: ${{ steps.call-test.outputs.workflow-run-conclusion != 'success' }} + uses: actions/github-script@v5 + with: + script: | + core.setFailed('Test workflow ${{ steps.call-test.outputs.workflow-run-num }} is not successful') diff --git a/.github/workflows/cicd-test-readme.md b/.github/workflows/cicd-test-readme.md new file mode 100644 index 0000000000..600389e697 --- /dev/null +++ b/.github/workflows/cicd-test-readme.md @@ -0,0 +1,129 @@ +# Zowe CICD Test Instructions using Github Actions + +This guide will describe how you should input into Github Actions workflow inputs. + +Currently we support three testing z/OS servers: + +- zzow02 (ACF2) +- zzow03 (Top Secret/TSS) +- zzow04 (RACF) + +Testing pipeline is running tests in parallel. The workflow will try to acquire the resource lock if available. If the resource lock is occupied, the workflow will wait until the lock is succesfully acquired. + +Workflow trigger is at [cicd-test](https://github.com/zowe/zowe-install-packaging/actions/workflows/cicd-test.yml) + +## Inputs + +### Choose Test Server + +- This input is a choice, and it's mandatory. +- You can choose from one of `zzow02`, `zzow03`, `zzow04`, `zzow02,zzow03,zzow04` (if you want to run the test on all zzow servers), or `Any zzow servers` (pick any zzow servers, potentially help reduce wait time) +- Default is `Any zzow servers` + +### Choose Install Test + +- This input is a choice and it's mandatory. +- You can choose from the list below: + - Convenience Pax + - SMPE FMID + - SMPE PTF + - Extensions + - Keyring + - z/OS node v8 + - z/OS node v12 + - z/OS node v14 + - Non-strict Verify External Certificate + - Install PTF twice + - Generate API documentation + - Zowe Release Tests +- Note that `Zowe Release Tests` is generally run by the DevOps engineer during RC phase. It includes most of the tests above across all three zzow servers. +- Generally speaking, all tests listed above can be run on any zzow server. +- For the tests automatically triggered by your PR build, it is running `Convenience Pax` test on any zzow server. +- The time it takes to run each test see [appendix](#appendix) + +### Custom Zowe Artifactory Pattern or Build Number + +Background: CICD testing relies on a `zowe.pax` or `zowe-smpe.zip` (for SMPE install). Thus it is important for a user to tell the pipeline which `zowe.pax` or `zowe-smpe.zip` (for SMPE install) shall be picked up and utilized; this input serves this purpose. + +- This input is optional, it is expecting either: + - any `zowe.pax` or `zowe-smpe.zip` path/pattern on jfrog artifactory (note: the file path/pattern can be on any other branch as long as it exists) + - or a specific **build number** on current running branch + +- If you leave this input blank, + - the pipeline will look for the most up to date build in your running branch, and use a default zowe artifactory pattern to search the exact artifactory file path. Default pattern will be either: + - `libs-snapshot-local/org/zowe/*zowe*{branch-name}*.pax` for almost all tests except SMPE install related. + - or `libs-snapshot-local/org/zowe/*zowe-smpe*{branch-name}*.zip` when running SMPE related install test (SMPE FMID, SMPE PTF or Install PTF twice). + - Note that `{branch-name}` will be substituted with the current running branch. + - **Attention**: when you run SMPE related install tests, if the latest build does not include packaging SMPE (ie. no `zowe-smpe.zip` is found in the latest build), this pipeline will fail and throw an error. A bit of context: all zowe build will produce zowe.pax; other installation method artifacts like SMPE or docker artifact is on demand and can be skipped when building. Therefore, if you run a SMPE install test and not specifying this input, you are telling the pipeline to use latest build and the pipeline will assume the latest build contains the SMPE artifact. Error mentioned earlier rises when the latest build does not have SMPE artifact. + +- If this input is specified, + - you can input either a build number or a **valid existing** path/pattern on artifactory, otherwise an error will be thrown. + - Build number must be an integer and must exist on the current running branch. + - for path/pattern: + - your pax file must contain `zowe` and end with `.pax` + - or your smpe file must contain `zowe-smpe` and end with `.zip` + - You can include `*` in the pattern as well, so that if multiple artifacts matches the pattern, last uploaded one will be picked up. + - **Attention**: when you run SMPE related install tests, we will firstly find out which branch and what build number your specified zowe-smpe.zip is associated with. Same thing if specifying a build number. If it is not the latest build on this branch, the pipeline will throw a warning to indicate that you are possibly testing against an outdated code because there are newer builds after this current build (you specified). Pipeline will continue eventually. Warning will be something like this: + + ``` + I see that you are trying to grab an older SMPE build 1891 on zowe-install-packaging :: feature2. + However just be aware that there are more code changes (newer builds) after 1891, which is 1915. + You should always test latest code on your branch unless you want to compare with older builds for regression. + ``` + +- Examples: + - `my/path/zowe-123.pax` + - `my/path/hello-zowe-smpe-223-20211210.zip` + - `184` +- Unacceptable examples: + - `my/path/zw-3455.pax` + - `my/path/smpe-342.pax;` + - `my/path/zowe-containerization-456.zip` + - `68485345` (not exist) + +### Custom Zowe CLI Artifactory Pattern + +- This input is optional, it is designed to take in customized Zowe CLI path on artifactory. +- If not specified, this pipeline will search the latest artifact using the pattern `libs-snapshot-local/org/zowe/cli/zowe-cli-package/*/zowe-cli-package-1*.zip`. + +### Custom Extension List + +- This input is pre-filled with `sample-node-api;sample-trial-app` to test [sample-node-api](https://github.com/zowe/sample-node-api) and [sample-trial-app](https://github.com/zowe/sample-trial-app) projects. In normal circumstances, you probably don't need to modify the pre-filled value here. +- By default, the extension artifact search pattern is using format `libs-snapshot-local/org/zowe/{ext-name}/*/{ext-name}-*.pax` where `{ext-name}` will be processed and substituted from this input (as an example above, `sample-node-api`). Then the latest uploaded artifact will be used. +- Optionally, you can customized your extension artifact path. Customized jfrog artifactory path should exist, be valid, and enclosed in brackets and put after the extension name, eg. `sample-node-api(my/new/path/sample-node-api-cus.pax)`. A pattern contains `*` is also supported, which the latest artifact will be picked up. If multiple extensions are included, make sure to separate them by semi-colon. In addition to the artifactory path/pattern, you can also put a full http URL to any other remote location that points to an extension pax here. +- The following regular expression will be used to check against your input + + ``` + ^([^;()]+(\([^;()]+\))*)(;[^;()]+(\([^;()]+\))*)*$ + ``` + +- Examples: + - `sample-node-api` + - `sample-node-api(my/new/path/sample-node-api-cus.pax);sample-trial-app` + - `sample-node-api(my/new/path/sample-node-api-cus.pax);sample-trial-app(https://private-repo.org/new-zowe-ext/123.pax);sample-new-zowe-ext` +- This input is only honored when you are running `Extension` test. + +## Zowe Release Tests (DevOps only) + +When running CICD integration tests during RC stage, the following string will be parsed into the Github Actions matrix. As a result, a total of 21 independent jobs will be spawned. + +``` +basic/install.ts(zzow02,zzow03,zzow04);basic/install-ptf.ts(zzow02,zzow03,zzow04);basic/install-ext.ts(zzow03);extended/keyring.ts(zzow02,zzow03,zzow04);extended/node-versions/node-v8.ts(zzow02,zzow03,zzow04);extended/node-versions/node-v12.ts(zzow02,zzow03,zzow04);extended/node-versions/node-v14.ts(zzow02,zzow03,zzow04);extended/certificates/nonstrict-verify-external-certificate.ts(zzow02) +``` + +Total elapsed time when running in parallel is approximately 3.5 hours on paper idealy if all parallel jobs are executing at the same time. In reality, from numerous tests performed, total elapsed time is around 4 hours. + +## Appendix + +Selected test running elapsed time: +| Test | Elapsed time on each server | +| ---- | ------------ | +| Convenience Pax | 27m | +| SMPE PTF | 47m | +| z/OS node v16 | 25m | +| z/OS node v14 | 25m | +| z/OS node v12 | 25m | +| Keyring | 27m | +| Non-strict Verify External Certificate | 25m | +| Extensions | 35m +| Zowe Release Tests | 4hr diff --git a/.github/workflows/cicd-test.yml b/.github/workflows/cicd-test.yml new file mode 100644 index 0000000000..f310849c14 --- /dev/null +++ b/.github/workflows/cicd-test.yml @@ -0,0 +1,813 @@ +name: Zowe CICD Integration Tests +on: + workflow_dispatch: + inputs: + test-server: + description: 'Choose Test Server' + type: choice + required: true + default: 'Any zzow servers' + options: + - Any zzow servers + - zzow02 + - zzow03 + - zzow04 + - zzow02,zzow03,zzow04 + install-test: + description: 'Choose Install Test' + type: choice + required: true + default: Convenience Pax + options: + - Convenience Pax + - SMPE FMID + - SMPE PTF + - Extensions + - Keyring + - z/OS node v12 + - z/OS node v14 + - z/OS node v16 + - Non-strict Verify External Certificate + - Install PTF Twice + - Generate API Documentation + - Zowe Nightly Tests + - Zowe Release Tests + custom-zowe-artifactory-pattern-or-build-number: + description: 'Custom Zowe Artifactory Pattern or Build Number:' + required: false + custom-zowe-cli-artifactory-pattern: + description: 'Custom Zowe CLI Artifactory Pattern:' + required: false + custom-extension-list: + description: 'Custom Extension List:' + required: false + default: 'sample-node-api;sample-trial-app' + RANDOM_DISPATCH_EVENT_ID: + description: 'random dispatch event id' + required: false + type: string + +# create a new branch to overwrite following defaults if necessary +env: + # constants + INSTALL_TEST_PATH: tests/installation + SANITY_TEST_PATH: tests/sanity + DEFAULT_ZOWE_PAX_ARTIFACTORY_PATTERN: libs-snapshot-local/org/zowe/*zowe*{branch-name}*.pax + DEFAULT_ZOWE_SMPE_ARTIFACTORY_PATTERN: libs-snapshot-local/org/zowe/*zowe-smpe*{branch-name}*.zip + DEFAULT_ZOWE_TP_DOCKER_ARTIFACTORY_PATTERN: libs-snapshot-local/org/zowe/*server-bundle.amd64*{branch-name}*.tar + DEFAULT_ZOWE_CLI_ARTIFACTORY_PATTERN: PLACE_HOLDER/org/zowe/cli/zowe-cli-package/*/zowe-cli-package-1*.zip + DEFAULT_ZOWE_EXT_ARTIFACTORY_PATTERN: libs-snapshot-local/org/zowe/{ext-name}/*/{ext-name}-*.pax + + # can be overwritten, adjusted by DevOps only + ZOS_NODE_VERSION: v12.18.4 + # ZOS_NODE_VERSION more to choose from: v14.15.1, v16.13.0 + CLIENT_NODE_VERSION: v12.18.3 + INSTALL_TEST_DEBUG_INFORMATION: zowe-install-test:* + SANITY_TEST_DEBUG_INFORMATION: zowe-sanity-test:* + + # catalogue of files associated with install test configurations + CONVENIENCE_PAX_TESTFILE: basic/install.ts + SMPE_FMID_TESTFILE: basic/install-fmid.ts + SMPE_PTF_TESTFILE: basic/install-ptf.ts + EXTENSIONS_TESTFILE: basic/install-ext.ts + KEYRING_TESTFILE: extended/keyring.ts + ZOS_NODE_V12_TESTFILE: extended/node-versions/node-v12.ts + ZOS_NODE_V14_TESTFILE: extended/node-versions/node-v14.ts + ZOS_NODE_V16_TESTFILE: extended/node-versions/node-v16.ts + NON_STRICT_VERIFY_EXTERNAL_CERTIFICATE_TESTFILE: extended/certificates/nonstrict-verify-external-certificate.ts + INSTALL_PTF_TWICE_TESTFILE: extended/install-ptf-two-times.ts + GENERAL_API_DOCUMENTATION_TESTFILE: basic/install-api-gen.ts + # FIXME: after Zowe v2 started to build PTF, this should be changed back to install-ptf.ts + ZOWE_RELEAE_TESTS_FULL: basic/install.ts(zzow02,zzow03,zzow04);basic/install-fmid.ts(zzow02,zzow03,zzow04);basic/install-ext.ts(zzow03);extended/keyring.ts(zzow02,zzow03,zzow04);extended/node-versions/node-v8.ts(zzow02,zzow03,zzow04);extended/node-versions/node-v12.ts(zzow02,zzow03,zzow04);extended/node-versions/node-v14.ts(zzow02,zzow03,zzow04);extended/certificates/nonstrict-verify-external-certificate.ts(zzow02) + ZOWE_NIGHTLY_TESTS_FULL: basic/install.ts(zzow02,zzow03,zzow04);basic/install-fmid.ts(zzow02,zzow03,zzow04) + +jobs: + display-dispatch-event-id: + if: github.event.inputs.RANDOM_DISPATCH_EVENT_ID != '' + runs-on: ubuntu-latest + steps: + - name: RANDOM_DISPATCH_EVENT_ID is ${{ github.event.inputs.RANDOM_DISPATCH_EVENT_ID }} + run: echo "prints random dispatch event id sent from workflow dispatch event" + + check-permission: + runs-on: ubuntu-latest + steps: + # this action will fail the whole workflow if permission check fails + - name: check permission + uses: zowe-actions/shared-actions/permission-check@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + make-matrix: + runs-on: ubuntu-latest + needs: check-permission + steps: + - name: make test matrix + id: set-matrix + run: | + test_server="${{ github.event.inputs.test-server }}" + install_test_choice="${{ github.event.inputs.install-test }}" + case $install_test_choice in + + "Convenience Pax") + test_file="${{ env.CONVENIENCE_PAX_TESTFILE }}" + ;; + + "SMPE FMID") + test_file="${{ env.SMPE_FMID_TESTFILE }}" + ;; + + "SMPE PTF") + test_file="${{ env.SMPE_PTF_TESTFILE }}" + ;; + + "Extensions") + test_file="${{ env.EXTENSIONS_TESTFILE }}" + ;; + + "Keyring") + test_file="${{ env.KEYRING_TESTFILE }}" + ;; + + "z/OS node v12") + test_file="${{ env.ZOS_NODE_V12_TESTFILE }}" + ;; + + "z/OS node v14") + test_file="${{ env.ZOS_NODE_V14_TESTFILE }}" + ;; + + "z/OS node v16") + test_file="${{ env.ZOS_NODE_V16_TESTFILE }}" + ;; + + "Non-strict Verify External Certificate") + test_file="${{ env.NON_STRICT_VERIFY_EXTERNAL_CERTIFICATE_TESTFILE }}" + ;; + + "Install PTF Twice") + test_file="${{ env.INSTALL_PTF_TWICE_TESTFILE }}" + ;; + + "Generate API Documentation") + test_file="${{ env.GENERAL_API_DOCUMENTATION_TESTFILE }}" + ;; + + "Zowe Nightly Tests") + test_file="${{ env.ZOWE_NIGHTLY_TESTS_FULL }}" + dont_parse_test_server=true + ;; + + "Zowe Release Tests") + test_file="${{ env.ZOWE_RELEAE_TESTS_FULL }}" + dont_parse_test_server=true + ;; + + *) + echo "Something went wrong when parsing install test choice input" + exit 1 + ;; + esac + + if [[ -z "$dont_parse_test_server" ]]; then + if [[ "$test_server" == "Any zzow servers" ]]; then + test_server="zzow0"$(echo $(($RANDOM % 3 + 2)) ) + fi + TEST_FILE_SERVER="$test_file($test_server)" + else + TEST_FILE_SERVER="$test_file" + fi + + # this is the final string that can be recognizable by the matrix processing script down below + echo "TEST_FILE_SERVER is "$TEST_FILE_SERVER + + # sanitize all whitespaces just in case + TEST_FILE_SERVER=$TEST_FILE_SERVER | tr -d "[:space:]" + + MATRIX_JSON_STRING="{\"include\":[" + for each_test_file_server in $(echo "$TEST_FILE_SERVER" | sed "s/;/ /g") + do + test_file=$(echo "$each_test_file_server" | cut -d "(" -f1) + for test_server in $(echo "$each_test_file_server" | cut -d "(" -f2 | cut -d ")" -f1 | sed "s/,/ /g") + do + MATRIX_JSON_STRING="$MATRIX_JSON_STRING{\"test\":\"$test_file\",\"server\":\"marist-$test_server\"}," + done + done + + # remove trailing comma + MATRIX_JSON_STRING=$(echo $MATRIX_JSON_STRING | sed 's/,$//g') + + MATRIX_JSON_STRING="$MATRIX_JSON_STRING]}" + echo "::set-output name=matrix::$MATRIX_JSON_STRING" + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + + cicd-test: + runs-on: ubuntu-latest + needs: make-matrix + strategy: + matrix: ${{ fromJson(needs.make-matrix.outputs.matrix) }} + fail-fast: false + environment: ${{ matrix.server }} + steps: + - name: '[Prep 1] Checkout' + uses: actions/checkout@v2 + + - name: '[Prep 2] Cache node modules' + uses: actions/cache@v2 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: | + ~/.npm + ~/.nvm/.cache + ~/.nvm/versions + key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('tests/installation/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-cache-node-modules- + + - name: '[Prep 3] Setup jFrog CLI' + uses: jfrog/setup-jfrog-cli@v2 + env: + JF_ARTIFACTORY_1: ${{ secrets.JF_ARTIFACTORY_TOKEN }} + + - name: '[Prep 4] Validate package.json' + uses: zowe-actions/shared-actions/validate-package-json@main + + - name: '[Prep 5] Prepare workflow' + uses: zowe-actions/shared-actions/prepare-workflow@main + + - name: '[Prep 6] Additional Prep work' + id: more-test-prep + run: | + RED='\033[0;31m' + GREEN='\033[0;32m' + YELLOW='\033[0;33m' + CYAN='\033[0;36m' + NC='\033[0m' + CURRENT_BRANCH_NEW=$(echo ${{ env.CURRENT_BRANCH }} | tr '[:upper:]' '[:lower:]' | sed "s#\/#-#g") + + function jfrog_search_latest { + RED='\033[0;31m' + search_pattern=$1 + if [[ -z "$search_pattern" ]]; then + echo -e "${RED}In jfrog search latest function, search pattern is not provided" > /dev/stderr + exit 1 + fi + out=$(jfrog rt search --sort-by=created --sort-order=desc --limit=1 "$search_pattern" | jq -r '.[].path') + if [[ -z "$out" ]]; then + echo -e "${RED}Cannot find latest artifact in pattern: $search_pattern" > /dev/stderr + exit 1 + fi + echo $out + } + + function jfrog_search_build { + RED='\033[0;31m' + search_pattern=$1 + build_name=$2 + bld_num=$3 + if [[ -z "$search_pattern" ]]; then + echo -e "${RED}In jfrog_search_build function, search pattern is not provided" > /dev/stderr + exit 1 + fi + if [[ -z "$build_name" ]]; then + echo -e "${RED}In jfrog_search_build function, build name is not provided" > /dev/stderr + exit 1 + fi + if [[ -z "$bld_num" ]]; then + echo -e "${RED}In jfrog_search_build function, build number is not provided" > /dev/stderr + exit 1 + fi + out=$(jfrog rt search --build="$build_name/$bld_num" "$search_pattern" | jq -r '.[].path') + if [[ -z "$out" ]]; then + echo -e "${RED}Cannot find the artifact in pattern: $search_pattern associated with $bld_num of $build_name" > /dev/stderr + exit 1 + fi + echo $out + } + + function assert_env_var { + RED='\033[0;31m' + envvar_name=$1 + eval envvar_val='$'$envvar_name + if [[ -z "$envvar_val" ]]; then + echo -e "${RED}$envvar_name" is not set > /dev/stderr + exit 1 + fi + } + + total_check=3 + if [[ "${{ matrix.test }}" == *"install-ext"* ]]; then + ((total_check++)) + fi + + ################################################################################################## + ### 1. Process custom-zowe-artifactory-pattern + ################################################################################################## + + input_custom_zowe_art_pat_or_bldnum="${{ github.event.inputs.custom-zowe-artifactory-pattern-or-build-number }}" + + if [[ -n "$input_custom_zowe_art_pat_or_bldnum" ]]; then + if [[ "$input_custom_zowe_art_pat_or_bldnum" =~ ^[0-9]+$ ]]; then + echo "[Check 1 INFO] Build number $input_custom_zowe_art_pat_or_bldnum is entered" + custom_build_number=$input_custom_zowe_art_pat_or_bldnum + use_defaut=true + elif [[ "$input_custom_zowe_art_pat_or_bldnum" =~ ^.+\/.+$ ]]; then + echo "[Check 1 INFO] Custom artifactory pattern is entered, now figuring out pax or smpe..." + custom_pattern=$input_custom_zowe_art_pat_or_bldnum + + # first extract the filename of the artifactory path to avoid string check confusion in later steps + # filename is after the last forward slash + file_name=${custom_pattern##*/} + + if [[ "${{ matrix.test }}" == *install-fmid.ts ]] || [[ "${{ matrix.test }}" == *install-ptf.ts ]]; then + if [[ "$file_name" == *"zowe-smpe"*zip ]] ; then + # if it is valid *zowe-smpe*.zip format, and test run is smpe related, we will hornour this custom input + zowe_artifactory_pattern_interim="$custom_pattern" + echo "[Check 1 INFO] SMPE!" + else + printf "${RED}[Check 1 ERROR] You are running smpe related test but the file name included in your custom zowe artifactory pattern is not a proper *zowe-smpe*.zip format\n" + exit 1 + fi + else + if [[ "$file_name" == *"zowe"* ]] && [[ "$file_name" == *pax ]]; then + # if it is valid *zowe*.pax format, and test run is not smpe related, we will hornour this custom input + zowe_artifactory_pattern_interim="$custom_pattern" + echo "[Check 1 INFO] PAX!" + else + printf "${RED}[Check 1 ERROR] You are running pax related test but the file name included in your custom zowe artifactory pattern is not a proper *zowe*.pax format\n" + exit 1 + fi + fi + else + printf "${RED}[Check 1 ERROR] You should enter either a build number on current running branch or a proper zowe artifactory pattern\n" + printf "${RED}[Check 1 ERROR] Examples:\n" + printf "${RED}[Check 1 ERROR] 491 meaning build number 491 on ${{ env.CURRENT_BRANCH }}\n" + printf "${RED}[Check 1 ERROR] my/path/to/file\n" + exit 1 + fi + else + use_defaut=true + fi + + if [[ -n "$use_defaut" ]]; then + if [[ "${{ matrix.test }}" == *install-fmid.ts ]] || [[ "${{ matrix.test }}" == *install-ptf.ts ]]; then + zowe_artifactory_pattern_interim="${{ env.DEFAULT_ZOWE_SMPE_ARTIFACTORY_PATTERN }}" + else + zowe_artifactory_pattern_interim="${{ env.DEFAULT_ZOWE_PAX_ARTIFACTORY_PATTERN }}" + fi + fi + + echo "[Check 1 INFO] Interim zowe artifactory pattern is $zowe_artifactory_pattern_interim" + + # note that below if-else does not always get to run the sed part, as we only replace if {branch-name} exists in the pattern, + # which isn't the case for customized path. In either case, $zowe_artifactory_pattern_final should be filled + if [[ "$CURRENT_BRANCH_NEW" == "master" ]] ; then + zowe_artifactory_pattern_final=$(echo "$zowe_artifactory_pattern_interim" | sed "s#{branch-name}#snapshot#g") + else + zowe_artifactory_pattern_final=$(echo "$zowe_artifactory_pattern_interim" | sed "s#{branch-name}#$CURRENT_BRANCH_NEW#g") + fi + + echo "[Check 1 INFO] Final zowe artifactory pattern (before jfrog search) is $zowe_artifactory_pattern_final" + + if [[ -z "$custom_build_number" ]]; then + # we will search the latest build exists on current running branch + ZOWE_ARTIFACTORY_FINAL=$(jfrog_search_latest $zowe_artifactory_pattern_final) + else + # we will search according to the build number provided (on current running branch) + ZOWE_ARTIFACTORY_FINAL=$(jfrog_search_build $zowe_artifactory_pattern_final "zowe-install-packaging/${{ env.CURRENT_BRANCH }}" $custom_build_number) + fi + + # try to know if this SMPE artifact comes from latest or older build + if [[ "$ZOWE_ARTIFACTORY_FINAL" == *"zowe-smpe"*zip ]]; then + smpe_out=$(jfrog rt search "$ZOWE_ARTIFACTORY_FINAL") + smpe_bld_name=$(echo "$smpe_out" | jq -r '.[].props."build.name"[]') + smpe_bld_num=$(echo "$smpe_out" | jq -r '.[].props."build.number"[]') + + # encode '/' or ' ' in smpe build name as they may be confusing for jfrog REST API + if [[ "$smpe_bld_name" == *"/"* ]]; then + smpe_bld_name_encoded=$(echo "$smpe_bld_name" | sed "s|/|\%2F|g") + elif [[ "$smpe_bld_name" == *"::"* ]]; then + smpe_bld_name_encoded=$(echo "$smpe_bld_name" | sed "s| |\%20|g") + fi + + latest_pax_bld_num=$(jfrog rt curl -s -XGET "/api/build/$smpe_bld_name_encoded" | jq '.buildsNumbers[0].uri' | sed "s|/||g" | sed "s|\"||g" ) + + if [[ "$latest_pax_bld_num" != "$smpe_bld_num" ]]; then + if [[ -z "$input_custom_zowe_art_pat_or_bldnum" ]]; then + # when no custom input, we will throw error and fail the build + printf "${RED}[Check 1 ERROR] Latest build $latest_pax_bld_num on current branch does not contain a SMPE artifact.\n" + printf "${RED}[Check 1 ERROR] If you want to test install smpe, you should make sure latest build has SMPE packaged.\n" + printf "${RED}[Check 1 ERROR] Please specify exact build number on $smpe_bld_name or any other smpe.zip artifactory path.\n" + printf "${RED}[Check 1 ERROR] FYI latest build that contains SMPE artifact is $smpe_bld_num\n" + exit 1 + else + # when there is custom input, we will give warnings instead but still proceed + printf "${YELLOW}[Check 1 WARNING] I see that you are trying to grab an older SMPE build $smpe_bld_num on $smpe_bld_name.\n" + printf "${YELLOW}[Check 1 WARNING] However just be aware that there are more code changes (newer builds) after $smpe_bld_num, which is $latest_pax_bld_num.\n" + printf "${YELLOW}[Check 1 WARNING] You should always test latest code on your branch unless you want to compare with older builds for regression.\n" + fi + fi + fi + + # next line is just to get the pax file name - extract the part after last occurance of slash + ZOWE_ARTIFACTORY_FINAL_FILENAME=${ZOWE_ARTIFACTORY_FINAL##*/} + + assert_env_var "ZOWE_ARTIFACTORY_FINAL" + assert_env_var "ZOWE_ARTIFACTORY_FINAL_FILENAME" + printf "${GREEN}[Check 1/$total_check] Zowe pax or smpe.zip artifactory full path processing complete!${NC}\n" + + ################################################################################################## + ### 2. Process TEST_SERVER_NICKNAME + ################################################################################################## + TEST_SERVER=$(echo "${{ matrix.server }}" | cut -d "-" -f2) + + case $TEST_SERVER in + + "zzow02") + TEST_SERVER_NICKNAME=marist-2 + ;; + + "zzow03") + TEST_SERVER_NICKNAME=marist-3 + ;; + + "zzow04") + TEST_SERVER_NICKNAME=marist-4 + ;; + + *) + printf "${RED}[Check 2 ERROR] Something went wrong when parsing test server nickname\n" + exit 1 + ;; + esac + + assert_env_var "TEST_SERVER" + assert_env_var "TEST_SERVER_NICKNAME" + printf "${GREEN}[Check 2/$total_check] Test server name processing complete!${NC}\n" + + ################################################################################################## + ### 3. Process custom-zowe-cli-artifactory-pattern + ################################################################################################## + if [[ -z "${{ github.event.inputs.custom-zowe-cli-artifactory-pattern }}" ]]; then + zowe_cli_artifactory_pattern="${{ env.DEFAULT_ZOWE_CLI_ARTIFACTORY_PATTERN }}" + # determine if we shall use libs-snapshot-local or libs-release-local + if [[ "${{ env.CURRENT_BRANCH }}" == "rc" ]] || [[ "${{ env.CURRENT_BRANCH }}" == "master" ]] ; then + zowe_cli_artifactory_pattern=$(echo "$zowe_cli_artifactory_pattern" | sed "s#PLACE_HOLDER#libs-release-local#g") + else + zowe_cli_artifactory_pattern=$(echo "$zowe_cli_artifactory_pattern" | sed "s#PLACE_HOLDER#libs-snapshot-local#g") + fi + else + zowe_cli_artifactory_pattern="${{ github.event.inputs.custom-zowe-cli-artifactory-pattern }}" + fi + + echo "[Check 3 INFO] Zowe cli artifactory pattern before jfrog search is $zowe_cli_artifactory_pattern" + + ZOWE_CLI_ARTIFACTORY_FINAL=$(jfrog_search_latest $zowe_cli_artifactory_pattern) + assert_env_var ZOWE_CLI_ARTIFACTORY_FINAL + printf "${GREEN}[Check 3/$total_check] Zowe CLI artifactory full path processing complete!${NC}\n" + + ################################################################################################## + ### 4. Process custom-extension-list (if test-ext is selected) + ################################################################################################## + if [[ "${{ matrix.test }}" == *"install-ext"* ]]; then + EXTENSION_LIST= + if [[ -z "${{ github.event.inputs.custom-extension-list }}" ]]; then + printf "${RED}[Check 4 ERROR] You are running install-ext test, but input 'custom-extension-list' is missing\n" + exit 1 + fi + + # validate extension list input + if [[ "${{ github.event.inputs.custom-extension-list }}" =~ ^([^;()]+(\([^;()]+\))*)(;[^;()]+(\([^;()]+\))*)*$ ]]; then + echo "[Check 4 INFO] Extension list syntax validation success!" + else + printf "${RED}[Check 4 ERROR] Extension list validation failed\n" + printf "${RED}[Check 4 ERROR] You must follow the format: {ext-name}[({custom-ext-pattern})][;...]\n" + printf "${RED}[Check 4 ERROR] Example input will be\n" + printf "${RED}[Check 4 ERROR] sample-ext;sample-ext2;sample-myext\n" + printf "${RED}[Check 4 ERROR] sample-ext(myown/path);sample-myext\n" + exit 1 + fi + + for each_ext in $(echo "${{ github.event.inputs.custom-extension-list }}" | sed "s/;/ /g") + do + echo "[Check 4 INFO] Now processing $each_ext ..." + if [[ "$each_ext" == *"("* ]] && [[ "$each_ext" == *")"* ]] ; then + # user provides custom artifactory pattern + ext_name=$(echo "$each_ext" | cut -d "(" -f1) + ext_pattern=$(echo "$each_ext" | cut -d "(" -f2 | cut -d ")" -f1) + else + # use default + ext_name="$each_ext" + ext_pattern=$(echo "${{ env.DEFAULT_ZOWE_EXT_ARTIFACTORY_PATTERN }}" | sed "s#{ext-name}#$ext_name#g") + fi + + echo "[Check 4 INFO] extension name is $ext_name" + echo "[Check 4 INFO] extension pattern before jfrog search is $ext_pattern" + + if [[ "$ext_pattern" != *"http"* ]]; then + ext_full_path=$(jfrog_search_latest $ext_pattern) + else + ext_full_path=$ext_pattern + fi + echo "[Check 4 INFO] extension full path after jfrog search is $ext_full_path" + EXTENSION_LIST="$EXTENSION_LIST$ext_name($ext_full_path);" + done + + # remove trailing comma + EXTENSION_LIST=$(echo $EXTENSION_LIST | sed 's/;$//g') + assert_env_var EXTENSION_LIST + printf "${GREEN}[Check 4/$total_check] Zowe extension list processing complete!${NC}\n" + fi + + ################################################################################################## + ### Set outputs + ################################################################################################## + echo ::set-output name=ZOWE_ARTIFACTORY_FINAL::$ZOWE_ARTIFACTORY_FINAL + echo ::set-output name=ZOWE_ARTIFACTORY_FINAL_FILENAME::$ZOWE_ARTIFACTORY_FINAL_FILENAME + echo ::set-output name=NODE_HOME_PATTERN::/ZOWE/node/node-${{ env.ZOS_NODE_VERSION }}-os390-s390x + echo ::set-output name=TEST_SERVER::$TEST_SERVER + echo ::set-output name=TEST_SERVER_NICKNAME::$TEST_SERVER_NICKNAME + echo ::set-output name=EXTENSION_LIST::$EXTENSION_LIST + echo ::set-output name=ZOWE_CLI_ARTIFACTORY_FINAL::$ZOWE_CLI_ARTIFACTORY_FINAL + echo ::set-output name=ZOWE_TP_DOCKER_ARTIFACTORY_URL::$ZOWE_TP_DOCKER_ARTIFACTORY_URL + + ################################################################################################## + ### Echo all processed outputs + ################################################################################################## + echo + echo "#######################Summary of outputs:#######################" + printf "Zowe artifactory path: ${CYAN}$ZOWE_ARTIFACTORY_FINAL${NC}\n" + printf "Zowe artifactory file name: ${CYAN}$ZOWE_ARTIFACTORY_FINAL_FILENAME${NC}\n" + printf "Zowe CLI artifactory path: ${CYAN}$ZOWE_CLI_ARTIFACTORY_FINAL${NC}\n" + printf "Zowe extension list: ${CYAN}$EXTENSION_LIST${NC}\n" + printf "Test server: ${CYAN}$TEST_SERVER${NC}\n" + printf "Test server nickname: ${CYAN}$TEST_SERVER_NICKNAME${NC}\n" + printf "Node home pattern on z/OS: ${CYAN}/ZOWE/node/node-${{ env.ZOS_NODE_VERSION }}-os390-s390x${NC}\n" + + - name: '[Setup 1] Project Setup 1' + working-directory: ${{ env.INSTALL_TEST_PATH }} + run: | + npm ci + npm run build + + - name: '[Setup 2] Project Setup 2' + working-directory: ${{ env.SANITY_TEST_PATH }} + run: | + npm ci + + - name: '[Lint 1] Lint 1' + timeout-minutes: 2 + working-directory: ${{ env.INSTALL_TEST_PATH }} + run: | + npm run lint + + - name: '[Lint 2] Lint 2' + timeout-minutes: 2 + working-directory: ${{ env.SANITY_TEST_PATH }} + run: | + npm run lint + + - name: '[Download 1] Download zowe.pax or smpe-zowe.zip' + uses: zowe-actions/shared-actions/jfrog-download@main + with: + source-path-or-pattern: ${{ steps.more-test-prep.outputs.ZOWE_ARTIFACTORY_FINAL }} + default-target-path: ${{ runner.temp }}/zowe/ + extra-options: --flat=true + expected-count: 1 + + - name: '[Download 2] Download cli package' + uses: zowe-actions/shared-actions/jfrog-download@main + with: + source-path-or-pattern: ${{ steps.more-test-prep.outputs.ZOWE_CLI_ARTIFACTORY_FINAL }} + default-target-path: ${{ runner.temp }}/cli/ + extra-options: --flat=true --explode=true + expected-count: 1 + + - name: '[Install] Install CLI' + timeout-minutes: 10 + working-directory: ${{ runner.temp }}/cli + run: npm install -g zowe-cli*.tgz + + - name: '[Comment] Post comments on PR about what tests are gonna be run' + uses: actions/github-script@v5 + id: create-comment + if: startsWith(env.CURRENT_BRANCH, 'PR-') + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + var installTest = "${{ github.event.inputs.install-test }}" + if (installTest == '') { + // if null, this is very likely to be triggered by pr auto test + installTest = 'Convenience Pax' + } + + var prNum='${{ env.CURRENT_BRANCH }}'.split('-')[1] + + var body=`Test workflow ${context.runNumber} is started.\n` + body += `Running install test: ${installTest} \n` + body += `The zowe artifact being used by this test workflow: ${{ steps.more-test-prep.outputs.ZOWE_ARTIFACTORY_FINAL }} \n` + body += `Running on machine: ${{ steps.more-test-prep.outputs.TEST_SERVER }} \n` + body += `Acquiring the test server lock first, please wait... \n ` + body += `ETA: unknown (This ETA will get updated once the machine lock is acquired) \n` + body += `Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + + const { data: comment } = await github.rest.issues.createComment({ + issue_number: prNum, + owner: context.repo.owner, + repo: context.repo.repo, + body: body + }); + + return comment.id; + + - name: '[LOCK] Lock marist servers' + uses: zowe-actions/shared-actions/lock-resource@main + with: + lock-repository: ${{ github.repository }} + github-token: ${{ secrets.GITHUB_TOKEN }} + lock-resource-name: zowe-install-test-${{ steps.more-test-prep.outputs.TEST_SERVER }}-lock + lock-avg-retry-interval: 60 + + - name: '[Comment] Update comment after lock is acquired' + uses: actions/github-script@v5 + if: steps.create-comment.outputs.result != '' + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + var installTest = "${{ github.event.inputs.install-test }}" + var eta + if (installTest == '') { + // if null, this is very likely to be triggered by pr auto test + installTest = 'Convenience Pax' + } + + // get ETA for each test run + switch(installTest) { + case 'Convenience Pax': + eta = 27 + break; + case 'SMPE PTF': + eta = 47 + break; + case 'Extensions': + eta = 35 + break; + case 'Keyring': + eta = 27 + break; + case 'z/OS node v12': + eta = 25 + break; + case 'z/OS node v14': + eta = 25 + break; + case 'z/OS node v16': + eta = 25 + break; + case 'Non-strict Verify External Certificate': + eta = 25 + break; + case 'Zowe Release Tests': + eta = 240 + break; + default: + } + + var expectedTimeString + if (eta != '') { + const finish_time = new Date(new Date().getTime() + eta*60*1000); + const finish_time_EST = finish_time.toLocaleString('en-CA', { timeZone: 'Canada/Eastern' }).split(', ')[1] + " EST" + const finish_time_CET = finish_time.toLocaleString('en-EU', { timeZone: 'Europe/Prague' }).split(', ')[1] + " CET" + const finish_time_UTC = finish_time.toLocaleString('en-GB', { timeZone: 'Europe/London' }).split(', ')[1] + " GMT" + const finish_time_PST = finish_time.toLocaleString('en-US', { timeZone: 'America/Los_Angeles' }).split(', ')[1] + " PST" + expectedTimeString = `Check back around: \n ${finish_time_EST} | ${finish_time_CET} | ${finish_time_UTC} | ${finish_time_PST} \n` + } + else { + eta = 'unknown' + } + + var body=`Test workflow ${context.runNumber} is started.\n` + body += `Running install test: ${installTest} \n` + body += `The zowe artifact being used by this test workflow: ${{ steps.more-test-prep.outputs.ZOWE_ARTIFACTORY_FINAL }} \n` + body += `Running on machine: ${{ steps.more-test-prep.outputs.TEST_SERVER }} \n` + body += `Lock acquired, start the test now, please wait... \n ` + body += `ETA: ${eta} mins \n` + if (expectedTimeString != '') { + body += `${expectedTimeString} \n` + } + body += `Result: (will get updated once test is finished) \n` + body += `Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: ${{ steps.create-comment.outputs.result }}, + body: body + }); + + - name: '[Test] Test starts from here' + timeout-minutes: 90 + working-directory: ${{ env.INSTALL_TEST_PATH }} + run: npm test -- --testPathPattern --detectOpenHandles dist/__tests__/$(echo "${{ matrix.test }}" | sed "s/.ts/.js/g") + env: + ANSIBLE_FORCE_COLOR: true + TEST_SERVER: ${{ steps.more-test-prep.outputs.TEST_SERVER_NICKNAME }} + ZOWE_BUILD_LOCAL: "${{ runner.temp }}/zowe/${{ steps.more-test-prep.outputs.ZOWE_ARTIFACTORY_FINAL_FILENAME }}" + ZOWE_DOCKER_URL: ${{ steps.more-test-prep.outputs.ZOWE_TP_DOCKER_ARTIFACTORY_URL }} + EXTENSIONS_LIST: ${{ steps.more-test-prep.outputs.EXTENSION_LIST }} + SANITY_TEST_DEBUG: ${{ env.SANITY_TEST_DEBUG_INFORMATION }} + DEBUG: ${{ env.INSTALL_TEST_DEBUG_INFORMATION }} + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_PORT: ${{ secrets.SSH_PORT }} + SSH_USER: ${{ secrets.SSH_USER }} + SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }} + ZOS_NODE_HOME: ${{ steps.more-test-prep.outputs.NODE_HOME_PATTERN }} + # # ANSIBLE_VERBOSE: -vvv + + # - name: '[After Test] Merge Report' + # if: always() + # working-directory: ${{ env.INSTALL_TEST_PATH }} + # run: npm run merge-reports + + - name: '[Comment] Update PR comment to indicate test succeeded' + uses: actions/github-script@v5 + if: steps.create-comment.outputs.result != '' && success() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + var installTest = "${{ github.event.inputs.install-test }}" + var eta + if (installTest == '') { + // if null, this is very likely to be triggered by pr auto test + installTest = 'Convenience Pax' + } + + var body=`Test workflow ${context.runNumber} is started.\n` + body += `Running install test: ${installTest} \n` + body += `The zowe artifact being used by this test workflow: ${{ steps.more-test-prep.outputs.ZOWE_ARTIFACTORY_FINAL }} \n` + body += `Running on machine: ${{ steps.more-test-prep.outputs.TEST_SERVER }} \n` + body += `Result: SUCCESS \n` + body += `Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: ${{ steps.create-comment.outputs.result }}, + body: body + }); + + - name: '[Comment] Update PR comment to indicate test failed' + uses: actions/github-script@v5 + if: steps.create-comment.outputs.result != '' && failure() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + var installTest = "${{ github.event.inputs.install-test }}" + var eta + if (installTest == '') { + // if null, this is very likely to be triggered by pr auto test + installTest = 'Convenience Pax' + } + + var body=`Test workflow ${context.runNumber} is started.\n` + body += `Running install test: ${installTest} \n` + body += `The zowe artifact being used by this test workflow: ${{ steps.more-test-prep.outputs.ZOWE_ARTIFACTORY_FINAL }} \n` + body += `Running on machine: ${{ steps.more-test-prep.outputs.TEST_SERVER }} \n` + body += `Result: FAILURE \n` + body += `Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: ${{ steps.create-comment.outputs.result }}, + body: body + }); + + - name: '[Comment] Update PR comment to indicate test cancelled' + uses: actions/github-script@v5 + if: steps.create-comment.outputs.result != '' && cancelled() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + var installTest = "${{ github.event.inputs.install-test }}" + var eta + if (installTest == '') { + // if null, this is very likely to be triggered by pr auto test + installTest = 'Convenience Pax' + } + + var body=`Test workflow ${context.runNumber} is started.\n` + body += `Running install test: ${installTest} \n` + body += `The zowe artifact being used by this test workflow: ${{ steps.more-test-prep.outputs.ZOWE_ARTIFACTORY_FINAL }} \n` + body += `Running on machine: ${{ steps.more-test-prep.outputs.TEST_SERVER }} \n` + body += `Result: CANCELLED \n` + body += `Link to workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}` + + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: ${{ steps.create-comment.outputs.result }}, + body: body + }); + diff --git a/.github/workflows/snyk-analysis.yml b/.github/workflows/snyk-analysis.yml index 18e24628d4..7ed384a0e0 100644 --- a/.github/workflows/snyk-analysis.yml +++ b/.github/workflows/snyk-analysis.yml @@ -1,6 +1,11 @@ name: Kubernetes Containers Scan -on: push +on: + push: + branches: + - v2.x/staging + pull_request: + types: [opened, synchronize] jobs: setup-matrix: diff --git a/.github/workflows/snyk-kubernetes.yml b/.github/workflows/snyk-kubernetes.yml index d3b63252ce..0a4d14858d 100644 --- a/.github/workflows/snyk-kubernetes.yml +++ b/.github/workflows/snyk-kubernetes.yml @@ -1,5 +1,12 @@ name: Kubernetes IaC Scan -on: push + +on: + push: + branches: + - v2.x/staging + pull_request: + types: [opened, synchronize] + jobs: snyk: strategy: diff --git a/.github/workflows/zwe-doc-generation.yml b/.github/workflows/zwe-doc-generation.yml new file mode 100644 index 0000000000..12ea93ab60 --- /dev/null +++ b/.github/workflows/zwe-doc-generation.yml @@ -0,0 +1,79 @@ +name: Update zwe documentation + +on: + # Will run this on push when v2 is out + # push: + # branches: + # - v2.x/staging + workflow_dispatch: + +env: + DOCS_SITE_ZWE_COMMAND_REFERENCE_DIR: docs/appendix/zwe_server_command_reference + # Will change this to a docs staging branch when v2 is out + DOCS_SITE_TARGET_BRANCH: v2-docs-branch + DOCS_SITE_COMMIT_BRANCH: auto-update-zwe-reference + ZWE_DOC_GENERATION_DIR: .dependency/zwe_doc_generation + +jobs: + update-zwe-documentation: + name: Update zwe documentation on docs-site + runs-on: ubuntu-latest + + steps: + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up git + run: | + git config --global user.email "zowe-robot@users.noreply.github.com" + git config --global user.name "Zowe Robot" + + - name: Clone docs site + run: git clone https://zowe-robot:${{ secrets.ZOWE_ROBOT_TOKEN }}@github.com/zowe/docs-site.git --depth 1 --branch ${{ env.DOCS_SITE_TARGET_BRANCH }} + + - name: Generate zwe documentation + run: node ${{ env.ZWE_DOC_GENERATION_DIR }} + + - name: Copy generated zwe documentation files to docs site + run: | + cd docs-site + # check out branch that will contain update and unsure there are no remote differences + git checkout -b ${{ env.DOCS_SITE_COMMIT_BRANCH }} + git pull origin ${{ env.DOCS_SITE_COMMIT_BRANCH }} || true # swallow error in case branch doesn't exist in remote + cp ../${{ env.ZWE_DOC_GENERATION_DIR }}/generated/* ${{ env.DOCS_SITE_ZWE_COMMAND_REFERENCE_DIR }} + + - name: Commit changes to branch and push + id: commitChanges + run: | + cd docs-site + git add ${{ env.DOCS_SITE_ZWE_COMMAND_REFERENCE_DIR }} + if git commit -s -m"Update zwe command reference"; + then + echo ">>>>>Changes committed to ${{ env.DOCS_SITE_COMMIT_BRANCH }}, now pushing"; + git push origin ${{ env.DOCS_SITE_COMMIT_BRANCH }} + echo "::set-output name=createPr::true" + else + echo ">>>>>No update to documentation"; + echo "::set-output name=createPr::false" + fi + + - name: Create pull request + if: ${{ steps.commitChanges.outputs.createPr == 'true' }} + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.ZOWE_ROBOT_TOKEN }} + script: | + const res = await github.rest.pulls.create({ + owner: 'zowe', + repo: 'docs-site', + title: 'Update zwe server command reference', + body: 'Automatic update of the zwe server command reference', + head: '${{ env.DOCS_SITE_COMMIT_BRANCH }}', + base: '${{ env.DOCS_SITE_TARGET_BRANCH }}' + }); + console.log(`The pull request is at: ${res.data.html_url}`); diff --git a/.pax/post-packaging.sh b/.pax/post-packaging.sh index 02fdbc7e10..1a83abb73e 100755 --- a/.pax/post-packaging.sh +++ b/.pax/post-packaging.sh @@ -53,7 +53,7 @@ FMID=AZWE${FMID_VERSION} # to package on another server, we may need different settings export TMPDIR=/ZOWE/tmp SMPE_BUILD_HLQ=ZOWEAD3 -SMPE_BUILD_VOLSER=ZOWE02 +SMPE_BUILD_VOLSER=ZOWE03 # write data sets list we want to clean up echo "${SMPE_BUILD_HLQ}.${RANDOM_MLQ}" > ${CURR_PWD}/cleanup-smpe-packaging-datasets.txt @@ -166,7 +166,6 @@ echo #% -E success exit with RC 0, create file on successful completion #% -p version product version #% -P fail build if APAR/USERMOD is created instead of PTF -#% -S create PSI package (Portable Software Instance for z/osmf) #% -V volume allocate data sets on specified volume(s) external="" @@ -176,8 +175,6 @@ echo "BUILD_NUMBER=$BUILD_NUMBER" test -n "$BUILD_NUMBER" && external="$external -B $BUILD_NUMBER" echo "ZOWE_VERSION=$ZOWE_VERSION" test -n "$ZOWE_VERSION" && external="$external -p $ZOWE_VERSION" -echo "BUILD_PSI=$BUILD_PSI" -test -n "$BUILD_PSI" && external="$external -S" ${CURR_PWD}/smpe/bld/smpe.sh \ -a ${CURR_PWD}/smpe/bld/alter.sh \ diff --git a/.pax/prepare-workspace.sh b/.pax/prepare-workspace.sh index c8e9553bb8..5ea6aa41e1 100755 --- a/.pax/prepare-workspace.sh +++ b/.pax/prepare-workspace.sh @@ -10,7 +10,7 @@ # # SPDX-License-Identifier: EPL-2.0 # -# Copyright Contributors to the Zowe Project. 2019, 2021 +# Copyright Contributors to the Zowe Project. 2019, 2022 ####################################################################### ####################################################################### @@ -90,23 +90,6 @@ SCRIPT_NAME=$(basename "$0") # $0=./.pax/prepare-workspace.sh PAX_WORKSPACE_DIR=$(cd "$(dirname "$0")";pwd) # /.pax PAX_BINARY_DEPENDENCIES="${PAX_WORKSPACE_DIR}/binaryDependencies" ROOT_DIR=$(cd "${PAX_WORKSPACE_DIR}/../";pwd) -# BUILD_BRANCH should be a Jenkins variable -if [ -z "${BUILD_BRANCH}" ]; then - # generate if it's not running on Jenkins - BUILD_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') -fi -BUILD_COMMIT_HASH=$(git rev-parse --verify HEAD) -BUILD_TIMESTAMP=$(node -e "console.log((new Date()).getTime())") - -# BUILD_NUMBER should be a Jenkins variable -cd "${ROOT_DIR}" -echo "[${SCRIPT_NAME}] preparing manifest.json ..." -sed -e "s#{BUILD_BRANCH}#${BUILD_BRANCH}#g" \ - -e "s#{BUILD_NUMBER}#${BUILD_NUMBER}#g" \ - -e "s#{BUILD_COMMIT_HASH}#${BUILD_COMMIT_HASH}#g" \ - -e "s#{BUILD_TIMESTAMP}#${BUILD_TIMESTAMP}#g" \ - manifest.json.template > manifest.json -echo "[${SCRIPT_NAME}] build information: $(cat manifest.json | jq -r '.build')" echo "[${SCRIPT_NAME}] extracting ZOWE_VERSION ..." ZOWE_VERSION=$(cat ${ROOT_DIR}/manifest.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 8afbfdbf6c..20f9778933 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -39,7 +39,7 @@ Zowe YAML configuration has a section for you to define PROCLIB where Zowe STCs ```yaml zowe: setup: - mvs: + dataset: # **COMMONLY_CUSTOMIZED** # PROCLIB where Zowe STCs will be copied over proclib: IBMUSER.PROCLIB diff --git a/Jenkinsfile b/Jenkinsfile index 88f75213ae..f3c153e286 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -98,11 +98,11 @@ node('zowe-jenkins-agent-dind-wdc') { // download components pipeline.artifactory.download( spec : 'artifactory-download-spec.json', - expected : 25 + expected : 26 ) // we want build log pulled in for SMP/e build - if (params.BUILD_SMPE != 'NONE') { + if (params.BUILD_SMPE != 'NONE' ) { def buildLogSpec = readJSON(text: '{"files":[]}') buildLogSpec['files'].push([ "target": ".pax/content/smpe/", @@ -189,6 +189,7 @@ node('zowe-jenkins-agent-dind-wdc') { ] ) + pipeline.createStage( name: "Build zLinux Docker", timeout: [ time: 60, unit: 'MINUTES' ], diff --git a/Jenkinsfile.nightly b/Jenkinsfile.nightly index 468bd0685b..288f88c607 100644 --- a/Jenkinsfile.nightly +++ b/Jenkinsfile.nightly @@ -59,9 +59,9 @@ node('zowe-jenkins-agent-dind-wdc') { ) // we want to run daily on master branch - if (isStagingBranch) { - pipeline.addBuildOption(pipelineTriggers([cron("TZ=America/New_York\nH 23 * * *")])) - } +// if (isStagingBranch) { +// pipeline.addBuildOption(pipelineTriggers([cron("TZ=America/New_York\nH 23 * * *")])) +// } // get the day of the week def currentDayofWeek = sh(script: 'date +"%a"', returnStdout: true).trim() @@ -168,7 +168,7 @@ node('zowe-jenkins-agent-dind-wdc') { def build_result = build( job: '/zowe-install-packaging/staging', parameters: [ - string(name: 'BUILD_SMPE', value: 'SMPE'), + booleanParam(name: 'BUILD_SMPE', value: true), booleanParam(name: 'BUILD_DOCKER', value: true), booleanParam(name: 'BUILD_KUBERNETES', value: true), booleanParam(name: 'Skip Stage: Test Convenience Build', value: true), diff --git a/Jenkinsfile.release b/Jenkinsfile.release index d8de07f384..7a3c714e1f 100644 --- a/Jenkinsfile.release +++ b/Jenkinsfile.release @@ -11,7 +11,7 @@ */ node('zowe-jenkins-agent-dind-wdc') { - def lib = library("jenkins-library").org.zowe.jenkins_shared_library + def lib = library("jenkins-library@users/tom/releasepipelinechanges").org.zowe.jenkins_shared_library def ZOWE_RELEASE_REPOSITORY = 'libs-release-local' def ZOWE_RELEASE_PATH = '/org/zowe' @@ -206,12 +206,11 @@ node('zowe-jenkins-agent-dind-wdc') { releaseArtifacts['zowe']['buildNumber'], "zowe-install-packaging" ) - releaseArtifacts['zowe']['revision'] = zoweBuildInfo && zoweBuildInfo['vcsRevision'] + releaseArtifacts['zowe']['revision'] = (zoweBuildInfo && zoweBuildInfo['vcsRevision']) || (releaseArtifacts['zowe']['source'] && releaseArtifacts['zowe']['source']['vcs.revision']) if (!("${releaseArtifacts['zowe']['revision']}" ==~ /^[0-9a-fA-F]{40}$/)) { // if it's a SHA-1 commit hash error "Cannot extract git revision from build \"${releaseArtifacts['zowe']['buildName']}/${releaseArtifacts['zowe']['buildNumber']}\"" } echo ">>>> Build ${releaseArtifacts['zowe']['buildName']}/${releaseArtifacts['zowe']['buildNumber']} commit hash is ${releaseArtifacts['zowe']['revision']}, may proceed." - echo ">>>> BuildInfo vcsUrl is ${zoweBuildInfo['vcsUrl']}, vcs revision is ${zoweBuildInfo['vcsRevision']}" // get SMP/e build try { @@ -396,6 +395,9 @@ node('zowe-jenkins-agent-dind-wdc') { pipeline.createStage( name : "Generate Source Build", isSkippable : true, + shouldExecute : { + return isFormalRelease + }, stage : { // files should be downloaded to .release/source_zip withCredentials([ diff --git a/bin/README.md b/bin/README.md index 1f7bc6d539..712bd821ac 100644 --- a/bin/README.md +++ b/bin/README.md @@ -97,9 +97,9 @@ These Zowe environment variables are created globally. Any Zowe components, exte - `ZWE_PRIVATE_CONTAINER_COMPONENT_RUNTIME_DIRECTORY` is the directory of component runtime in Kubernetes deployment. Default value is `/component`. - `ZWE_PRIVATE_CONTAINER_HOME_DIRECTORY` is the directory of Zowe home directory in Kubernetes deployment. Default value is `/home/zowe`. - `ZWE_PRIVATE_CONTAINER_KEYSTORE_DIRECTORY` is the directory of Keystore directory in Kubernetes deployment. Default value is `/home/zowe/keystore`. -- `ZWE_PRIVATE_CONTAINER_LOG_DIRECTORY` is the directory of logs in Kubernetes deployment. Default value is `/home/zowe/logs`. +- `ZWE_PRIVATE_CONTAINER_LOG_DIRECTORY` is the directory of logs in Kubernetes deployment. Default value is `/home/zowe/instance/logs`. - `ZWE_PRIVATE_CONTAINER_RUNTIME_DIRECTORY` is the directory of Zowe runtime in Kubernetes deployment. Default value is `/home/zowe/runtime`. -- `ZWE_PRIVATE_CONTAINER_WORKSPACE_DIRECTORY` is the directory of workspace in Kubernetes deployment. Default value is `/home/zowe/workspace`. +- `ZWE_PRIVATE_CONTAINER_WORKSPACE_DIRECTORY` is the directory of workspace in Kubernetes deployment. Default value is `/home/zowe/instance/workspace`. - `ZWE_PRIVATE_CORE_COMPONENTS_REQUIRE_JAVA` is a list of java components shipped with Zowe. - `ZWE_PRIVATE_DEFAULT_ADMIN_GROUP` is the default Zowe admin group. Default value is `ZWEADMIN`. - `ZWE_PRIVATE_DEFAULT_AUX_STC` is the default name of Zowe Auxiliary Server started task. Default value is `ZWESASTC`. @@ -133,9 +133,9 @@ For examples: - `ZWE_zowe_runtimeDirectory`, parent directory of where `zwe` server command is located. - `ZWE_zowe_workspaceDirectory` is the path of user customized workspace directory. -- `ZWE_zowe_setup_mvs_hlq` is the high level qualifier where Zowe MVS data sets are installed. -- `ZWE_zowe_setup_mvs_parmlib` is the data set that end-user configured to store his customized version of parameter library members. -- `ZWE_zowe_setup_mvs_authPluginLib` is the data set that end-user configured to store his APF authorized ZIS plugins load library. +- `ZWE_zowe_setup_dataset_prefix` is the dataset prefix where Zowe MVS data sets are installed. +- `ZWE_zowe_setup_dataset_parmlib` is the data set that end-user configured to store his customized version of parameter library members. +- `ZWE_zowe_setup_dataset_authPluginLib` is the data set that end-user configured to store his APF authorized ZIS plugins load library. - `ZWE_zowe_setup_security_users_zowe` is the name of Zowe runtime user. - `ZWE_configs_port` is your component port number you can use in your start script. It points to the value of `haInstances..components..port`, or fall back to `components..port`, or fall back to `configs.port` defined in your component manifest. diff --git a/bin/commands/.errors b/bin/commands/.errors index beafadbadf..e4840cb29b 100644 --- a/bin/commands/.errors +++ b/bin/commands/.errors @@ -1,4 +1,4 @@ -|100|If the user pass `--help` or `-h` parameter, the zwe command always exits with `100` code. +||100|If the user pass `--help` or `-h` parameter, the zwe command always exits with `100` code. ZWEL0101E|101|ZWE_zowe_runtimeDirectory is not defined. ZWEL0102E|102|Invalid parameter %s. ZWEL0103E|103|Invalid type of parameter %s. diff --git a/bin/commands/certificate/.examples b/bin/commands/certificate/.examples index 5b03c25ed4..8bbffda262 100644 --- a/bin/commands/certificate/.examples +++ b/bin/commands/certificate/.examples @@ -1,3 +1,3 @@ -zwe certificate keyring-jcl clean --hlq my-hlq --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -a certificate-alias -ca ca-alias +zwe certificate keyring-jcl clean --dataset-prefix my-dataset-prefix --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -a certificate-alias -ca ca-alias zwe certificate verify-service --host service-hostname --port service-port diff --git a/bin/commands/certificate/keyring-jcl/.examples b/bin/commands/certificate/keyring-jcl/.examples index 6fcc921de9..ffda4b8d9b 100644 --- a/bin/commands/certificate/keyring-jcl/.examples +++ b/bin/commands/certificate/keyring-jcl/.examples @@ -1,3 +1,3 @@ -zwe certificate keyring-jcl clean --hlq my-hlq --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -a certificate-alias -ca ca-alias +zwe certificate keyring-jcl clean --dataset-prefix my-dataset-prefix --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -a certificate-alias -ca ca-alias -zwe certificate keyring-jcl connect --hlq my-hlq --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name --connect-user cert-owner --connect-label cert-label +zwe certificate keyring-jcl connect --dataset-prefix my-dataset-prefix --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name --connect-user cert-owner --connect-label cert-label diff --git a/bin/commands/certificate/keyring-jcl/clean/.examples b/bin/commands/certificate/keyring-jcl/clean/.examples index 2365d44e9e..12b82ea995 100644 --- a/bin/commands/certificate/keyring-jcl/clean/.examples +++ b/bin/commands/certificate/keyring-jcl/clean/.examples @@ -1 +1 @@ -zwe certificate keyring-jcl clean --hlq my-hlq --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -a certificate-alias -ca ca-alias +zwe certificate keyring-jcl clean --dataset-prefix my-dataset-prefix --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -a certificate-alias -ca ca-alias diff --git a/bin/commands/certificate/keyring-jcl/clean/.parameters b/bin/commands/certificate/keyring-jcl/clean/.parameters index 42a79996cc..9f4cd2be15 100644 --- a/bin/commands/certificate/keyring-jcl/clean/.parameters +++ b/bin/commands/certificate/keyring-jcl/clean/.parameters @@ -1,4 +1,4 @@ -hlq||string|required||||High level qualifier where Zowe is installed. +dataset-prefix,ds-prefix||string|required||||Dataset prefix where Zowe is installed. jcllib||string|required||||JCLLIB data set name where the JCL will be placed. security-dry-run||boolean|||||Whether to dry run security related setup. security-product||string||RACF|||Security product. Can be a value of RACF, ACF2 or TSS. diff --git a/bin/commands/certificate/keyring-jcl/clean/index.sh b/bin/commands/certificate/keyring-jcl/clean/index.sh index ce27224148..234773b7e8 100644 --- a/bin/commands/certificate/keyring-jcl/clean/index.sh +++ b/bin/commands/certificate/keyring-jcl/clean/index.sh @@ -22,7 +22,7 @@ print_level1_message "Remove Zowe keyring" ############################### # run ZWENOKYR JCL keyring_run_zwenokyr_jcl \ - "${ZWE_CLI_PARAMETER_HLQ}" \ + "${ZWE_CLI_PARAMETER_DATASET_PREFIX}" \ "${ZWE_CLI_PARAMETER_JCLLIB}" \ "${ZWE_CLI_PARAMETER_KEYRING_OWNER}" \ "${ZWE_CLI_PARAMETER_KEYRING_NAME}" \ diff --git a/bin/commands/certificate/keyring-jcl/connect/.examples b/bin/commands/certificate/keyring-jcl/connect/.examples index 3aa5cf7baf..75ec5078f8 100644 --- a/bin/commands/certificate/keyring-jcl/connect/.examples +++ b/bin/commands/certificate/keyring-jcl/connect/.examples @@ -1 +1 @@ -zwe certificate keyring-jcl connect --hlq my-hlq --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name --connect-user cert-owner --connect-label cert-label +zwe certificate keyring-jcl connect --dataset-prefix my-dataset-prefix --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name --connect-user cert-owner --connect-label cert-label diff --git a/bin/commands/certificate/keyring-jcl/connect/.parameters b/bin/commands/certificate/keyring-jcl/connect/.parameters index 1563c5e0be..dbbb1dd6cd 100644 --- a/bin/commands/certificate/keyring-jcl/connect/.parameters +++ b/bin/commands/certificate/keyring-jcl/connect/.parameters @@ -1,4 +1,4 @@ -hlq||string|required||||High level qualifier where Zowe is installed. +dataset-prefix,ds-prefix||string|required||||Dataset prefix where Zowe is installed. jcllib||string|required||||JCLLIB data set name where the JCL will be placed. security-dry-run||boolean|||||Whether to dry run security related setup. security-product||string||RACF|||Security product. Can be a value of RACF, ACF2 or TSS. diff --git a/bin/commands/certificate/keyring-jcl/connect/index.sh b/bin/commands/certificate/keyring-jcl/connect/index.sh index 68650248b3..7502ea7414 100644 --- a/bin/commands/certificate/keyring-jcl/connect/index.sh +++ b/bin/commands/certificate/keyring-jcl/connect/index.sh @@ -23,7 +23,7 @@ print_level1_message "Connect existing certificate to Zowe keyring" # run ZWEKRING JCL ZWE_PRIVATE_ZOSMF_USER="${ZWE_CLI_PARAMETER_ZOSMF_USER}" \ keyring_run_zwekring_jcl \ - "${ZWE_CLI_PARAMETER_HLQ}" \ + "${ZWE_CLI_PARAMETER_DATASET_PREFIX}" \ "${ZWE_CLI_PARAMETER_JCLLIB}" \ 2 \ "${ZWE_CLI_PARAMETER_KEYRING_OWNER}" \ diff --git a/bin/commands/certificate/keyring-jcl/generate/.examples b/bin/commands/certificate/keyring-jcl/generate/.examples index a6af8d1a0b..b7dcd586c7 100644 --- a/bin/commands/certificate/keyring-jcl/generate/.examples +++ b/bin/commands/certificate/keyring-jcl/generate/.examples @@ -1 +1 @@ -zwe certificate keyring-jcl generate --hlq my-hlq --jcllib my-jcllib --security-dry-run --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -d my-domain -a certificate-alias -ca ca-alias +zwe certificate keyring-jcl generate --dataset-prefix my-dataset-prefix --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -d my-domain -a certificate-alias -ca ca-alias diff --git a/bin/commands/certificate/keyring-jcl/generate/.parameters b/bin/commands/certificate/keyring-jcl/generate/.parameters index 214eeae714..cf34c69309 100644 --- a/bin/commands/certificate/keyring-jcl/generate/.parameters +++ b/bin/commands/certificate/keyring-jcl/generate/.parameters @@ -1,4 +1,4 @@ -hlq||string|required||||High level qualifier where Zowe is installed. +dataset-prefix,ds-prefix||string|required||||Dataset prefix where Zowe is installed. jcllib||string|required||||JCLLIB data set name where the JCL will be placed. security-dry-run||boolean|||||Whether to dry run security related setup. security-product||string||RACF|||Security product. Can be a value of RACF, ACF2 or TSS. diff --git a/bin/commands/certificate/keyring-jcl/generate/index.sh b/bin/commands/certificate/keyring-jcl/generate/index.sh index a861cca353..1f5c4dbf85 100644 --- a/bin/commands/certificate/keyring-jcl/generate/index.sh +++ b/bin/commands/certificate/keyring-jcl/generate/index.sh @@ -29,7 +29,7 @@ ZWE_PRIVATE_CERTIFICATE_CA_ORG_UNIT="${ZWE_CLI_PARAMETER_ORG_UNIT}" \ ZWE_PRIVATE_CERTIFICATE_CA_VALIDITY="${ZWE_CLI_PARAMETER_VALIDITY}" \ ZWE_PRIVATE_ZOSMF_USER="${ZWE_CLI_PARAMETER_ZOSMF_USER}" \ keyring_run_zwekring_jcl \ - "${ZWE_CLI_PARAMETER_HLQ}" \ + "${ZWE_CLI_PARAMETER_DATASET_PREFIX}" \ "${ZWE_CLI_PARAMETER_JCLLIB}" \ 1 \ "${ZWE_CLI_PARAMETER_KEYRING_OWNER}" \ diff --git a/bin/commands/certificate/keyring-jcl/import-ds/.examples b/bin/commands/certificate/keyring-jcl/import-ds/.examples index 5fe61d5328..82be8a3546 100644 --- a/bin/commands/certificate/keyring-jcl/import-ds/.examples +++ b/bin/commands/certificate/keyring-jcl/import-ds/.examples @@ -1 +1 @@ -zwe certificate keyring-jcl import-ds --hlq my-hlq --jcllib my-jcllib --security-dry-run --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -a certificate-alias --import-ds-name my-ds-name --import-ds-password my-ds-password +zwe certificate keyring-jcl import-ds --dataset-prefix my-dataset-prefix --jcllib my-jcllib --security-dry-run --keyring-owner my-keyring-owner --keyring-name my-keyring-name -a certificate-alias --import-ds-name my-ds-name --import-ds-password my-ds-password diff --git a/bin/commands/certificate/keyring-jcl/import-ds/.parameters b/bin/commands/certificate/keyring-jcl/import-ds/.parameters index 2739a123d3..6abee1c1dd 100644 --- a/bin/commands/certificate/keyring-jcl/import-ds/.parameters +++ b/bin/commands/certificate/keyring-jcl/import-ds/.parameters @@ -1,4 +1,4 @@ -hlq||string|required||||High level qualifier where Zowe is installed. +dataset-prefix,ds-prefix||string|required||||Dataset prefix where Zowe is installed. jcllib||string|required||||JCLLIB data set name where the JCL will be placed. security-dry-run||boolean|||||Whether to dry run security related setup. security-product||string||RACF|||Security product. Can be a value of RACF, ACF2 or TSS. diff --git a/bin/commands/certificate/keyring-jcl/import-ds/index.sh b/bin/commands/certificate/keyring-jcl/import-ds/index.sh index 297d73af9c..4bfc0f32ba 100644 --- a/bin/commands/certificate/keyring-jcl/import-ds/index.sh +++ b/bin/commands/certificate/keyring-jcl/import-ds/index.sh @@ -23,7 +23,7 @@ print_level1_message "Import certificate to Zowe keyring" # run ZWEKRING JCL ZWE_PRIVATE_ZOSMF_USER="${ZWE_CLI_PARAMETER_ZOSMF_USER}" \ keyring_run_zwekring_jcl \ - "${ZWE_CLI_PARAMETER_HLQ}" \ + "${ZWE_CLI_PARAMETER_DATASET_PREFIX}" \ "${ZWE_CLI_PARAMETER_JCLLIB}" \ 3 \ "${ZWE_CLI_PARAMETER_KEYRING_OWNER}" \ diff --git a/bin/commands/init/.help b/bin/commands/init/.help index b54cf13dba..f57b3ef2eb 100644 --- a/bin/commands/init/.help +++ b/bin/commands/init/.help @@ -31,8 +31,8 @@ These Zowe YAML configurations showing with sample values are used: ```yaml zowe: setup: - mvs: - hlq: IBMUSER.ZWE + dataset: + prefix: IBMUSER.ZWE parmlib: IBMUSER.ZWE.CUST.PARMLIB jcllib: IBMUSER.ZWE.CUST.JCLLIB authLoadlib: IBMUSER.ZWE.CUST.ZWESALL @@ -63,6 +63,7 @@ zowe: validity: 3650 pkcs12: directory: /global/zowe/keystore + lock: true name: localhost password: password caAlias: local_ca @@ -110,16 +111,16 @@ components: name: IBMUSER.ZWE.CUST.CACHE2 ``` -- `zowe.setup.mvs.hlq` shows where the `SZWEAUTH` data set is installed. -- `zowe.setup.mvs.parmlib` is the user custom parameter library. Zowe server +- `zowe.setup.dataset.prefix` shows where the `SZWEAUTH` data set is installed. +- `zowe.setup.dataset.parmlib` is the user custom parameter library. Zowe server command may generate sample PARMLIB members and stores here. -- `zowe.setup.mvs.jcllib` is the custom JCL library. Zowe server command may +- `zowe.setup.dataset.jcllib` is the custom JCL library. Zowe server command may generate sample JCLs and put into this data set. -- `zowe.setup.mvs.authLoadlib` is the user custom APF LOADLIB. This field is +- `zowe.setup.dataset.authLoadlib` is the user custom APF LOADLIB. This field is optional. If this is defined, members of `SZWEAUTH` will be copied over to this data set and it will be APF authorized. If it's not defined, `SZWEAUTH` - from HLQ will be APF authorized. -- `zowe.setup.mvs.authPluginLib` is the user custom APF PLUGINLIB. + from `zowe.setup.dataset.prefix` data set will be APF authorized. +- `zowe.setup.dataset.authPluginLib` is the user custom APF PLUGINLIB. You can install Zowe ZIS plugins into this load library. This loadlib requires APF authorize. @@ -165,6 +166,9 @@ components: - `zowe.setup.certificate.pkcs12.directory` is the directory where you plan to store the PKCS12 keystore and truststore. This is required if `zowe.setup.certificate.type` is `PKCS12`. +- `zowe.setup.certificate.pkcs12.lock` is a boolean configuration to tell if we + should lock the PKCS12 keystore directory only for Zowe runtime user and group. + Default value is true. - You can also define `name`, `password`, `caAlias` and `caPassword` under `zowe.setup.certificate.pkcs12` to customized keystore and truststore. These configurations are optional, but it is recommended to update them from diff --git a/bin/commands/init/apfauth/.help b/bin/commands/init/apfauth/.help index e9495199c0..129ab6f46d 100644 --- a/bin/commands/init/apfauth/.help +++ b/bin/commands/init/apfauth/.help @@ -7,14 +7,15 @@ These Zowe YAML configurations showing with sample values are used: ``` zowe: setup: - mvs: - hlq: IBMUSER.ZWE + dataset: + prefix: IBMUSER.ZWE authLoadlib: IBMUSER.ZWE.CUST.ZWESALL authPluginLib: IBMUSER.ZWE.CUST.ZWESAPL ``` -- `zowe.setup.mvs.hlq` shows where the `SZWEAUTH` data set is installed. -- `zowe.setup.mvs.authLoadlib` is the user custom APF LOADLIB. This field is - optional. If it's not defined, `SZWEAUTH` from HLQ will be APF authorized. -- `zowe.setup.mvs.authPluginLib` is the user custom APF PLUGINLIB. +- `zowe.setup.dataset.prefix` shows where the `SZWEAUTH` data set is installed. +- `zowe.setup.dataset.authLoadlib` is the user custom APF LOADLIB. This field is + optional. If it's not defined, `SZWEAUTH` from `zowe.setup.dataset.prefix` data + set will be APF authorized. +- `zowe.setup.dataset.authPluginLib` is the user custom APF PLUGINLIB. You can install Zowe ZIS plugins into this load library. diff --git a/bin/commands/init/apfauth/index.sh b/bin/commands/init/apfauth/index.sh index fa0e4f321c..8af851bbd5 100644 --- a/bin/commands/init/apfauth/index.sh +++ b/bin/commands/init/apfauth/index.sh @@ -21,23 +21,23 @@ auth_libs="authLoadlib authPluginLib" # validation require_zowe_yaml -# read HLQ and validate -hlq=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.hlq") -if [ -z "${hlq}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe high level qualifier (zowe.setup.mvs.hlq) is not defined in Zowe YAML configuration file." "" 157 +# read prefix and validate +prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") +if [ -z "${prefix}" ]; then + print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157 fi ############################### # APF authorize loadlib for key in ${auth_libs}; do # read def and validate - ds=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.${key}") + ds=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.${key}") if [ -z "${ds}" ]; then # authLoadlib can be empty if [ "${key}" = "authLoadlib" ]; then - ds="${hlq}.${ZWE_PRIVATE_DS_SZWEAUTH}" + ds="${prefix}.${ZWE_PRIVATE_DS_SZWEAUTH}" else - print_error_and_exit "Error ZWEL0157E: ${name} (zowe.setup.mvs.${key}) is not defined in Zowe YAML configuration file." "" 157 + print_error_and_exit "Error ZWEL0157E: ${name} (zowe.setup.dataset.${key}) is not defined in Zowe YAML configuration file." "" 157 fi fi diff --git a/bin/commands/init/certificate/.help b/bin/commands/init/certificate/.help index bf7457aae2..90a5307871 100644 --- a/bin/commands/init/certificate/.help +++ b/bin/commands/init/certificate/.help @@ -10,8 +10,8 @@ These Zowe YAML configurations showing with sample values are used: ``` zowe: setup: - mvs: - hlq: IBMUSER.ZWE + dataset: + prefix: IBMUSER.ZWE jcllib: IBMUSER.ZWE.CUST.JCLLIB security: product: RACF @@ -32,6 +32,7 @@ zowe: validity: 3650 pkcs12: directory: /global/zowe/keystore + lock: true name: localhost password: password caAlias: local_ca @@ -98,6 +99,9 @@ zOSMF: - `zowe.setup.certificate.pkcs12.directory` is the directory where you plan to store the PKCS12 keystore and truststore. This is required if `zowe.setup.certificate.type` is `PKCS12`. +- `zowe.setup.certificate.pkcs12.lock` is a boolean configuration to tell if we + should lock the PKCS12 keystore directory only for Zowe runtime user and group. + Default value is true. - `zowe.setup.security.groups.admin` and `zowe.setup.security.users.zowe` will be the default owner of keystore directory. - You can also define `name`, `password`, `caAlias` and `caPassword` under diff --git a/bin/commands/init/certificate/index.sh b/bin/commands/init/certificate/index.sh index fa554231da..66507d981b 100644 --- a/bin/commands/init/certificate/index.sh +++ b/bin/commands/init/certificate/index.sh @@ -16,15 +16,15 @@ require_zowe_yaml ############################### -# read HLQ and validate -hlq=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.hlq") -if [ -z "${hlq}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe high level qualifier (zowe.setup.mvs.hlq) is not defined in Zowe YAML configuration file." "" 157 +# read prefix and validate +prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") +if [ -z "${prefix}" ]; then + print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157 fi # read JCL library and validate -jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.jcllib") +jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.jcllib") if [ -z "${jcllib}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe custom JCL library (zowe.setup.mvs.jcllib) is not defined in Zowe YAML configuration file." "" 157 + print_error_and_exit "Error ZWEL0157E: Zowe custom JCL library (zowe.setup.dataset.jcllib) is not defined in Zowe YAML configuration file." "" 157 fi security_product=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.security.product") security_users_zowe=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.security.users.zowe") @@ -47,7 +47,7 @@ done cert_validity=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.certificate.validity") if [ "${cert_type}" = "PKCS12" ]; then # read keystore info - for item in directory name password caAlias caPassword; do + for item in directory lock name password caAlias caPassword; do var_name="pkcs12_${item}" var_val=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.certificate.pkcs12.${item}") eval "${var_name}=\"${var_val}\"" @@ -285,12 +285,14 @@ if [ "${cert_type}" = "PKCS12" ]; then # lock keystore directory with proper permission # - group permission is none - zwecli_inline_execute_command \ - certificate pkcs12 lock \ - --keystore-dir "${pkcs12_directory}" \ - --user "${security_users_zowe}" \ - --group "${security_groups_admin}" \ - --group-permission none + if [ "$(lower_case "${pkcs12_directory}")" != "false" ]; then + zwecli_inline_execute_command \ + certificate pkcs12 lock \ + --keystore-dir "${pkcs12_directory}" \ + --user "${security_users_zowe}" \ + --group "${security_groups_admin}" \ + --group-permission none + fi # update zowe.yaml if [ "${ZWE_CLI_PARAMETER_UPDATE_CONFIG}" = "true" ]; then @@ -338,7 +340,7 @@ elif [ "${cert_type}" = "JCERACFKS" ]; then zwecli_inline_execute_command \ certificate keyring-jcl clean \ - --hlq "${hlq}" \ + --dataset-prefix "${prefix}" \ --jcllib "${jcllib}" \ --keyring-owner "${keyring_owner}" \ --keyring-name "${keyring_name}" \ @@ -356,7 +358,7 @@ elif [ "${cert_type}" = "JCERACFKS" ]; then # generate new cert in keyring zwecli_inline_execute_command \ certificate keyring-jcl generate \ - --hlq "${hlq}" \ + --dataset-prefix "${prefix}" \ --jcllib "${jcllib}" \ --keyring-owner "${keyring_owner}" \ --keyring-name "${keyring_name}" \ @@ -384,7 +386,7 @@ elif [ "${cert_type}" = "JCERACFKS" ]; then # connect existing certs to zowe keyring zwecli_inline_execute_command \ certificate keyring-jcl connect \ - --hlq "${hlq}" \ + --dataset-prefix "${prefix}" \ --jcllib "${jcllib}" \ --keyring-owner "${keyring_owner}" \ --keyring-name "${keyring_name}" \ @@ -402,7 +404,7 @@ elif [ "${cert_type}" = "JCERACFKS" ]; then # import certs from data set into zowe keyring zwecli_inline_execute_command \ certificate keyring-jcl import-ds \ - --hlq "${hlq}" \ + --dataset-prefix "${prefix}" \ --jcllib "${jcllib}" \ --keyring-owner "${keyring_owner}" \ --keyring-name "${keyring_name}" \ @@ -415,7 +417,7 @@ elif [ "${cert_type}" = "JCERACFKS" ]; then --zosmf-ca "${zosmf_ca}" \ --zosmf-user "${zosmf_user}" # FIXME: currently ZWEKRING jcl will import the cert and chain, CA will also be added to CERTAUTH, but the CA will not be connected to keyring. - # the CA imported could have lable like LABEL00000001. + # the CA imported could have label like LABEL00000001. yaml_keyring_label="${keyring_label}" ;; @@ -443,12 +445,12 @@ EOF update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.keystore.type" "JCERACFKS" update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.keystore.file" "safkeyring:////${keyring_owner}/${keyring_name}" # we must set a dummy value here, other JDK will complain wrong parameter - update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.keystore.password" "dummy" + update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.keystore.password" "password" update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.keystore.alias" "${yaml_keyring_label}" update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.truststore.type" "JCERACFKS" update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.truststore.file" "safkeyring:////${keyring_owner}/${keyring_name}" # we must set a dummy value here, other JDK will complain wrong parameter - update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.truststore.password" "dummy" + update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.truststore.password" "password" update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.pem.key" "" update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.pem.certificate" "" update_zowe_yaml "${ZWE_CLI_PARAMETER_CONFIG}" "zowe.certificate.pem.certificateAuthorities" "${yaml_pem_cas}" @@ -462,12 +464,12 @@ EOF print_message " keystore:" print_message " type: JCERACFKS" print_message " file: \"safkeyring:////${keyring_owner}/${keyring_name}\"" - print_message " password: \"dummy\"" + print_message " password: \"password\"" print_message " alias: \"${yaml_keyring_label}\"" print_message " truststore:" print_message " type: JCERACFKS" print_message " file: \"safkeyring:////${keyring_owner}/${keyring_name}\"" - print_message " password: \"dummy\"" + print_message " password: \"password\"" print_message " pem:" print_message " key: \"\"" print_message " certificate: \"\"" diff --git a/bin/commands/init/mvs/.help b/bin/commands/init/mvs/.help index 8b700ff853..12db46d6b9 100644 --- a/bin/commands/init/mvs/.help +++ b/bin/commands/init/mvs/.help @@ -5,28 +5,28 @@ These Zowe YAML configurations showing with sample values are used: ``` zowe: setup: - mvs: - hlq: IBMUSER.ZWE + dataset: + prefix: IBMUSER.ZWE parmlib: IBMUSER.ZWE.CUST.PARMLIB jcllib: IBMUSER.ZWE.CUST.JCLLIB authLoadlib: IBMUSER.ZWE.CUST.ZWESALL authPluginLib: IBMUSER.ZWE.CUST.ZWESAPL ``` -`zowe.setup.mvs.hlq` shows where the `SZWESAMP` and `SZWEAUTH` data sets are +`zowe.setup.dataset.prefix` shows where the `SZWESAMP` and `SZWEAUTH` data sets are installed. Below data sets will be initialized by this command: -- `zowe.setup.mvs.parmlib` is the user custom parameter library. Zowe server +- `zowe.setup.dataset.parmlib` is the user custom parameter library. Zowe server command may generate sample PARMLIB members and stores here. -- `zowe.setup.mvs.jcllib` is the custom JCL library. Zowe server command may +- `zowe.setup.dataset.jcllib` is the custom JCL library. Zowe server command may generate sample JCLs and put into this data set. -- `zowe.setup.mvs.authLoadlib` is the user custom APF LOADLIB. This field is +- `zowe.setup.dataset.authLoadlib` is the user custom APF LOADLIB. This field is optional. If this is defined, members of `SZWEAUTH` will be copied over to this data set. This loadlib requires APF authorize. -- `zowe.setup.mvs.authPluginLib` is the user custom APF PLUGINLIB. +- `zowe.setup.dataset.authPluginLib` is the user custom APF PLUGINLIB. You can install Zowe ZIS plugins into this load library. This loadlib requires APF authorize. diff --git a/bin/commands/init/mvs/index.sh b/bin/commands/init/mvs/index.sh index a698a895e5..282690c210 100644 --- a/bin/commands/init/mvs/index.sh +++ b/bin/commands/init/mvs/index.sh @@ -24,10 +24,10 @@ authPluginLib|Zowe authorized plugin library|dsntype(library) dsorg(po) recfm(u) # validation require_zowe_yaml -# read HLQ and validate -hlq=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.hlq") -if [ -z "${hlq}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe high level qualifier (zowe.setup.mvs.hlq) is not defined in Zowe YAML configuration file." "" 157 +# read prefix and validate +prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") +if [ -z "${prefix}" ]; then + print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157 fi ############################### @@ -39,13 +39,13 @@ while read -r line; do spec=$(echo "${line}" | awk -F"|" '{print $3}') # read def and validate - ds=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.${key}") + ds=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.${key}") if [ -z "${ds}" ]; then # authLoadlib can be empty if [ "${key}" = "authLoadlib" ]; then continue else - print_error_and_exit "Error ZWEL0157E: ${name} (zowe.setup.mvs.${key}) is not defined in Zowe YAML configuration file." "" 157 + print_error_and_exit "Error ZWEL0157E: ${name} (zowe.setup.dataset.${key}) is not defined in Zowe YAML configuration file." "" 157 fi fi # check existence @@ -76,10 +76,10 @@ if [ "${ds_existence}" = "true" ] && [ "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" ! else ############################### # copy sample lib members - parmlib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.parmlib") + parmlib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.parmlib") for ds in ZWESIP00; do - print_message "Copy ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(${ds}) to ${parmlib}(${ds})" - data_set_copy_to_data_set "${hlq}" "${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(${ds})" "${parmlib}(${ds})" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + print_message "Copy ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(${ds}) to ${parmlib}(${ds})" + data_set_copy_to_data_set "${prefix}" "${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(${ds})" "${parmlib}(${ds})" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi @@ -88,11 +88,11 @@ else ############################### # copy auth lib members # FIXME: data_set_copy_to_data_set cannot be used to copy program? - authLoadlib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.authLoadlib") + authLoadlib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.authLoadlib") if [ -n "${authLoadlib}" ]; then for ds in ZWESIS01 ZWESAUX; do print_message "Copy components/zss/LOADLIB/${ds} to ${authLoadlib}(${ds})" - # data_set_copy_to_data_set "${hlq}" "${hlq}.${ZWE_PRIVATE_DS_SZWEAUTH}(${ds})" "${authLoadlib}(${ds})" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + # data_set_copy_to_data_set "${prefix}" "${prefix}.${ZWE_PRIVATE_DS_SZWEAUTH}(${ds})" "${authLoadlib}(${ds})" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" copy_to_data_set "${ZWE_zowe_runtimeDirectory}/components/zss/LOADLIB/${ds}" "${authLoadlib}(${ds})" "-X" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 @@ -100,7 +100,7 @@ else done for ds in ZWELNCH; do print_message "Copy components/launcher/bin/zowe_launcher to ${authLoadlib}(${ds})" - # data_set_copy_to_data_set "${hlq}" "${hlq}.${ZWE_PRIVATE_DS_SZWEAUTH}(${ds})" "${authLoadlib}(${ds})" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + # data_set_copy_to_data_set "${prefix}" "${prefix}.${ZWE_PRIVATE_DS_SZWEAUTH}(${ds})" "${authLoadlib}(${ds})" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" copy_to_data_set "${ZWE_zowe_runtimeDirectory}/components/launcher/bin/zowe_launcher" "${authLoadlib}(${ds})" "-X" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 diff --git a/bin/commands/init/security/.help b/bin/commands/init/security/.help index 3370e098ee..205be360aa 100644 --- a/bin/commands/init/security/.help +++ b/bin/commands/init/security/.help @@ -7,8 +7,8 @@ These Zowe YAML configurations showing with sample values are used: ``` zowe: setup: - mvs: - hlq: IBMUSER.ZWE + dataset: + prefix: IBMUSER.ZWE jcllib: IBMUSER.ZWE.CUST.JCLLIB security: product: RACF @@ -25,8 +25,8 @@ zowe: aux: ZWESASTC ``` -- `zowe.setup.mvs.hlq` shows where the `SZWESAMP` data set is installed, -- `zowe.setup.mvs.jcllib` is the custom JCL library. Zowe will create customized +- `zowe.setup.dataset.prefix` shows where the `SZWESAMP` data set is installed, +- `zowe.setup.dataset.jcllib` is the custom JCL library. Zowe will create customized ZWESECUR JCL here before applying it. - `zowe.setup.security.product` is security product. Can be `RACF`, `ACF2`, or `TSS`. This configuration is optional. Default value is `RACF`. diff --git a/bin/commands/init/security/index.sh b/bin/commands/init/security/index.sh index 6ac47e1eb8..1772041666 100644 --- a/bin/commands/init/security/index.sh +++ b/bin/commands/init/security/index.sh @@ -20,15 +20,15 @@ print_level1_message "Run Zowe security configurations" # validation require_zowe_yaml -# read HLQ and validate -hlq=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.hlq") -if [ -z "${hlq}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe HLQ (zowe.setup.mvs.hlq) is not defined in Zowe YAML configuration file." "" 157 +# read prefix and validate +prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") +if [ -z "${prefix}" ]; then + print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157 fi # read JCL library and validate -jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.jcllib") +jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.jcllib") if [ -z "${jcllib}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe custom JCL library (zowe.setup.mvs.jcllib) is not defined in Zowe YAML configuration file." "" 157 + print_error_and_exit "Error ZWEL0157E: Zowe custom JCL library (zowe.setup.dataset.jcllib) is not defined in Zowe YAML configuration file." "" 157 fi security_product=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.security.product") if [ -z "${security_product}" ]; then @@ -72,9 +72,9 @@ fi print_message "Modify ZWESECUR" tmpfile=$(create_tmp_file $(echo "zwe ${ZWE_CLI_COMMANDS_LIST}" | sed "s# #-#g")) tmpdsm=$(create_data_set_tmp_member "${jcllib}" "ZW$(date +%H%M)") -print_debug "- Copy ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESECUR) to ${tmpfile}" +print_debug "- Copy ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESECUR) to ${tmpfile}" # cat "//'IBMUSER.ZWEV2.SZWESAMP(ZWESECUR)'" | sed "s/^\\/\\/ \\+SET \\+PRODUCT=.*\\$/\\/\\ SET PRODUCT=ACF2 * RACF, ACF2, or TSS/" -result=$(cat "//'${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESECUR)'" | \ +result=$(cat "//'${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESECUR)'" | \ sed "s/^\/\/ \+SET \+PRODUCT=.*\$/\/\/ SET PRODUCT=${security_product}/" | \ sed "s/^\/\/ \+SET \+ADMINGRP=.*\$/\/\/ SET ADMINGRP=${security_groups_admin}/" | \ sed "s/^\/\/ \+SET \+STCGRP=.*\$/\/\/ SET STCGRP=${security_groups_stc}/" | \ @@ -83,7 +83,7 @@ result=$(cat "//'${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESECUR)'" | \ sed "s/^\/\/ \+SET \+ZOWESTC=.*\$/\/\/ SET ZOWESTC=${security_stcs_zowe}/" | \ sed "s/^\/\/ \+SET \+ZISSTC=.*\$/\/\/ SET ZISSTC=${security_stcs_zis}/" | \ sed "s/^\/\/ \+SET \+AUXSTC=.*\$/\/\/ SET AUXSTC=${security_stcs_aux}/" | \ - sed "s/^\/\/ \+SET \+HLQ=.*\$/\/\/ SET HLQ=${hlq}/" | \ + sed "s/^\/\/ \+SET \+HLQ=.*\$/\/\/ SET HLQ=${prefix}/" | \ sed "s/^\/\/ \+SET \+SYSPROG=.*\$/\/\/ SET SYSPROG=${security_groups_sysProg}/" \ > "${tmpfile}") code=$? @@ -103,7 +103,7 @@ else fi fi if [ ! -f "${tmpfile}" ]; then - print_error_and_exit "Error ZWEL0159E: Failed to modify ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESECUR)" "" 159 + print_error_and_exit "Error ZWEL0159E: Failed to modify ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESECUR)" "" 159 fi print_trace "- ensure ${tmpfile} encoding before copying into data set" ensure_file_encoding "${tmpfile}" "SPDX-License-Identifier" diff --git a/bin/commands/init/stc/.errors b/bin/commands/init/stc/.errors index 391d5960df..4109f9bdf2 100644 --- a/bin/commands/init/stc/.errors +++ b/bin/commands/init/stc/.errors @@ -1,6 +1,7 @@ ZWEL0157E|157|%s (%s) is not defined in Zowe YAML configuration file. ZWEL0300W||%s already exists. This data set member will be overwritten during configuration. ZWEL0301W||%s already exists and will not be overwritten. For upgrades, you must use --allow-overwrite. +ZWEL0143E|143|Cannot find data set member %s. You may need to re-run `zwe install`. ZWEL0158E|158|%s already exists. ZWEL0159E|159|Failed to modify %s. ZWEL0160E|160|Failed to write to %s. Please check if target data set is opened by others. diff --git a/bin/commands/init/stc/.help b/bin/commands/init/stc/.help index 6638050900..8788282715 100644 --- a/bin/commands/init/stc/.help +++ b/bin/commands/init/stc/.help @@ -8,8 +8,8 @@ These Zowe YAML configurations showing with sample values are used: ``` zowe: setup: - mvs: - hlq: IBMUSER.ZWE + dataset: + prefix: IBMUSER.ZWE proclib: USER.PROCLIB parmlib: IBMUSER.ZWE.CUST.PARMLIB jcllib: IBMUSER.ZWE.CUST.JCLLIB @@ -21,15 +21,15 @@ zowe: aux: ZWESASTC ``` -- `zowe.setup.mvs.hlq` shows where the `SZWESAMP` data set is installed, -- `zowe.setup.mvs.proclib` shows what is the target procedure library. -- `zowe.setup.mvs.parmlib` is the user custom parameter library. Zowe server +- `zowe.setup.dataset.prefix` shows where the `SZWESAMP` data set is installed, +- `zowe.setup.dataset.proclib` shows what is the target procedure library. +- `zowe.setup.dataset.parmlib` is the user custom parameter library. Zowe server command may generate sample PARMLIB members and stores here. -- `zowe.setup.mvs.jcllib` is the custom JCL library. Zowe will create temporary +- `zowe.setup.dataset.jcllib` is the custom JCL library. Zowe will create temporary started tasks here before putting into target procedure library. -- `zowe.setup.mvs.authLoadlib` is the user custom APF LOADLIB. This field is - optional. If this is not defined, `SZWEAUTH` from HLQ will be used as STEPLIB - in STCs. +- `zowe.setup.dataset.authLoadlib` is the user custom APF LOADLIB. This field is + optional. If this is not defined, `SZWEAUTH` from `zowe.setup.dataset.prefix` + data set will be used as STEPLIB in STCs. - `zowe.setup.security.stcs.zowe` is Zowe started task name. This configuration is optional. Default value is `ZWESLSTC`. - `zowe.setup.security.stcs.zis` is ZIS started task name. diff --git a/bin/commands/init/stc/index.sh b/bin/commands/init/stc/index.sh index 541460ad81..1aaf1ab3a6 100644 --- a/bin/commands/init/stc/index.sh +++ b/bin/commands/init/stc/index.sh @@ -21,31 +21,31 @@ proclibs="ZWESLSTC ZWESISTC ZWESASTC" # validation require_zowe_yaml -# read HLQ and validate -hlq=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.hlq") -if [ -z "${hlq}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe HLQ (zowe.setup.mvs.hlq) is not defined in Zowe YAML configuration file." "" 157 +# read prefix and validate +prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") +if [ -z "${prefix}" ]; then + print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157 fi # read PROCLIB and validate -proclib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.proclib") +proclib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.proclib") if [ -z "${proclib}" ]; then - print_error_and_exit "Error ZWEL0157E: PROCLIB (zowe.setup.mvs.proclib) is not defined in Zowe YAML configuration file." "" 157 + print_error_and_exit "Error ZWEL0157E: PROCLIB (zowe.setup.dataset.proclib) is not defined in Zowe YAML configuration file." "" 157 fi # read JCL library and validate -jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.jcllib") +jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.jcllib") if [ -z "${jcllib}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe custom JCL library (zowe.setup.mvs.jcllib) is not defined in Zowe YAML configuration file." "" 157 + print_error_and_exit "Error ZWEL0157E: Zowe custom JCL library (zowe.setup.dataset.jcllib) is not defined in Zowe YAML configuration file." "" 157 fi # read PARMLIB and validate -parmlib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.parmlib") +parmlib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.parmlib") if [ -z "${parmlib}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe custom parameter library (zowe.setup.mvs.parmlib) is not defined in Zowe YAML configuration file." "" 157 + print_error_and_exit "Error ZWEL0157E: Zowe custom parameter library (zowe.setup.dataset.parmlib) is not defined in Zowe YAML configuration file." "" 157 fi # read LOADLIB and validate -authLoadlib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.authLoadlib") +authLoadlib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.authLoadlib") if [ -z "${authLoadlib}" ]; then # authLoadlib can be empty - authLoadlib="${hlq}.${ZWE_PRIVATE_DS_SZWEAUTH}" + authLoadlib="${prefix}.${ZWE_PRIVATE_DS_SZWEAUTH}" fi security_stcs_zowe=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.security.stcs.zowe") if [ -z "${security_stcs_zowe}" ]; then @@ -63,6 +63,14 @@ target_proclibs="${security_stcs_zowe} ${security_stcs_zis} ${security_stcs_aux} # check existence for mb in ${proclibs}; do + # source in SZWESAMP + samp_existence=$(is_data_set_exists "${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(${mb})") + if [ "${samp_existence}" != "true" ]; then + print_error_and_exit "Error ZWEL0143E: ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(${mb}) already exists. This data set member will be overwritten during configuration." "" 143 + fi +done +for mb in ${target_proclibs}; do + # JCL for preview purpose jcl_existence=$(is_data_set_exists "${jcllib}(${mb})") if [ "${jcl_existence}" = "true" ]; then if [ "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" = "true" ]; then @@ -75,6 +83,7 @@ for mb in ${proclibs}; do fi fi + # STCs in target proclib stc_existence=$(is_data_set_exists "${proclib}(${mb})") if [ "${stc_existence}" = "true" ]; then if [ "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" = "true" ]; then @@ -94,10 +103,10 @@ else ############################### # prepare STCs # ZWESLSTC - print_message "Modify ZWESLSTC" + print_message "Modify ZWESLSTC and save as ${jcllib}(${security_stcs_zowe})" tmpfile=$(create_tmp_file $(echo "zwe ${ZWE_CLI_COMMANDS_LIST}" | sed "s# #-#g")) - print_debug "- Copy ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESLSTC) to ${tmpfile}" - result=$(cat "//'${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESLSTC)'" | \ + print_debug "- Copy ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESLSTC) to ${tmpfile}" + result=$(cat "//'${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESLSTC)'" | \ sed "s/^\/\/STEPLIB .*\$/\/\/STEPLIB DD DSNAME=${authLoadlib},DISP=SHR/" | \ sed "s#^CONFIG=.*\$#CONFIG=${ZWE_CLI_PARAMETER_CONFIG}#" \ > "${tmpfile}") @@ -118,7 +127,7 @@ else fi fi if [ ! -f "${tmpfile}" ]; then - print_error_and_exit "Error ZWEL0159E: Failed to modify ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESLSTC)" "" 159 + print_error_and_exit "Error ZWEL0159E: Failed to modify ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESLSTC)" "" 159 fi print_trace "- ensure ${tmpfile} encoding before copying into data set" ensure_file_encoding "${tmpfile}" "SPDX-License-Identifier" @@ -133,10 +142,10 @@ else print_debug "- ${jcllib}(${security_stcs_zowe}) is prepared" # ZWESISTC - print_message "Modify ZWESISTC" + print_message "Modify ZWESISTC and save as ${jcllib}(${security_stcs_zis})" tmpfile=$(create_tmp_file $(echo "zwe ${ZWE_CLI_COMMANDS_LIST}" | sed "s# #-#g")) - print_debug "- Copy ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESISTC) to ${tmpfile}" - result=$(cat "//'${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESISTC)'" | \ + print_debug "- Copy ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESISTC) to ${tmpfile}" + result=$(cat "//'${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESISTC)'" | \ sed "s/^\/\/STEPLIB .*\$/\/\/STEPLIB DD DSNAME=${authLoadlib},DISP=SHR/" | \ sed "s/^\/\/PARMLIB .*\$/\/\/PARMLIB DD DSNAME=${parmlib},DISP=SHR/" \ > "${tmpfile}") @@ -158,7 +167,7 @@ else exit 1 fi if [ ! -f "${tmpfile}" ]; then - print_error_and_exit "Error ZWEL0159E: Failed to modify ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESISTC)" "" 159 + print_error_and_exit "Error ZWEL0159E: Failed to modify ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESISTC)" "" 159 fi print_trace "- ensure ${tmpfile} encoding before copying into data set" ensure_file_encoding "${tmpfile}" "SPDX-License-Identifier" @@ -173,10 +182,10 @@ else print_debug "- ${jcllib}(${security_stcs_zis}) is prepared" # ZWESASTC - print_message "Modify ZWESASTC" + print_message "Modify ZWESASTC and save as ${jcllib}(${security_stcs_aux})" tmpfile=$(create_tmp_file $(echo "zwe ${ZWE_CLI_COMMANDS_LIST}" | sed "s# #-#g")) - print_debug "- Copy ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESASTC) to ${tmpfile}" - result=$(cat "//'${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESASTC)'" | \ + print_debug "- Copy ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESASTC) to ${tmpfile}" + result=$(cat "//'${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESASTC)'" | \ sed "s/^\/\/STEPLIB .*\$/\/\/STEPLIB DD DSNAME=${authLoadlib},DISP=SHR/" \ > "${tmpfile}") code=$? @@ -197,7 +206,7 @@ else exit 1 fi if [ ! -f "${tmpfile}" ]; then - print_error_and_exit "Error ZWEL0159E: Failed to modify ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESASTC)" "" 159 + print_error_and_exit "Error ZWEL0159E: Failed to modify ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWESASTC)" "" 159 fi print_trace "- ensure ${tmpfile} encoding before copying into data set" ensure_file_encoding "${tmpfile}" "SPDX-License-Identifier" @@ -221,7 +230,7 @@ else # copy to proclib for mb in ${target_proclibs}; do print_message "Copy ${jcllib}(${mb}) to ${proclib}(${mb})" - data_set_copy_to_data_set "${hlq}" "${jcllib}(${mb})" "${proclib}(${mb})" "-X" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + data_set_copy_to_data_set "${prefix}" "${jcllib}(${mb})" "${proclib}(${mb})" "-X" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi diff --git a/bin/commands/init/vsam/.help b/bin/commands/init/vsam/.help index 1a45f1bcbd..fbcaf2694b 100644 --- a/bin/commands/init/vsam/.help +++ b/bin/commands/init/vsam/.help @@ -6,8 +6,8 @@ These Zowe YAML configurations showing with sample values are used: ``` zowe: setup: - mvs: - hlq: IBMUSER.ZWE + dataset: + prefix: IBMUSER.ZWE jcllib: IBMUSER.ZWE.CUST.JCLLIB vsam: mode: NONRLS @@ -21,8 +21,8 @@ components: name: IBMUSER.ZWE.CUST.CACHE2 ``` -- `zowe.setup.mvs.hlq` shows where the `SZWESAMP` data set is installed, -- `zowe.setup.mvs.jcllib` is the custom JCL library. Zowe will create customized +- `zowe.setup.dataset.prefix` shows where the `SZWESAMP` data set is installed, +- `zowe.setup.dataset.jcllib` is the custom JCL library. Zowe will create customized ZWESECUR JCL here before applying it. - `zowe.setup.vsam.mode` indicates whether the VSAM will utilize Record Level Sharing (RLS) services or not. Valid value is `RLS` or `NONRLS`. diff --git a/bin/commands/init/vsam/index.sh b/bin/commands/init/vsam/index.sh index edee9a7a48..9a8bdb1385 100644 --- a/bin/commands/init/vsam/index.sh +++ b/bin/commands/init/vsam/index.sh @@ -26,15 +26,15 @@ if [ "${caching_storage}" != "VSAM" ]; then return 0 fi -# read HLQ and validate -hlq=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.hlq") -if [ -z "${hlq}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe HLQ (zowe.setup.mvs.hlq) is not defined in Zowe YAML configuration file." "" 157 +# read prefix and validate +prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") +if [ -z "${prefix}" ]; then + print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157 fi # read JCL library and validate -jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.jcllib") +jcllib=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.jcllib") if [ -z "${jcllib}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe custom JCL library (zowe.setup.mvs.jcllib) is not defined in Zowe YAML configuration file." "" 157 + print_error_and_exit "Error ZWEL0157E: Zowe custom JCL library (zowe.setup.dataset.jcllib) is not defined in Zowe YAML configuration file." "" 157 fi vsam_mode=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.vsam.mode") if [ -z "${vsam_mode}" ]; then @@ -92,8 +92,8 @@ else # ZWESLSTC print_message "Modify ZWECSVSM" tmpfile=$(create_tmp_file $(echo "zwe ${ZWE_CLI_COMMANDS_LIST}" | sed "s# #-#g")) - print_debug "- Copy ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWECSVSM) to ${tmpfile}" - result=$(cat "//'${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWECSVSM)'" | \ + print_debug "- Copy ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWECSVSM) to ${tmpfile}" + result=$(cat "//'${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWECSVSM)'" | \ sed "s/^\/\/ \+SET \+MODE=.*\$/\/\/ SET MODE=${vsam_mode}/" | \ sed "/^\/\/ALLOC/,9999s/#dsname/${vsam_name}/g" | \ sed "/^\/\/ALLOC/,9999s/#volume/${vsam_volume}/g" | \ @@ -116,7 +116,7 @@ else fi fi if [ ! -f "${tmpfile}" ]; then - print_error_and_exit "Error ZWEL0159E: Failed to modify ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWECSVSM)" "" 159 + print_error_and_exit "Error ZWEL0159E: Failed to modify ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWECSVSM)" "" 159 fi print_trace "- ${tmpfile} created with content" print_trace "$(cat "${tmpfile}")" diff --git a/bin/commands/install/.help b/bin/commands/install/.help index a533c9002a..3e21d52635 100644 --- a/bin/commands/install/.help +++ b/bin/commands/install/.help @@ -9,13 +9,13 @@ These Zowe YAML configurations showing with sample values are used: ``` zowe: setup: - mvs: - hlq: IBMUSER.ZWE + dataset: + prefix: IBMUSER.ZWE ``` Expected outputs: -- Will create these data sets under `zowe.setup.mvs.hlq` definition: +- Will create these data sets under `zowe.setup.dataset.prefix` definition: * `SZWEAUTH` contains few Zowe load modules (++PROGRAM). * `SZWESAMP` contains several sample configurations. * `SZWEEXEC` contains few utilities used by Zowe. diff --git a/bin/commands/install/.parameters b/bin/commands/install/.parameters index d0ffe2705c..edb8c2512c 100644 --- a/bin/commands/install/.parameters +++ b/bin/commands/install/.parameters @@ -1,2 +1,2 @@ allow-overwrite,allow-overwritten||boolean|||||Allow overwritten existing MVS data set. -hlq||string|||||Install Zowe to this high level qualifier.\nIf you specify this value, --config is not required. +dataset-prefix,ds-prefix||string|||||Install Zowe to this dataset prefix.\nIf you specify this value, --config is not required. diff --git a/bin/commands/install/index.sh b/bin/commands/install/index.sh index 7fe4f51eda..c4d956a84a 100644 --- a/bin/commands/install/index.sh +++ b/bin/commands/install/index.sh @@ -21,15 +21,15 @@ ${ZWE_PRIVATE_DS_SZWEEXEC}|Zowe executable utilities library|dsntype(library) ds ############################### # validation -if [ -n "${ZWE_CLI_PARAMETER_HLQ}" ]; then - hlq="${ZWE_CLI_PARAMETER_HLQ}" +if [ -n "${ZWE_CLI_PARAMETER_DATASET_PREFIX}" ]; then + prefix="${ZWE_CLI_PARAMETER_DATASET_PREFIX}" else require_zowe_yaml - # read HLQ and validate - hlq=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.mvs.hlq") - if [ -z "${hlq}" ]; then - print_error_and_exit "Error ZWEL0157E: Zowe HLQ (zowe.setup.mvs.hlq) is not defined in Zowe YAML configuration file." "" 157 + # read prefix and validate + prefix=$(read_yaml "${ZWE_CLI_PARAMETER_CONFIG}" ".zowe.setup.dataset.prefix") + if [ -z "${prefix}" ]; then + print_error_and_exit "Error ZWEL0157E: Zowe dataset prefix (zowe.setup.dataset.prefix) is not defined in Zowe YAML configuration file." "" 157 fi fi @@ -42,19 +42,19 @@ while read -r line; do spec=$(echo "${line}" | awk -F"|" '{print $3}') # check existence - ds_existence=$(is_data_set_exists "${hlq}.${ds}") + ds_existence=$(is_data_set_exists "${prefix}.${ds}") if [ "${ds_existence}" = "true" ]; then if [ "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" = "true" ]; then # warning - print_message "Warning ZWEL0300W: ${hlq}.${ds} already exists. Members in this data set will be overwritten." + print_message "Warning ZWEL0300W: ${prefix}.${ds} already exists. Members in this data set will be overwritten." else - # print_error_and_exit "Error ZWEL0158E: ${hlq}.${ds} already exists." "" 158 + # print_error_and_exit "Error ZWEL0158E: ${prefix}.${ds} already exists." "" 158 # warning - print_message "Warning ZWEL0301W: ${hlq}.${ds} already exists and will not be overwritten. For upgrades, you must use --allow-overwrite." + print_message "Warning ZWEL0301W: ${prefix}.${ds} already exists and will not be overwritten. For upgrades, you must use --allow-overwrite." fi else - print_message "Creating ${name} - ${hlq}.${ds}" - create_data_set "${hlq}.${ds}" "${spec}" + print_message "Creating ${name} - ${prefix}.${ds}" + create_data_set "${prefix}.${ds}" "${spec}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi @@ -71,8 +71,8 @@ else # copy members cd "${ZWE_zowe_runtimeDirectory}/files/${ZWE_PRIVATE_DS_SZWESAMP}" for mb in $(find . -type f); do - print_message "Copy files/${ZWE_PRIVATE_DS_SZWESAMP}/$(basename ${mb}) to ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}" - copy_to_data_set "${mb}" "${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}" "" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + print_message "Copy files/${ZWE_PRIVATE_DS_SZWESAMP}/$(basename ${mb}) to ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}" + copy_to_data_set "${mb}" "${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}" "" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi @@ -80,8 +80,8 @@ else cd "${ZWE_zowe_runtimeDirectory}/files/${ZWE_PRIVATE_DS_SZWEEXEC}" for mb in $(find . -type f); do - print_message "Copy files/${ZWE_PRIVATE_DS_SZWEEXEC}/$(basename ${mb}) to ${hlq}.${ZWE_PRIVATE_DS_SZWEEXEC}" - copy_to_data_set "${mb}" "${hlq}.${ZWE_PRIVATE_DS_SZWEEXEC}" "" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + print_message "Copy files/${ZWE_PRIVATE_DS_SZWEEXEC}/$(basename ${mb}) to ${prefix}.${ZWE_PRIVATE_DS_SZWEEXEC}" + copy_to_data_set "${mb}" "${prefix}.${ZWE_PRIVATE_DS_SZWEEXEC}" "" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi @@ -89,13 +89,13 @@ else # prepare MVS for launcher cd "${ZWE_zowe_runtimeDirectory}/components/launcher" - print_message "Copy components/launcher/samplib/ZWESLSTC to ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}" - copy_to_data_set "samplib/ZWESLSTC" "${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}" "" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + print_message "Copy components/launcher/samplib/ZWESLSTC to ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}" + copy_to_data_set "samplib/ZWESLSTC" "${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}" "" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi - print_message "Copy components/launcher/bin/zowe_launcher to ${hlq}.${ZWE_PRIVATE_DS_SZWEAUTH}" - copy_to_data_set "bin/zowe_launcher" "${hlq}.${ZWE_PRIVATE_DS_SZWEAUTH}(ZWELNCH)" "-X" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + print_message "Copy components/launcher/bin/zowe_launcher to ${prefix}.${ZWE_PRIVATE_DS_SZWEAUTH}" + copy_to_data_set "bin/zowe_launcher" "${prefix}.${ZWE_PRIVATE_DS_SZWEAUTH}(ZWELNCH)" "-X" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi @@ -110,16 +110,16 @@ else if [ -z "${mb_to}" ]; then mb_to="${mb_from}" fi - print_message "Copy components/zss/SAMPLIB/${mb_from} to ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(${mb_to})" - copy_to_data_set "SAMPLIB/${mb_from}" "${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(${mb_to})" "" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + print_message "Copy components/zss/SAMPLIB/${mb_from} to ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(${mb_to})" + copy_to_data_set "SAMPLIB/${mb_from}" "${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(${mb_to})" "" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi done zss_loadlib="ZWESIS01 ZWESAUX" for mb in ${zss_loadlib}; do - print_message "Copy components/zss/LOADLIB/${mb} to ${hlq}.${ZWE_PRIVATE_DS_SZWEAUTH}" - copy_to_data_set "LOADLIB/${mb}" "${hlq}.${ZWE_PRIVATE_DS_SZWEAUTH}" "-X" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" + print_message "Copy components/zss/LOADLIB/${mb} to ${prefix}.${ZWE_PRIVATE_DS_SZWEAUTH}" + copy_to_data_set "LOADLIB/${mb}" "${prefix}.${ZWE_PRIVATE_DS_SZWEAUTH}" "-X" "${ZWE_CLI_PARAMETER_ALLOW_OVERWRITE}" if [ $? -ne 0 ]; then print_error_and_exit "Error ZWEL0111E: Command aborts with error." "" 111 fi diff --git a/bin/libs/certificate.sh b/bin/libs/certificate.sh index 94e3c77c96..1813c02de5 100644 --- a/bin/libs/certificate.sh +++ b/bin/libs/certificate.sh @@ -735,7 +735,7 @@ validate_certificate_domain() { } keyring_run_zwekring_jcl() { - hlq="${1}" + prefix="${1}" jcllib="${2}" # should be 1, 2 or 3 jcloption="${3}" @@ -841,8 +841,8 @@ EOF print_debug "- Create temp data set member" tmpdsm=$(create_data_set_tmp_member "${jcllib}" "ZW$(date +%H%M)") print_debug " > data set member: ${jcllib}(tmpdsm)" - print_debug "- Copy ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWEKRING) to ${tmpfile}" - result=$(cat "//'${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWEKRING)'" | \ + print_debug "- Copy ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWEKRING) to ${tmpfile}" + result=$(cat "//'${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWEKRING)'" | \ sed "s/^\/\/ \+SET \+PRODUCT=.*\$/\/\/ SET PRODUCT=${security_product}/" | \ sed "s/^\/\/ \+SET \+ZOWEUSER=.*\$/\/\/ SET ZOWEUSER=${keyring_owner:-${ZWE_PRIVATE_DEFAULT_ZOWE_USER}}/" | \ sed "s/^\/\/ \+SET \+ZOWERING=.*\$/\/\/ SET ZOWERING='${keyring_name}'/" | \ @@ -889,7 +889,7 @@ EOF fi fi if [ ! -f "${tmpfile}" ]; then - print_error "Error ZWEL0159E: Failed to modify ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWEKRING)" + print_error "Error ZWEL0159E: Failed to modify ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWEKRING)" return 159 fi print_trace "- Ensure ${tmpfile} encoding before copying into data set" @@ -939,7 +939,7 @@ EOF } keyring_run_zwenokyr_jcl() { - hlq="${1}" + prefix="${1}" jcllib="${2}" keyring_owner="${3}" keyring_name="${4}" @@ -960,8 +960,8 @@ keyring_run_zwenokyr_jcl() { print_debug "- Create temp data set member" tmpdsm=$(create_data_set_tmp_member "${jcllib}" "ZW$(date +%H%M)") print_debug " > data set member: ${jcllib}(tmpdsm)" - print_debug "- Copy ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWENOKYR) to ${tmpfile}" - result=$(cat "//'${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWENOKYR)'" | \ + print_debug "- Copy ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWENOKYR) to ${tmpfile}" + result=$(cat "//'${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWENOKYR)'" | \ sed "s/^\/\/ \+SET \+PRODUCT=.*\$/\/\/ SET PRODUCT=${security_product}/" | \ sed "s/^\/\/ \+SET \+ZOWEUSER=.*\$/\/\/ SET ZOWEUSER=${keyring_owner:-${ZWE_PRIVATE_DEFAULT_ZOWE_USER}}/" | \ sed "s/^\/\/ \+SET \+ZOWERING=.*\$/\/\/ SET ZOWERING='${keyring_name}'/" | \ @@ -986,7 +986,7 @@ keyring_run_zwenokyr_jcl() { fi fi if [ ! -f "${tmpfile}" ]; then - print_error "Error ZWEL0159E: Failed to modify ${hlq}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWENOKYR)" + print_error "Error ZWEL0159E: Failed to modify ${prefix}.${ZWE_PRIVATE_DS_SZWESAMP}(ZWENOKYR)" return 159 fi print_trace "- Ensure ${tmpfile} encoding before copying into data set" diff --git a/bin/libs/container.sh b/bin/libs/container.sh index 2142bd11fe..9ec7e8a8dc 100644 --- a/bin/libs/container.sh +++ b/bin/libs/container.sh @@ -14,8 +14,8 @@ export ZWE_PRIVATE_CONTAINER_HOME_DIRECTORY=/home/zowe export ZWE_PRIVATE_CONTAINER_RUNTIME_DIRECTORY=/home/zowe/runtime export ZWE_PRIVATE_CONTAINER_COMPONENT_RUNTIME_DIRECTORY=/component -export ZWE_PRIVATE_CONTAINER_WORKSPACE_DIRECTORY=/home/zowe/workspace -export ZWE_PRIVATE_CONTAINER_LOG_DIRECTORY=/home/zowe/logs +export ZWE_PRIVATE_CONTAINER_WORKSPACE_DIRECTORY=/home/zowe/instance/workspace +export ZWE_PRIVATE_CONTAINER_LOG_DIRECTORY=/home/zowe/instance/logs export ZWE_PRIVATE_CONTAINER_KEYSTORE_DIRECTORY=/home/zowe/keystore # prepare all environment variables used in containerization diff --git a/bin/libs/zos-dataset.sh b/bin/libs/zos-dataset.sh index efd51d9a5f..9a97c917df 100644 --- a/bin/libs/zos-dataset.sh +++ b/bin/libs/zos-dataset.sh @@ -99,7 +99,7 @@ copy_to_data_set() { } data_set_copy_to_data_set() { - hlq="${1}" + prefix="${1}" ds_from="${2}" ds_to="${3}" allow_overwrite="${4}" @@ -110,7 +110,7 @@ data_set_copy_to_data_set() { fi fi - cmd="exec '${hlq}.${ZWE_PRIVATE_DS_SZWEEXEC}(ZWEMCOPY)' '${ds_from} ${ds_to}'" + cmd="exec '${prefix}.${ZWE_PRIVATE_DS_SZWEEXEC}(ZWEMCOPY)' '${ds_from} ${ds_to}'" print_debug "- tsocmd ${cmd}" result=$(tsocmd "${cmd}" 2>&1) code=$? diff --git a/bin/libs/zos-jes.sh b/bin/libs/zos-jes.sh index b2cfc43971..ccced069f4 100644 --- a/bin/libs/zos-jes.sh +++ b/bin/libs/zos-jes.sh @@ -15,6 +15,23 @@ submit_job() { jcl="${1}" print_debug "- submit job ${jcl}" + + print_trace "- content of ${jcl}" + result=$(cat "${jcl}" 2>&1) + code=$? + if [ ${code} -eq 0 ]; then + print_trace "$(padding_left "${result}" " ")" + else + print_trace " * Failed" + print_error " * Exit code: ${code}" + print_error " * Output:" + if [ -n "${result}" ]; then + print_error "$(padding_left "${result}" " ")" + fi + + return ${code} + fi + result=$(submit "${jcl}") # expected: JOB JOB????? submitted from path '...' code=$? diff --git a/containers/conformance.md b/containers/conformance.md index d11f6518d3..d487941ef7 100644 --- a/containers/conformance.md +++ b/containers/conformance.md @@ -2,7 +2,7 @@ **DRAFT** -These conformance criteria are applicable for all Zowe components intending to run in a containerized environment. The containerized environment could be Kubernetes or OpenShift running on Linux or Linux on Z. This may also apply to `docker-compose` running on Linux, Windows, Mac OS, or zCX. +These conformance criteria are applicable for all Zowe components intending to run in a containerized environment. The containerized environment could be Kubernetes or OpenShift running on Linux or Linux on Z. ## Image @@ -154,7 +154,7 @@ The below sections are mainly targeting Kubernetes or OpenShift environments. St - listen to only ONE port in the container except for API Mediation Layer Gateway. - be cloud-vendor neutral and must NOT rely on features provided by a specific cloud vendor. - NOT rely on host information such as `hostIP`, `hostPort`, `hostPath`, `hostNetwork`, `hostPID` and `hostIPC`. -- MUST accept either `instance.env` or `zowe.yaml` as a configuration file, the same as when running on z/OS. +- MUST accept `zowe.yaml` as a configuration file, the same as when running on z/OS. ### Persistent Volume(s) @@ -173,29 +173,25 @@ In the runtime, the Zowe content is organized in this structure: +- /components +- / +- /instance - +- instance.env or zowe.yaml + +- zowe.yaml +- /logs - +- /tmp +- /workspace +- /keystore - +- zowe-certificates.env ``` - `/home/zowe/runtime` is a shared volume initialized by the `zowe-launch-scripts` container. - `/home/zowe/runtime/components/` is a symbolic link to the `/component` directory. `` is the `name` entry defined in `/component/manifest.(yaml|yml|json)`. -- `/home/zowe/instance/(instance.env|zowe.yaml)` is a Zowe configuration file and MUST be mounted from a ConfigMap. +- `/home/zowe/instance/zowe.yaml` is a Zowe configuration file and MUST be mounted from a ConfigMap. - `/home/zowe/instance/logs` is the logs directory of Zowe instance. This folder will be created automatically by `zowe-launch-scripts` container. -- `/home/zowe/instance/tmp` is the temporary directory of Zowe instance. This folder will be created automatically by `zowe-launch-scripts` container. - `/home/zowe/instance/workspace` is the persistent volume mounted to every Zowe component container. * Components writing to this directory should be aware of the potential conflicts of same-time writing by multiple instances of the same component. * Components writing to this directory must NOT write container-specific information to this directory as it may potentially be overwritten by another container. -- `/home/zowe/keystore/zowe-certificates.env` is optional if the user is using `instance.env`. If this configuration exists, it MUST be mounted from a ConfigMap. -- Any confidential environment variables, for example, a Redis password, in `instance.env` or `zowe.yaml` must be extracted and stored as Secrets. These configurations must be imported back as environment variables. +- `/home/zowe/keystore` is the directory where certificate is mounted. With a typical setup (by using `zwe migrate for kubernetes` command), this folder contains `keystore.p12`, `truststore.p12`, `keystore.key`, `keystore.cer` and `ca.cer`. +- Any confidential environment variables, for example, a Redis password, in `zowe.yaml` must be extracted and stored as Secrets. These configurations must be imported back as environment variables. ### ConfigMap and Secrets -- `instance.env` or `zowe.yaml` must be stored in a ConfigMap and be mounted under `/home/zowe/instance` directory. -- If the user is using `instance.env`, `/zowe-certificates.env` content must also be stored in a ConfigMap and be mounted to `/home/zowe/keystore`. +- `zowe.yaml` must be stored in a ConfigMap and be mounted under `/home/zowe/instance` directory. - All certificates must be stored in Secrets. Those files will be mounted under the `/home/zowe/keystore` directory. - Secrets must be defined manually by a system administrator. Zowe Helm Chart and Zowe Operator do NOT define the content of Secrets. @@ -212,7 +208,7 @@ In the runtime, the Zowe content is organized in this structure: ```yaml command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" ``` ### Environment Variables diff --git a/containers/kubernetes/samples/certificates-secret.yaml b/containers/kubernetes/samples/certificates-secret.yaml index 0bdb02a4e1..6a2a76e304 100644 --- a/containers/kubernetes/samples/certificates-secret.yaml +++ b/containers/kubernetes/samples/certificates-secret.yaml @@ -30,7 +30,7 @@ data: stringData: keystore.key: | - keystore.cert: | + keystore.cer: | - localca.cert: | + ca.cer: | diff --git a/containers/kubernetes/samples/config-cm.yaml b/containers/kubernetes/samples/config-cm.yaml index 69f8c5568c..eb0f0e28e4 100644 --- a/containers/kubernetes/samples/config-cm.yaml +++ b/containers/kubernetes/samples/config-cm.yaml @@ -26,8 +26,8 @@ data: zowe.yaml: | zowe: runtimeDirectory: /home/zowe/runtime - logDirectory: /home/zowe/logs - workspaceDirectory: /home/zowe/workspace + logDirectory: /home/zowe/instance/logs + workspaceDirectory: /home/zowe/instance/workspace job: name: ZWE1SV @@ -56,11 +56,13 @@ data: file: /home/zowe/keystore/keystore.p12 type: PKCS12 trustStore: + password: password file: /home/zowe/keystore/truststore.p12 + type: PKCS12 pem: key: /home/zowe/keystore/keystore.key - certificate: /home/zowe/keystore/keystore.cert - certificateAuthorities: /home/zowe/keystore/localca.cert + certificate: /home/zowe/keystore/keystore.cer + certificateAuthorities: /home/zowe/keystore/ca.cer verifyCertificates: STRICT @@ -84,32 +86,6 @@ data: port: 7554 debug: false - apiml: - security: - auth: - provider: zosmf - zosmf: - jwtAutoconfiguration: auto - serviceId: zosmf - authorization: - endpoint: - enabled: false - provider: - jwtInitializerTimeout: 5 - x509: - enabled: false - zosmf: - applid: IZUDFLT - service: - allowEncodedSlashes: true - corsEnabled: false - server: - internal: - enabled: false - port: 7556 - ssl: - enabled: false - discovery: enabled: true port: 7553 @@ -140,7 +116,7 @@ data: zss: enabled: true - port: "8542" + port: 8542 tls: true crossMemoryServerName: ZWESIS_STD diff --git a/containers/kubernetes/samples/debug-pod.yaml b/containers/kubernetes/samples/debug-pod.yaml index 10fdd28523..1b607924d5 100644 --- a/containers/kubernetes/samples/debug-pod.yaml +++ b/containers/kubernetes/samples/debug-pod.yaml @@ -53,16 +53,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" command: ["/bin/bash", "-c"] args: - sleep 3600 diff --git a/containers/kubernetes/samples/sample-deployment.yaml b/containers/kubernetes/samples/sample-deployment.yaml index 28e9516ad0..d62515c571 100644 --- a/containers/kubernetes/samples/sample-deployment.yaml +++ b/containers/kubernetes/samples/sample-deployment.yaml @@ -78,7 +78,7 @@ spec: failureThreshold: 3 command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" env: - name: ZWE_POD_NAMESPACE valueFrom: @@ -87,7 +87,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -100,16 +100,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -133,10 +133,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -147,7 +147,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/api-catalog-deployment.yaml b/containers/kubernetes/workloads/api-catalog-deployment.yaml index 2ad088536e..4c33167cf2 100644 --- a/containers/kubernetes/workloads/api-catalog-deployment.yaml +++ b/containers/kubernetes/workloads/api-catalog-deployment.yaml @@ -76,7 +76,7 @@ spec: failureThreshold: 3 command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" env: - name: ZWE_POD_NAMESPACE valueFrom: @@ -87,7 +87,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -100,16 +100,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -134,10 +134,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -148,7 +148,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/app-server-deployment.yaml b/containers/kubernetes/workloads/app-server-deployment.yaml index 0c635e30c4..556b40497b 100644 --- a/containers/kubernetes/workloads/app-server-deployment.yaml +++ b/containers/kubernetes/workloads/app-server-deployment.yaml @@ -76,22 +76,19 @@ spec: failureThreshold: 3 command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" env: - name: ZWE_POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - - name: WORKSPACE_DIR - # FIXME: app-server hardcoded /home/zowe/instance/workspace as WORKSPACE_DIR, overwrite it - value: /home/zowe/workspace - name: KEYSTORE_CERTIFICATE_AUTHORITY # FIXME: ZWE_zowe_certificate_pem_certificateAuthorities is not recognized value: /home/zowe/keystore/ca.cer, lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -104,16 +101,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -138,10 +135,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -152,7 +149,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/caching-deployment.yaml b/containers/kubernetes/workloads/caching-deployment.yaml index 48d2a8a774..23de2ef5c3 100644 --- a/containers/kubernetes/workloads/caching-deployment.yaml +++ b/containers/kubernetes/workloads/caching-deployment.yaml @@ -76,7 +76,7 @@ spec: failureThreshold: 3 command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" env: - name: ZWE_POD_NAMESPACE valueFrom: @@ -87,7 +87,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -100,16 +100,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -134,10 +134,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -148,7 +148,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/cleanup-static-definitions-cronjob.yaml b/containers/kubernetes/workloads/cleanup-static-definitions-cronjob.yaml index 5b53ce2e45..d6d7052b9c 100644 --- a/containers/kubernetes/workloads/cleanup-static-definitions-cronjob.yaml +++ b/containers/kubernetes/workloads/cleanup-static-definitions-cronjob.yaml @@ -70,20 +70,20 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -94,7 +94,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/discovery-statefulset.yaml b/containers/kubernetes/workloads/discovery-statefulset.yaml index 02df52b4e0..8ff05a66c4 100644 --- a/containers/kubernetes/workloads/discovery-statefulset.yaml +++ b/containers/kubernetes/workloads/discovery-statefulset.yaml @@ -79,7 +79,7 @@ spec: failureThreshold: 3 command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" env: - name: ZWE_POD_NAMESPACE valueFrom: @@ -90,7 +90,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -103,16 +103,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -137,10 +137,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -151,7 +151,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/explorer-ip-job.yaml b/containers/kubernetes/workloads/explorer-ip-job.yaml index ef5007caf5..d2079d391b 100644 --- a/containers/kubernetes/workloads/explorer-ip-job.yaml +++ b/containers/kubernetes/workloads/explorer-ip-job.yaml @@ -55,11 +55,11 @@ spec: cpu: "100m" command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -72,16 +72,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -106,10 +106,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -120,7 +120,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/explorer-jes-job.yaml b/containers/kubernetes/workloads/explorer-jes-job.yaml index b5b330b654..2e2f09dbdc 100644 --- a/containers/kubernetes/workloads/explorer-jes-job.yaml +++ b/containers/kubernetes/workloads/explorer-jes-job.yaml @@ -56,11 +56,11 @@ spec: cpu: "100m" command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -73,16 +73,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -107,10 +107,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -121,7 +121,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/explorer-mvs-job.yaml b/containers/kubernetes/workloads/explorer-mvs-job.yaml index 69c2d5fe9d..3554b551c4 100644 --- a/containers/kubernetes/workloads/explorer-mvs-job.yaml +++ b/containers/kubernetes/workloads/explorer-mvs-job.yaml @@ -56,11 +56,11 @@ spec: cpu: "100m" command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -73,16 +73,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -107,10 +107,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -121,7 +121,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/explorer-uss-job.yaml b/containers/kubernetes/workloads/explorer-uss-job.yaml index 6eee923284..c07ba34917 100644 --- a/containers/kubernetes/workloads/explorer-uss-job.yaml +++ b/containers/kubernetes/workloads/explorer-uss-job.yaml @@ -56,11 +56,11 @@ spec: cpu: "100m" command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -73,16 +73,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -107,10 +107,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -121,7 +121,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/files-api-deployment.yaml b/containers/kubernetes/workloads/files-api-deployment.yaml index c818198f6e..74f14cbddf 100644 --- a/containers/kubernetes/workloads/files-api-deployment.yaml +++ b/containers/kubernetes/workloads/files-api-deployment.yaml @@ -76,7 +76,7 @@ spec: failureThreshold: 3 command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" env: - name: ZWE_POD_NAMESPACE valueFrom: @@ -85,7 +85,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -98,16 +98,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -132,10 +132,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -146,7 +146,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/gateway-deployment.yaml b/containers/kubernetes/workloads/gateway-deployment.yaml index 47ecc46b9c..1ab60e0914 100644 --- a/containers/kubernetes/workloads/gateway-deployment.yaml +++ b/containers/kubernetes/workloads/gateway-deployment.yaml @@ -76,7 +76,7 @@ spec: failureThreshold: 3 command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" env: - name: ZWE_POD_NAMESPACE valueFrom: @@ -87,7 +87,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -100,16 +100,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -134,10 +134,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -148,7 +148,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/kubernetes/workloads/jobs-api-deployment.yaml b/containers/kubernetes/workloads/jobs-api-deployment.yaml index a240471b4b..cde9b1cb7b 100644 --- a/containers/kubernetes/workloads/jobs-api-deployment.yaml +++ b/containers/kubernetes/workloads/jobs-api-deployment.yaml @@ -76,7 +76,7 @@ spec: failureThreshold: 3 command: ["/bin/bash", "-c"] args: - - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/zowe.yaml" + - "/home/zowe/runtime/bin/zwe internal start -c /home/zowe/instance/zowe.yaml" env: - name: ZWE_POD_NAMESPACE valueFrom: @@ -85,7 +85,7 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/zowe.yaml"] + command: ["/bin/sh", "-c", "/home/zowe/runtime/bin/zwe internal container prestop -c /home/zowe/instance/zowe.yaml"] securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false @@ -98,16 +98,16 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-config - mountPath: "/home/zowe/zowe.yaml" + mountPath: "/home/zowe/instance/zowe.yaml" subPath: zowe.yaml readOnly: true - name: zowe-keystore mountPath: "/home/zowe/keystore" readOnly: true - name: zowe-logs - mountPath: "/home/zowe/logs" + mountPath: "/home/zowe/instance/logs" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" initContainers: - name: init-zowe # image: zowe-docker-release.jfrog.io/ompzowe/zowe-launch-scripts:2-ubuntu @@ -132,10 +132,10 @@ spec: - name: zowe-runtime mountPath: "/home/zowe/runtime" - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" - name: update-workspace-permission image: busybox:1.28 - command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/workspace` && PERMISSION=`stat -c "%a" /home/zowe/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/workspace; fi'] + command: ['sh', '-c', 'OWNER=`stat -c "%u:%g" /home/zowe/instance/workspace` && PERMISSION=`stat -c "%a" /home/zowe/instance/workspace` && echo "Zowe workspace owner is ${OWNER} with ${PERMISSION} permission" && if [ "${OWNER}" != "20000:20000" -a "${PERMISSION}" != "777" ]; then chown -R 20000:20000 /home/zowe/instance/workspace; fi'] imagePullPolicy: Always resources: requests: @@ -146,7 +146,7 @@ spec: cpu: "100m" volumeMounts: - name: zowe-workspace - mountPath: "/home/zowe/workspace" + mountPath: "/home/zowe/instance/workspace" securityContext: readOnlyRootFilesystem: true allowPrivilegeEscalation: false diff --git a/containers/server-bundle/Dockerfile b/containers/server-bundle/Dockerfile index d8c64b46de..f5ca7d8b92 100644 --- a/containers/server-bundle/Dockerfile +++ b/containers/server-bundle/Dockerfile @@ -66,6 +66,7 @@ RUN mv /home/zowe/run_inner.sh /home/zowe/.run_inner.sh && \ mv app-server-*.pax zlux && \ for f in *.pax; do \ echo "Processing ebcdic pax $f" && \ + cd /tmp/zowe-install/files &&\ rm -rf tmp && \ mkdir tmp && \ cd tmp && \ @@ -80,6 +81,7 @@ RUN mv /home/zowe/run_inner.sh /home/zowe/.run_inner.sh && \ cd zlux && \ for f in *.pax; do \ echo "Processing tagged pax $f" &&\ + cd /tmp/zowe-install/files/zlux &&\ rm -rf tmp &&\ mkdir tmp &&\ cd tmp &&\ diff --git a/dco_signoffs/Adarsh-Cheema-zowe-install-packaging.txt b/dco_signoffs/Adarsh-Cheema-zowe-install-packaging.txt new file mode 100644 index 0000000000..c8cd14f552 --- /dev/null +++ b/dco_signoffs/Adarsh-Cheema-zowe-install-packaging.txt @@ -0,0 +1,3 @@ +I, Adarshdeep Cheema hereby sign-off-by all of my past commits to this repo subject to the Developer Certificate of Origin (DCO), Version 1.1. In the past I have used emails: adarshdeep.cheema@ibm.com + +85963a77321f74ba46826b6fdb303f8039b98275 updating the explorer-JES version \ No newline at end of file diff --git a/dco_signoffs/James-Struga-zowe-install-packaging.txt b/dco_signoffs/James-Struga-zowe-install-packaging.txt new file mode 100644 index 0000000000..9ca646b404 --- /dev/null +++ b/dco_signoffs/James-Struga-zowe-install-packaging.txt @@ -0,0 +1,4 @@ +I, James Struga hereby sign-off-by all of my past commits to this repo subject to the Developer Certificate of Origin (DCO), Version 1.1. In the past I have used emails: jstruga@rocketsoftware.com + +17cc425e2ccfaf1c988426d847cf918deed752bb Merge pull request #2580 +c5261e82bd8c9ff8f6d3611a984e05f643674126 Merge pull requrst #2580 \ No newline at end of file diff --git a/dco_signoffs/Tom-Zhang-zowe-install-packaging.txt b/dco_signoffs/Tom-Zhang-zowe-install-packaging.txt index c6d1c4d9ae..df61c245b1 100644 --- a/dco_signoffs/Tom-Zhang-zowe-install-packaging.txt +++ b/dco_signoffs/Tom-Zhang-zowe-install-packaging.txt @@ -1,3 +1,8 @@ I, Tom Zhang hereby sign-off-by all of my past commits to this repo subject to the Developer Certificate of Origin (DCO), Version 1.1. In the past I have used emails: tom.yczhang@gmail.com -f3f780e66e27133d658009b4b5939585af96afb3 Fix hardcoded staging keyword for auto test \ No newline at end of file +f3f780e66e27133d658009b4b5939585af96afb3 Fix hardcoded staging keyword for auto test +14e6cab28a62e7ac97febc68603d324f01cdfd89 optimize some action inputs +37c30d7cadb8f24cc48c460e710ad55a58f32db0 comment out auto triggers +16083c3107bf8ce9737d636496105fc0505e1457 Change from VOL ZOWE02 to ZOWE03 +4b0c0608a4e563d4abe783476f017311ca2c4c51 ZOWE03 is only for marist 4 +4616dc18479f4677bcb7d29168d2dadd14315722 readme doc changes \ No newline at end of file diff --git a/example-zowe.yaml b/example-zowe.yaml index 3d34d0ceb9..cbe2e44fb1 100644 --- a/example-zowe.yaml +++ b/example-zowe.yaml @@ -36,10 +36,10 @@ zowe: #------------------------------------------------------------------------------- setup: # MVS data set related configurations - mvs: + dataset: # **COMMONLY_CUSTOMIZED** # where Zowe MVS data sets will be installed - hlq: IBMUSER.ZWEV2 + prefix: IBMUSER.ZWEV2 # **COMMONLY_CUSTOMIZED** # PROCLIB where Zowe STCs will be copied over proclib: USER.PROCLIB @@ -50,7 +50,7 @@ zowe: # JCL library where Zowe will store temporary JCLs during initialization jcllib: IBMUSER.ZWEV2.CUST.JCLLIB # APF authorized LOADLIB for Zowe - # Optional. If it's empty, .SZWEAUTH will be APF authorized. + # Optional. If it's empty, .SZWEAUTH will be APF authorized. authLoadlib: "" # **COMMONLY_CUSTOMIZED** # APF authorized LOADLIB for Zowe ZIS Plugins @@ -98,6 +98,8 @@ zowe: # **COMMONLY_CUSTOMIZED** # Keystore directory directory: /var/zowe/keystore + # # Lock the keystore directory to only accessible by Zowe runtime user and group. + # lock: true # **COMMONLY_CUSTOMIZED** # # Certificate alias name. Optional, default value is localhost. # # Note: please use all lower cases as alias. @@ -141,6 +143,8 @@ zowe: # # **COMMONLY_CUSTOMIZED** # # Keystore directory # directory: /var/zowe/keystore + # # Lock the keystore directory to only accessible by Zowe runtime user and group. + # lock: true # # # Certificate alias name. Optional, default value is localhost. # # # Note: please use all lower cases as alias. # # name: localhost @@ -428,30 +432,26 @@ components: authorization: endpoint: enabled: false - provider: - jwtInitializerTimeout: 5 + provider: "" x509: enabled: false - zosmf: - applid: IZUDFLT - service: - allowEncodedSlashes: true - corsEnabled: false server: internal: # gateway supports internal connector enabled: false - port: 7556 + port: 7550 ssl: enabled: false # internal connector can use different certificate - # certificates: - # alias: + # certificate: + # keystore: + # alias: "" # If we customize this to use different external certificate, than should also # define "server.internal.ssl.certificate" and enable "server.internal.ssl.enabled". - # certificates: - # alias: + # certificate: + # keystore: + # alias: "" # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> metrics-service: @@ -487,7 +487,7 @@ components: vsam: # your VSAM data set created by ZWECSVSM job # this is required if storage mode is VSAM - name: + name: "" # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> app-server: diff --git a/files/SZWESAMP/ZWEKRING b/files/SZWESAMP/ZWEKRING index f8d5908dd5..43f5dcb2f0 100644 --- a/files/SZWESAMP/ZWEKRING +++ b/files/SZWESAMP/ZWEKRING @@ -344,19 +344,53 @@ $$ /* A common part for all options - BEGINNING ....................... */ /* Allow ZOWEUSER to access keyring ................................ */ + +/* Activate RDATALIB class holding profiles that control ........... */ +/* certificate access ............................................. */ + SETROPTS CLASSACT(RDATALIB) RACLIST(RDATALIB) + +/* Define profiles that control certificate access ................. */ + RDEFINE RDATALIB &ZOWEUSER..&ZOWERING..LST UACC(NONE) + +/* Permit server user ID to access key ring and related ............ */ +/* private keys. ................................................... */ + PERMIT &ZOWEUSER..&ZOWERING..LST CLASS(RDATALIB) ID(&ZOWEUSER.) + + ACCESS(CONTROL) + +/* Uncomment this command to allow other user to access key ring ... */ +/* PERMIT &ZOWEUSER..&ZOWERING..LST CLASS(RDATALIB) ID() + */ +/* ACCESS(READ) */ + +/* Refresh to dynamically activate the changes. .................... */ + SETROPTS RACLIST(RDATALIB) REFRESH + +/* IRR.DIGTCERT logic pre-dates RDATALIB logic, and is not used when */ +/* the RDATALIB profile is used. The following PERMIT commands are . */ +/* present for customers who do not wish to use RDATALIB and want to */ +/* continue using their existing IRR.DIGTCERT setup. Note that the . */ +/* PERMIT commands will fail if the IRR.DIGTCERT profiles do not ... */ +/* already exist. .................................................. */ PERMIT IRR.DIGTCERT.LISTRING CLASS(FACILITY) ID(&ZOWEUSER.) + ACCESS(READ) + PERMIT IRR.DIGTCERT.LIST CLASS(FACILITY) ID(&ZOWEUSER.) + + ACCESS(READ) /* Uncomment this command if SITE user owns the Zowe certificate ... */ -/* PERMIT IRR.DIGTCERT.GENCERT CLASS(FACILITY) ID(&ZOWEUSER.) + -/* ACCESS(CONTROL) +/* PERMIT IRR.DIGTCERT.GENCERT CLASS(FACILITY) ID(&ZOWEUSER.) + */ +/* ACCESS(CONTROL) */ SETROPTS RACLIST(FACILITY) REFRESH +/* show results .................................................... */ + RLIST RDATALIB &ZOWEUSER..&ZOWERING..LST ALL + RLIST FACILITY IRR.DIGTCERT.LISTRING ALL + RLIST FACILITY IRR.DIGTCERT.LIST ALL + RLIST FACILITY IRR.DIGTCERT.GENCERT ALL + /* List the keyring ................................................ */ RACDCERT LISTRING(&ZOWERING.) ID(&ZOWEUSER.) -/* Common part - END ................................................ */ +/* Common part - END ............................................... */ /* only the last RC is returned, this command ensures it is a 0 .... */ PROFILE $$ diff --git a/files/SZWESAMP/ZWENOKYR b/files/SZWESAMP/ZWENOKYR index a28b9202ad..875d281bfc 100644 --- a/files/SZWESAMP/ZWENOKYR +++ b/files/SZWESAMP/ZWENOKYR @@ -92,6 +92,15 @@ SETROPTS RACLIST(FACILITY) REFRESH +/* Remove keyring profile defined on RDATALIB class ................ */ + RLIST RDATALIB &ZOWEUSER..&ZOWERING..LST ALL + PERMIT &ZOWEUSER..&ZOWERING..LST CLASS(RDATALIB) DELETE + + ID(&ZOWEUSER.) + RDELETE RDATALIB &ZOWEUSER..&ZOWERING..LST + +/* Refresh to dynamically activate the changes. .................... */ + SETROPTS RACLIST(RDATALIB) REFRESH + /* Delete LABEL certificate ........................................*/ RACDCERT DELETE(LABEL('&LABEL.')) ID(&ZOWEUSER.) diff --git a/files/SZWESAMP/ZWESECKG b/files/SZWESAMP/ZWESECKG new file mode 100644 index 0000000000..6b8861aaa5 --- /dev/null +++ b/files/SZWESAMP/ZWESECKG @@ -0,0 +1,138 @@ +//ZWESECKG JOB +//PROCLIB JCLLIB ORDER=CBC.SCCNPRC +//BUILD#GO EXEC EDCCBG, +// CPARM='SEARCH(/usr/include),DLL' +//COMPILE.SYSIN DD * + /*-------------------------------------------------------------------* +* Invokes CSFPGSK (Generate secret key) +*--------------------------------------------------------------------*/ +#include +#include +#include + /*-------------------------------------------------------------------* +* Utility for printing hex strings * +*--------------------------------------------------------------------*/ +void printHex(unsigned char *, unsigned int); + + /********************************************************************* +* Modify values according to your requirements * +**********************************************************************/ + /* Modify PKCS#11 token name. Its name can be up to 32 bytes long. + The whole 'handle' string literal should be 44 bytes long. + More info on handle format: + https://www.ibm.com/docs/en/zos/2.4.0?topic=services-handles#handl */ + +#define HANDLE "IDTTKN.JWT.SECRET T " + + /* Modify ATTRIBUTES_NUMBER accordingly if you add more attributes to + template structure. */ + +#define ATTRIBUTES_NUMBER 4 + +CK_OBJECT_CLASS class = CKO_SECRET_KEY; +CK_KEY_TYPE keyType = CKK_GENERIC_SECRET; +CK_ULONG length = 32; +CK_BBOOL trueVal = TRUE; + + /* Modify attributes here if required */ +CK_ATTRIBUTE template[ATTRIBUTES_NUMBER] = { + {CKA_CLASS, &class, sizeof(class)}, + {CKA_KEY_TYPE, &keyType, sizeof(keyType)}, + {CKA_TOKEN, &trueVal, sizeof(trueVal)}, + {CKA_VALUE_LEN, &length, sizeof(length)} +}; + + /********************************************************************* +* Main Function +**********************************************************************/ +int main(void) { + /*-------------------------------------------------------------------* +* Constant inputs to ICSF services * +*--------------------------------------------------------------------*/ + static unsigned char handle[45] = HANDLE; + static int exitDataLength = 0; + static unsigned char exitData[4] = {0}; + static int ruleArrayCount = 1; + static unsigned char ruleArray[8] = "KEY "; + static int attributeListLength = 2 + ATTRIBUTES_NUMBER * 6; + static unsigned char attributeList[32752] = {0}; + static int parmsListLength = 0; + static unsigned char parmsList[4] = {0}; + /*-------------------------------------------------------------------* +* Variable inputs/outputs for ICSF services * +*--------------------------------------------------------------------*/ + + int returnCode = 0; + int reasonCode = 0; + /*-------------------------------------------------------------------* +* Populate attribute list * +*--------------------------------------------------------------------*/ + char *ptr; + CK_ATTRIBUTE attr; + unsigned short len; + unsigned short *count; + int i; + + ptr = (void *) attributeList; + count = (unsigned short *) ptr; + *count = ATTRIBUTES_NUMBER; + ptr += 2; + + for (i = 0; i < ATTRIBUTES_NUMBER; i++) { + attr = template[i]; + + len = (unsigned short) attr.ulValueLen; + + memcpy(ptr, (void *)(&attr.type), 4); + memcpy(ptr + 4, (void *) &len, 2); + memcpy(ptr + 6, (void *) (attr.pValue), len); + + attributeListLength += len; + ptr += 6 + len; + } + + /*-------------------------------------------------------------------* +* Call key generate * +*--------------------------------------------------------------------*/ + if ((returnCode = CSFPGSK(&returnCode, + &reasonCode, + &exitDataLength, + exitData, + handle, + &ruleArrayCount, + ruleArray, + &attributeListLength, + attributeList, + &parmsListLength, + parmsList)) != 0) + { + printf("\nKey Generate failed:\n"); + printf(" Return Code = %04d\n", returnCode); + printf(" Reason Code = %04d\n", reasonCode); + } + printf("\nAttribute struct:\n"); + printHex(attributeList, attributeListLength); + printf("\nHandle:\n"); + printf("\n%s\n", handle); + + return returnCode; +} + + /*-------------------------------------------------------------------* +* Prints a string as hex characters * +*--------------------------------------------------------------------*/ +void printHex(unsigned char *text, unsigned int len) +{ + unsigned int i; + for (i = 0; i < len; ++i) + if (((i & 7) == 7) || (i == (len - 1))) + printf(" %02x\n", text[i]); + else + printf(" %02x", text[i]); + printf("\n"); +} /* end printHex */ +/* +//BIND.SYSIN DD * + INCLUDE '/usr/lib/CSFDLL31.x' +/* +// diff --git a/files/sca/README.md b/files/sca/README.md new file mode 100644 index 0000000000..8d615d2768 --- /dev/null +++ b/files/sca/README.md @@ -0,0 +1,28 @@ +# Verify Zowe Security Configuration using the z/OSMF Security Configuration Assistant (SCA) + +The `zowe_base_server.json` and `zowe_base_user.json` are the security descriptors files that can +be used to verify Zowe security setup using z/OSMF SCA tool. To make use of the files, refer to the +`IBM z/OS Management Facility Configuration Guide` book, the `Creating security descriptor files for +the Security Configuration Assistant task` section, the `Working with a security descriptor file` +subsection, or the [link](https://www.ibm.com/docs/en/zos/2.5.0?topic=zmfcg-creating-security-descriptor-files-security-configuration-assistant-task). + +## Troubleshooting + +Your z/OSMF doesn't have to have all the privileges to test a specific security class. If such an issue +occurs then the z/OSMF has to be permitted to check for the specific security class. + +**Example**: + +While validating access to a resource for PTKTDATA security class, you get the 'Unknown' validation +result with the message: +`The z/OSMF server ID IZUSVR cannot access the requested SAF resource BBG.SECCLASS.PTKTDATA in class SERVER.` + +To resolve the issue, you have to execute the following security commands (for RACF): +``` +RDEFINE SERVER BBG.SECCLASS.PTKTDATA UACC(NONE) +PERMIT BBG.SECCLASS.PTKTDATA CLASS(SERVER) ACCESS(READ) ID(IZUSVR) +SETROPTS RACLIST(SERVER) REFRESH +``` + + + diff --git a/files/sca/zowe_base_server.json b/files/sca/zowe_base_server.json new file mode 100644 index 0000000000..6cfd05c68c --- /dev/null +++ b/files/sca/zowe_base_server.json @@ -0,0 +1,138 @@ +{ + "ServiceId": "AZWE001BASE0S", + "ServiceName": "Zowe Configuration - Server", + "MetaValidationItemVersion": 1.0, + "Vendor": "OPEN MAINFRAME PROJECT", + "SecurityValidationItems": [ + { + "ItemID": "AZWE001BASE0SI00001000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "ZWES.IS", + "ResourceClass": "FACILITY", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To allow Zowe ZWESVSTC processes to access the Zowe ZIS cross memory server." + }, + { + "ItemID": "AZWE001BASE0SI00002000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "BPX.SERVER", + "ResourceClass": "FACILITY", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "UPDATE", + "ItemDescription": "To allow the Zowe Desktop ZLUX server to run code on behalf of the API requester's TSO user ID." + }, + { + "ItemID": "AZWE001BASE0SI00003000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "BPX.DAEMON", + "ResourceClass": "FACILITY", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "UPDATE", + "ItemDescription": "To allow the Zowe Desktop ZLUX server to run code on behalf of the API requester's TSO user ID." + }, + { + "ItemID": "AZWE001BASE0SI00004000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "BPX.JOBNAME", + "ResourceClass": "FACILITY", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To allow z/OS address spaces for unix processes to be renamed for ease of identification." + }, + { + "ItemID": "AZWE001BASE0SI00005000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "CSFRNGL", + "ResourceClass": "CSFSERV", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To generate symmetric keys using ICSF that is used by Zowe Desktop cookies." + }, + { + "ItemID": "AZWE001BASE0SI00006000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "IRR.RUSERMAP", + "ResourceClass": "FACILITY", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To allow Zowe to map an X.509 client certificate to a z/OS identity." + }, + { + "ItemID": "AZWE001BASE0SI00007000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "IRR.RADMIN.LISTUSER", + "ResourceClass": "FACILITY", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To allow Zowe to obtain information about OMVS segment of the user profile using LISTUSER TSO command." + }, + { + "ItemID": "AZWE001BASE0SI00008000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "OMVSAPPL", + "ResourceClass": "APPL", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To allow Zowe Desktop vendor extensions the ability to use single-sign on." + }, + { + "ItemID": "AZWE001BASE0SI00009000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "SUPERUSER.FILESYS", + "ResourceClass": "UNIXPRIV", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "CONTROL", + "ItemDescription": "An alternative option to allow Zowe user ID to write persistent data in the Zowe directory structure." + }, + { + "ItemID": "AZWE001BASE0SI00010000", + "ItemType": "SEMI-PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "IRRPTAUTH..ANYUSER", + "ResourceClass": "PTKTDATA", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "UPDATE", + "ItemDescription": "To allow Zowe APIML to generate passtickets for application. Used for SSO and client certificate authentication." + }, + { + "ItemID": "AZWE001BASE0SI00011000", + "ItemType": "SEMI-PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "IRRPTAUTH..ANYUSER", + "ResourceClass": "PTKTDATA", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To allow Zowe APIML to evaluate passtickets for application. Used for SSO and client certificate authentication." + }, + { + "ItemID": "AZWE001BASE0SI00012000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "IRR.DIGTCERT.LISTRING", + "ResourceClass": "FACILITY", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To allow Zowe user id to access his own keyring." + }, + { + "ItemID": "AZWE001BASE0SI00013000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "SERVER", + "ResourceProfile": "IRR.DIGTCERT.GENCERT", + "ResourceClass": "FACILITY", + "WhoNeedsAccess": "ZWESVUSR", + "LevelOfAccessRequired": "CONTROL", + "ItemDescription": "To optionally allow Zowe user id to use SITE owned certificate as a server certificate." + } + ] +} diff --git a/files/sca/zowe_base_user.json b/files/sca/zowe_base_user.json new file mode 100644 index 0000000000..7653fe28b5 --- /dev/null +++ b/files/sca/zowe_base_user.json @@ -0,0 +1,18 @@ +{ + "ServiceId": "AZWE001BASE0U", + "ServiceName": "Zowe Configuration - User", + "MetaValidationItemVersion": 1.0, + "Vendor": "OPEN MAINFRAME PROJECT", + "SecurityValidationItems": [ + { + "ItemID": "AZWE001BASE0UI00001000", + "ItemType": "PROGRAMMABLE", + "ItemCategory": "USER", + "ResourceProfile": "APIML.SERVICES", + "ResourceClass": "ZOWE", + "WhoNeedsAccess": "", + "LevelOfAccessRequired": "READ", + "ItemDescription": "To allow Zowe user to use API Mediation Layer services." + } + ] +} diff --git a/files/zlux/config/zluxserver.json b/files/zlux/config/zluxserver.json index e246bd654d..9283155557 100644 --- a/files/zlux/config/zluxserver.json +++ b/files/zlux/config/zluxserver.json @@ -28,10 +28,6 @@ //host is for zlux to know, not zss "host": "localhost", "jwt": { - "token": { - "name": "", - "label": "" - }, "fallback": true }, "https": { diff --git a/manifest.json.template b/manifest.json.template index d6f8906e39..440ea2ca4e 100644 --- a/manifest.json.template +++ b/manifest.json.template @@ -12,7 +12,7 @@ }, "binaryDependencies": { "org.zowe.zlux.zlux-core": { - "version": "~2.0.0-v2.x/staging-zlux-core", + "version": "~2.0.0-v2.x-staging-zlux-core", "artifact": "*.pax" }, "org.zowe.zlux.sample-angular-app": { @@ -50,13 +50,13 @@ "version": "~2.0.0-SNAPSHOT" }, "org.zowe.explorer-jes": { - "version": "~2.0.0-V2-X-SNAPSHOT" + "version": "~2.0.0-SNAPSHOT" }, "org.zowe.explorer-mvs": { - "version": "~2.0.0-V2-X-SNAPSHOT" + "version": "~2.0.0-SNAPSHOT" }, "org.zowe.explorer-uss": { - "version": "~2.0.0-V2-X-SNAPSHOT" + "version": "~2.0.0-SNAPSHOT" }, "org.zowe.explorer-ip": { "version": "~1.0.0-SNAPSHOT", @@ -64,31 +64,43 @@ }, "org.zowe.apiml.api-catalog-package": { "version": "~2.0.2-SNAPSHOT", - "artifact": "api-catalog-*.zip" + "artifact": "api-catalog-*.zip", + "exclusions": ["*PR*.zip"] }, "org.zowe.apiml.discovery-package": { "version": "~2.0.2-SNAPSHOT", - "artifact": "discovery-*.zip" + "artifact": "discovery-*.zip", + "exclusions": ["*PR*.zip"] }, "org.zowe.apiml.gateway-package": { "version": "~2.0.2-SNAPSHOT", - "artifact": "gateway-*.zip" + "artifact": "gateway-*.zip", + "exclusions": ["*PR*.zip"] }, "org.zowe.apiml.caching-service-package": { "version": "~2.0.2-SNAPSHOT", - "artifact": "caching-service-*.zip" + "artifact": "caching-service-*.zip", + "exclusions": ["*PR*.zip"] }, "org.zowe.apiml.metrics-service-package": { "version": "~2.0.2-SNAPSHOT", - "artifact": "metrics-service-*.zip" + "artifact": "metrics-service-*.zip", + "exclusions": ["*PR*.zip"] }, "org.zowe.apiml.apiml-common-lib-package": { "version": "~2.0.2-SNAPSHOT", - "artifact": "apiml-common-lib-*.zip" + "artifact": "apiml-common-lib-*.zip", + "exclusions": ["*PR*.zip"] }, "org.zowe.apiml.sdk.common-java-lib-package": { "version": "~1.21.3-SNAPSHOT", - "artifact": "common-java-lib-*.zip" + "artifact": "common-java-lib-*.zip", + "exclusions": ["*PR*.zip"] + }, + "org.zowe.apiml.sdk.apiml-sample-extension-package": { + "version": "~1.27.0-SNAPSHOT", + "artifact": "apiml-sample-extension-*.zip", + "exclusions": ["*PR*.zip"] }, "org.zowe.launcher": { "version": "~2.0.0-SNAPSHOT" @@ -98,7 +110,7 @@ "artifact": "keyring-util-*", "explode": "false", "flat": "true", - "excludePatterns": ["*PR*"] + "exclusions": ["*PR*"] }, "org.zowe.utility_tools": { "version": "~2.0.0-SNAPSHOT" diff --git a/playbooks/README.md b/playbooks/README.md index 226d597ae7..1dff11b5e2 100644 --- a/playbooks/README.md +++ b/playbooks/README.md @@ -2,21 +2,22 @@ This project targets to use Ansible to uninstall / install Zowe. -- [Prepare Environment](#prepare-environment) - - [Verify Inventory and Variables](#verify-inventory-and-variables) - - [Other verifications or tools](#other-verifications-or-tools) -- [Install (Uninstall) Zowe](#install-uninstall-zowe) - - [Convenience Build](#convenience-build) - - [SMPE FMID](#smpe-fmid) - - [SMPE PTF](#smpe-ptf) - - [Uninstall Zowe](#uninstall-zowe) - - [Docker](#docker) - - [Install Zowe Extensions](#install-zowe-extensions) -- [Other Predefined Playbooks](#other-predefined-playbooks) - - [Sanity Test a Zowe Instance](#sanity-test-a-zowe-instance) - - [Start and Stop a Zowe Instance](#start-and-stop-a-zowe-instance) - - [Show Zowe Logs](#show-zowe-logs) -- [Other Build Variables](#other-build-variables) +- [Use Ansible to control Zowe instance](#use-ansible-to-control-zowe-instance) + - [Prepare Environment](#prepare-environment) + - [Verify Inventory and Variables](#verify-inventory-and-variables) + - [Other verifications or tools](#other-verifications-or-tools) + - [Install (Uninstall) Zowe](#install-uninstall-zowe) + - [Convenience Build](#convenience-build) + - [SMPE FMID](#smpe-fmid) + - [SMPE PTF](#smpe-ptf) + - [Uninstall Zowe](#uninstall-zowe) + - [Kubernetes/Openshift](#kubernetesopenshift) + - [Install Zowe Extensions](#install-zowe-extensions) + - [Other Predefined Playbooks](#other-predefined-playbooks) + - [Sanity Test a Zowe Instance](#sanity-test-a-zowe-instance) + - [Start and Stop a Zowe Instance](#start-and-stop-a-zowe-instance) + - [Show Zowe Logs](#show-zowe-logs) + - [Other Build Variables](#other-build-variables) ## Prepare Environment @@ -98,7 +99,7 @@ Please Note: If you want to install a Zowe FMID pre-uploaded to your remote server, you can run the playbook with variable `zowe_build_remote` (You must define `zowe_fmids_dir_remote` if you choose this option): ``` -$ ansible-playbook -l install-fmid.yml -v --extra-vars "zowe_build_remote=AZWE001" +$ ansible-playbook -l install-fmid.yml -v --extra-vars "zowe_build_remote=AZWE002" ``` If you want to install a Zowe downloaded to your local computer, you can run the playbook with variable `zowe_build_local`: @@ -150,35 +151,27 @@ You can uninstall and cleanup the host by running `uninstall.yml` playbook. $ ansible-playbook -l uninstall.yml -v ``` -### Docker +### Kubernetes/Openshift -You can use playbook `install-docker.yml` to start Zowe in a docker container. - -``` -$ ansible-playbook -l install-docker.yml -v -``` +You can use playbook `install-kubernetes.yml` to install Zowe containers in a container orchestration cluster (i.e. Kubernetes, OpenShift, IBM Cloud Kubernetes, Google Cloud Kubernetes) Please Note: +- This install playbook does NOT install Zowe convenience build onto the target z/OS system. But, it will require ZSS, ZIS and z/OSMF be installled and started on z/OS side. +- This install playbook does NOT install any container orchestation cluster. But, it will require one to deploy the Zowe containers. + +There are many environmental variables for this playbook. Since there are different Kubernetes/OpenShift cluster, you can customize environmental variable to accomadate your needs. Please read the README file, found in Kubernetes role folder, for more information about the list of environmental variables can be used for this playboook `install-kubernetes.yml`. -- Similar to `install.yml` playbook, this playbook will install Zowe convenience build onto the target z/OS system, but only ZSS will be started on z/OS side. To customize which convenience build to start, `zowe_build_local` and `zowe_build_url` are also supported. -- The playbook will also start Zowe on your computer in Docker container where this playbook is running. By default, the docker image been used is `ompzowe/server-bundle:amd64`. You can customize it with `zowe_docker_image` and `zowe_docker_tag` variables. -- The install playbook will uninstall Zowe by default. -- The `-v` option allows you to see stdout from server side, which includes installation log, etc. - -If you want to start container with a Zowe Docker image downloaded to your local computer, you can run the playbook with variable `zowe_docker_image_local`: +For example, Install Zowe containers on local Kubernetes service provisioned by Docker-Desktop: ``` -$ ansible-playbook -l install-docker.yml -v --extra-vars "zowe_docker_image_local=/path/to/your/local/server-bundle.tar" +ansible-playbook -l install-kubernetes.yml -e k8s_context=docker-desktop -e ansible_user= -e ansible_password= -e ansible_ssh_host= -e zowe_instance_dir= ``` -If you want to start container with a Zowe Docker image from a URL, you can run the playbook with variable `zowe_docker_image_url`: - +Install Zowe containers on Kubernetes running on BareMetal: ``` -$ ansible-playbook -l install-docker.yml -v --extra-vars "zowe_docker_image_url=https://zowe.jfrog.io/zowe/libs-snapshot-local/org/zowe/1.18.0-STAGING/server-bundle-1.18.0.tar" +ansible-playbook -l install-kubernetes.yml -e kubeconfig=/kubeconfig -e ansible_user= -e ansible_password= -e ansible_ssh_host= -e k8s_gateway_domain="*.nio.io" -e k8s_discovery_domain="*.nio.io" -e k8s_storageclass= -e k8s_service=nodeport -e k8s_list_domain_ip="1.2.3.4.nip.io,1.2.3.4" -e k8s_networking=ingress -e zowe_instance_dir= ``` -For example, you can pick a downloadable Zowe build from https://zowe.jfrog.io/zowe/webapp/#/artifacts/browse/tree/General/libs-snapshot-local/org/zowe. - ### Install Zowe Extensions You can install an extension by providing it's full url to the extension using the `zowe_ext_url` variable. This will download and install the extension onto the specified running Zowe instance: @@ -229,8 +222,6 @@ $ ansible-playbook -l show-logs.yml -v - **zowe_build_local**: An optional string to define where is the Zowe package on your local computer. - **zowe_build_url**: An optional URL string to define where to download Zowe package. - **zowe_build_remote**: An optional string to define the FMID you want to install and the FMID has been pre-uploaded to your target server `zowe_fmids_dir_remote` folder. -- **zowe_docker_image_local**: An optional string to define where is the Zowe Docker image on your local computer. -- **zowe_docker_image_url**: An optional URL string to define where to download Zowe Docker image. - **zowe_ext_local**: A string to define where the Zowe Extension is on your local computer. (one of zowe_ext_local or zowe_ext_url MUST be defined) - **zowe_ext_url**: A string to define where to download the Zowe Extension. (one of zowe_ext_local or zowe_ext_url MUST be defined) - **zos_java_home**: An optional string to customize your Java version by specifying the full path to your Java folder. @@ -240,5 +231,6 @@ $ ansible-playbook -l show-logs.yml -v - **zos_keystore_mode**: An optional string to configure Zowe instance to store certificates into Keyring instead of keystore. Valid values are `` (default value) or `KEYSTORE_MODE_KEYRING`. - **skip_start**: A boolean value to skip automatically starting Zowe after installation. Default value is `false`. - **zowe_uninstall_before_install**: If you want to uninstall Zowe before installing a new version. Default value is `true`. +- **zowe_custom_for_test**: If you want to customize the Zowe instance to run sanity test from zowe-install-packaging. - **ZOWE_COMPONENTS_UPGRADE**: An optional boolean value to enable upgrading Zowe components to the latest version. If set to `true`, the `zowe-upgrade-component.sh` script will be called to upgrade Zowe during the installation process. diff --git a/playbooks/all_host_vars_list.yml b/playbooks/all_host_vars_list.yml index 4202cc83d7..7f5323c83d 100644 --- a/playbooks/all_host_vars_list.yml +++ b/playbooks/all_host_vars_list.yml @@ -5,24 +5,32 @@ # You can use this as starting point of a new host or host group. +convert_for_k8s: +k8s_context: +k8s_discovery_domain: +k8s_gateway_domain: +k8s_list_domain_ip: localhost +k8s_networking: +k8s_pv_name: +k8s_required_apps: ["api-catalog", "app-server", "caching", "explorer-jes", "explorer-mvs", "explorer-uss", "discovery", "files-api", "gateway", "jobs-api"] +k8s_service: loadbalancer +k8s_storageclass: +kubeconfig: work_dir_remote: zos_java_home: zos_node_home: -zos_keystore_mode: zos_security_system: RACF zos_vsam_rls: false zos_zosmf_ca: zos_zosmf_host: zos_zosmf_port: 10443 zos_zosmf_user: IZUSVR -zowe_apiml_allow_encoded_slashes: true zowe_apiml_catalog_port: 7552 -zowe_apiml_cors_enabled: false zowe_apiml_discovery_port: 7553 zowe_apiml_gateway_port: 7554 zowe_apiml_gateway_timeout_millis: 600000 +zowe_apiml_metrics_service_port: 7551 zowe_apiml_nonstrict_verify_certficates_of_services: true -zowe_apiml_prefer_ip_address: false zowe_apiml_security_auth_provider: zosmf zowe_apiml_security_x509_enabled: false zowe_apiml_security_zosmf_applid: IZUDFLT @@ -47,6 +55,7 @@ zowe_fmids_dir_remote: zowe_install_logs_dir: ~/.zowe/logs zowe_instance_dir: ~/.zowe/instance zowe_instance_id: 1 +zowe_jcllib: zowe_job_prefix: ZWE zowe_jobs_api_port: 7600 zowe_jobs_explorer_port: 7560 @@ -58,17 +67,17 @@ zowe_keystore_alias: localhost zowe_keystore_dir: ~/.zowe/keystore zowe_keystore_password: password zowe_launch_components: -# Restrict permissions to keystores after the certificate setup script +zowe_launch_scripts_loglevel: zowe_lock_keystore: true -zowe_logs_dir: ~/.zowe/logs zowe_mvs_api_port: 7559 zowe_mvs_explorer_port: 7561 zowe_proclib_dsname: auto -zowe_proclib_membername: ZWESVSTC +zowe_proclib_membername: ZWESLSTC zowe_ptf_install_jcls: zowe_root_dir: ~/zowe zowe_runtime_group: ZWEADMIN zowe_runtime_user: ZWESVUSR +zowe_sanity_test_debug_mode: "" zowe_smpe_dir_prefix: /var zowe_smpe_hlq_csi: zowe_smpe_hlq_dsn: @@ -78,13 +87,11 @@ zowe_smpe_rel_file_prefix: zowe_smpe_volser: zowe_test_password: zowe_test_user: -zowe_token_label: jwtsecret -zowe_token_name: ZWETOKEN zowe_user_profile: ~/.zowe_profile zowe_uss_explorer_port: 7562 -# this variable is deprecated in favor of zowe_dataset_prefix zowe_xmem_loadlib: zowe_xmem_parmlib: +zowe_xmem_pluginlib: zowe_xmem_proclib: zowe_xmem_proclib_member_aux: ZWESASTC zowe_xmem_proclib_member_zss: ZWESISTC @@ -99,3 +106,4 @@ zowe_zosmf_certificate: zowe_zss_https: True zowe_zss_port: 7557 zowe_zss_xmem_name: ZWESIS_STD +zwe_command_verbose_level: "-vv" diff --git a/playbooks/ansible.cfg b/playbooks/ansible.cfg index 214b1f51d3..6e42afc361 100644 --- a/playbooks/ansible.cfg +++ b/playbooks/ansible.cfg @@ -29,7 +29,7 @@ callback_whitelist = profile_tasks # avoid adding host key to known_hosts host_key_checking=False # default to use yaml callback, which is easier to read -stdout_callback=yaml +stdout_callback=debug [privilege_escalation] #become=True diff --git a/playbooks/group_vars/marist.yml b/playbooks/group_vars/marist.yml index a10d4c8dec..41f8c58fa2 100644 --- a/playbooks/group_vars/marist.yml +++ b/playbooks/group_vars/marist.yml @@ -6,15 +6,15 @@ zowe_root_dir: /ZOWE/staging/zowe zowe_instance_dir: /ZOWE/tmp/.zowe zowe_extension_dir: /ZOWE/extensions zowe_keystore_dir: /ZOWE/tmp/keystore -zowe_logs_dir: /ZOWE/tmp/logs zowe_install_logs_dir: /ZOWE/tmp/logs zowe_dataset_prefix: ZOWEAD3.ZWE zowe_apiml_verify_certficates_of_services: false # enable Non-Strict verify certificates by default zowe_apiml_nonstrict_verify_certficates_of_services: true +zowe_jcllib: ZOWEAD3.JCLLIB zowe_xmem_proclib: VENDOR.PROCLIB -# this variable is deprecated in favor of zowe_dataset_prefix zowe_xmem_loadlib: ZOWEAD3.LOADLIB +zowe_xmem_pluginlib: ZOWEAD3.PLUGLIB zowe_xmem_parmlib: ZOWEAD3.PARMLIB # # variables for zowe smpe uninstallation and installation # during uninstallation, any data-sets start with {this}.ZOWE.{fmid} will be removed diff --git a/playbooks/group_vars/zdnt.yml b/playbooks/group_vars/zdnt.yml deleted file mode 100644 index dcabe783dd..0000000000 --- a/playbooks/group_vars/zdnt.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -# our zD&T instances are located at this server -ansible_ssh_host: river.zowe.org - -################################################################################ -# variables for zowe uninstallation and installation -work_dir_remote: /zaas1/zowe/ansible -zowe_fmids_dir_remote: /zaas1/zowe/fmids -zowe_zos_host: river.zowe.org -zowe_external_ip_address: 37.58.118.251 -zowe_root_dir: /zaas1/zowe/runtime -zowe_instance_dir: /zaas1/zowe/instance -zowe_keystore_dir: /zaas1/zowe/keystore -zowe_install_logs_dir: /zaas1/zowe/logs -zowe_dataset_prefix: TSTRADM.ZWE -zowe_apiml_verify_certficates_of_services: false -zowe_apiml_nonstrict_verify_certficates_of_services: false -zowe_proclib_dsname: ZAAS1.PROCLIB -zowe_xmem_proclib: ZAAS1.PROCLIB -# this variable is deprecated in favor of zowe_dataset_prefix -zowe_xmem_loadlib: TSTRADM.LOADLIB -zowe_xmem_parmlib: TSTRADM.PARMLIB -# variables for zowe smpe uninstallation and installation -# during uninstallation, any data-sets start with {this}.ZOWE.{fmid} will be removed -zowe_smpe_hlq_dsn: ZOWE -# during uninstallation, any data-sets start with this will be removed -zowe_smpe_hlq_csi: ZOWE.SMPE -zowe_smpe_hlq_tzone: ZOWE.SMPE -zowe_smpe_hlq_dzone: ZOWE.SMPE -zowe_smpe_dir_prefix: /zaas1/zowe/runtime -zowe_smpe_rel_file_prefix: ZOWE -zowe_smpe_volser: B3IME1 -# caching service volume -zowe_caching_vsam_volume: B3IME1 diff --git a/playbooks/group_vars/zoweNode.yml b/playbooks/group_vars/zoweNode.yml index 6e3d78ef3b..cb043ac1ac 100644 --- a/playbooks/group_vars/zoweNode.yml +++ b/playbooks/group_vars/zoweNode.yml @@ -15,7 +15,6 @@ zowe_root_dir: /opt/zowe/runtime zowe_extension_dir: /opt/zowe/extensions zowe_instance_dir: /opt/zowe/zowe-instance-dir zowe_keystore_dir: /opt/zowe/keystore -zowe_logs_dir: /opt/zowe/logs zowe_install_logs_dir: /opt/zowe/logs zos_zosmf_port: 443 @@ -24,10 +23,11 @@ zowe_apiml_verify_certficates_of_services: false zowe_apiml_nonstrict_verify_certficates_of_services: false # the current z/OSMF level doesn't support some jwt features, fall back to use LTPA mode zowe_apiml_security_zosmf_jwt_autoconfiguration_mode: LTPA +zowe_jcllib: IBMUSER.JCLLIB zowe_proclib_dsname: USER.PROCLIB zowe_xmem_proclib: USER.PROCLIB -# this variable is deprecated in favor of zowe_dataset_prefix zowe_xmem_loadlib: IBMUSER.LOADLIB +zowe_xmem_pluginlib: IBMUSER.PLUGLIB zowe_xmem_parmlib: IBMUSER.PARMLIB # variables for zowe smpe uninstallation and installation # during uninstallation, any data-sets start with {this}.ZOWE.{fmid} will be removed diff --git a/playbooks/host_vars/marist-1.yml b/playbooks/host_vars/marist-1.yml index b898acfb28..5fc91905bd 100644 --- a/playbooks/host_vars/marist-1.yml +++ b/playbooks/host_vars/marist-1.yml @@ -1,5 +1,3 @@ --- zowe_sanity_test_testcases: "./test/**/!(api-doc-gen).js" -zowe_token_name: ZWETOKEN -zowe_token_label: ZoweJwtSecret zowe_apiml_security_x509_enabled: true diff --git a/playbooks/host_vars/marist-2.yml b/playbooks/host_vars/marist-2.yml index 7d2a71a523..1db9a4872f 100644 --- a/playbooks/host_vars/marist-2.yml +++ b/playbooks/host_vars/marist-2.yml @@ -1,4 +1,3 @@ --- zos_security_system: ACF2 -zowe_token_label: JWTSECRET zos_zosmf_ca: ZOSMFSRV diff --git a/playbooks/host_vars/marist-3.yml b/playbooks/host_vars/marist-3.yml index 652339b67f..15d5cf768b 100644 --- a/playbooks/host_vars/marist-3.yml +++ b/playbooks/host_vars/marist-3.yml @@ -1,7 +1,5 @@ --- zos_security_system: TSS zowe_sanity_test_testcases: "./test/**/!(api-doc-gen).js" -zowe_token_name: ZWETOKEN -zowe_token_label: ZoweJwtSecret zowe_apiml_security_x509_enabled: true zos_zosmf_ca: ZOSMFCA diff --git a/playbooks/host_vars/marist-4.yml b/playbooks/host_vars/marist-4.yml index 416698fbcb..03eae52b3a 100644 --- a/playbooks/host_vars/marist-4.yml +++ b/playbooks/host_vars/marist-4.yml @@ -1,7 +1,5 @@ --- zowe_sanity_test_testcases: "./test/**/!(api-doc-gen).js" -zowe_token_name: ZWETOKEN -zowe_token_label: ZoweJwtSecret zowe_apiml_security_x509_enabled: true work_dir_remote: /ZOWE/ansible @@ -9,5 +7,7 @@ zowe_root_dir: /ZOWE/runtime zowe_instance_dir: /ZOWE/instance zowe_extension_dir: /ZOWE/extensions zowe_keystore_dir: /ZOWE/keystore -zowe_logs_dir: /ZOWE/logs zowe_install_logs_dir: /ZOWE/logs + +zowe_smpe_volser: ZOWE03 +zowe_caching_vsam_volume: ZOWE03 diff --git a/playbooks/host_vars/river-0.yml b/playbooks/host_vars/river-0.yml deleted file mode 100644 index c904511609..0000000000 --- a/playbooks/host_vars/river-0.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -ansible_port: 2022 -ansible_user: -ansible_password: diff --git a/playbooks/host_vars/river-1.yml b/playbooks/host_vars/river-1.yml deleted file mode 100644 index 66bc1ba404..0000000000 --- a/playbooks/host_vars/river-1.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -ansible_port: 50001 -ansible_user: -ansible_password: - -# zowe running in container -zos_zosmf_port: 50018 diff --git a/playbooks/host_vars/river-3.yml b/playbooks/host_vars/river-3.yml deleted file mode 100644 index 3661b71f13..0000000000 --- a/playbooks/host_vars/river-3.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -ansible_port: 53001 -ansible_user: -ansible_password: - -# zowe running in container -zos_zosmf_port: 53018 -# zos_node_home: /zaas1/node/node-v8.16.0-os390-s390x -zowe_apiml_catalog_port: 53008 -zowe_apiml_discovery_port: 53009 -zowe_apiml_gateway_port: 53010 -zowe_jobs_api_port: 53013 -zowe_mvs_api_port: 53015 -zowe_jobs_explorer_port: 53014 -zowe_mvs_explorer_port: 53016 -zowe_uss_explorer_port: 53017 -zowe_zlux_port: 53011 -zowe_zss_port: 53012 -zowe_smpe_volser: D3IME1 -# caching service volume -zowe_caching_vsam_volume: D3IME1 - -zowe_extra_environment_variables: - # TVT image has an error when executing netstat - # EZZ2376I Could not determine TCPIPjobname, using default of 'INET' - # EZZ2377I Could not establish affinity with INET (1011/11B3005A) - can not provide the requested option information - # to fix it, this variable is required - RESOLVER_CONFIG: "\"//'ADCD.Z23D.TCPPARMS(TCPDATA)'\"" diff --git a/playbooks/host_vars/tivlp46.yml b/playbooks/host_vars/tivlp46.yml index 42053db22e..659540f842 100644 --- a/playbooks/host_vars/tivlp46.yml +++ b/playbooks/host_vars/tivlp46.yml @@ -9,7 +9,6 @@ work_dir_remote: /var/zowe/ansible zowe_root_dir: /var/zowe/runtime zowe_instance_dir: /var/zowe/zowe-instance-dir zowe_keystore_dir: /var/zowe/keystore -zowe_logs_dir: /var/zowe/logs zowe_install_logs_dir: /var/zowe/logs zos_zosmf_port: 443 diff --git a/playbooks/host_vars/tvt4188.yml b/playbooks/host_vars/tvt4188.yml index ee9cad8527..ce58c19764 100644 --- a/playbooks/host_vars/tvt4188.yml +++ b/playbooks/host_vars/tvt4188.yml @@ -19,6 +19,4 @@ zowe_caching_vsam_volume: T41882 zowe_external_ip_address: 9.30.241.209 zowe_zlux_terminal_telnet_port: 992 zowe_zlux_terminal_telnet_security_type: tls -zowe_token_name: ZWETOKEN -zowe_token_label: jwtsecret zowe_apiml_security_x509_enabled: true diff --git a/playbooks/host_vars/tvt5064.yml b/playbooks/host_vars/tvt5064.yml index 407b8d84a2..0cedfbfae8 100644 --- a/playbooks/host_vars/tvt5064.yml +++ b/playbooks/host_vars/tvt5064.yml @@ -19,6 +19,4 @@ zowe_caching_vsam_volume: T41882 zowe_external_ip_address: 9.30.242.21 zowe_zlux_terminal_telnet_port: 992 zowe_zlux_terminal_telnet_security_type: tls -zowe_token_name: ZWETOKEN -zowe_token_label: jwtsecret zowe_apiml_security_x509_enabled: true diff --git a/playbooks/host_vars/tvt6019.yml b/playbooks/host_vars/tvt6019.yml index e8280cdd48..c784ea5128 100644 --- a/playbooks/host_vars/tvt6019.yml +++ b/playbooks/host_vars/tvt6019.yml @@ -20,6 +20,4 @@ zowe_caching_vsam_volume: T60195 zowe_external_ip_address: 9.30.242.85 zowe_zlux_terminal_telnet_port: 992 zowe_zlux_terminal_telnet_security_type: tls -zowe_token_name: ZWETOKEN -zowe_token_label: jwtsecret zowe_apiml_security_x509_enabled: true diff --git a/playbooks/host_vars/tvt6080.yml b/playbooks/host_vars/tvt6080.yml index 014fe4a87b..4cda1ace02 100644 --- a/playbooks/host_vars/tvt6080.yml +++ b/playbooks/host_vars/tvt6080.yml @@ -20,6 +20,4 @@ zowe_caching_vsam_volume: T60804 zowe_external_ip_address: 9.30.242.131 zowe_zlux_terminal_telnet_port: 992 zowe_zlux_terminal_telnet_security_type: tls -zowe_token_name: ZWETOKEN -zowe_token_label: jwtsecret zowe_apiml_security_x509_enabled: true diff --git a/playbooks/host_vars/vm30051.yml b/playbooks/host_vars/vm30051.yml index 509bed512f..bcd298d520 100644 --- a/playbooks/host_vars/vm30051.yml +++ b/playbooks/host_vars/vm30051.yml @@ -11,6 +11,4 @@ zowe_zlux_terminal_telnet_port: 992 zowe_zlux_terminal_telnet_security_type: tls # caching service volume zowe_caching_vsam_volume: V3051A -zowe_token_name: ZWETOKEN -zowe_token_label: jwtsecret zowe_apiml_security_x509_enabled: true diff --git a/playbooks/host_vars/vm30102.yml b/playbooks/host_vars/vm30102.yml index bc76c90407..28c29f6c1b 100644 --- a/playbooks/host_vars/vm30102.yml +++ b/playbooks/host_vars/vm30102.yml @@ -10,7 +10,6 @@ work_dir_remote: /var/zowe/ansible zowe_root_dir: /var/zowe/runtime zowe_instance_dir: /var/zowe/zowe-instance-dir zowe_keystore_dir: /var/zowe/keystore -zowe_logs_dir: /var/zowe/logs zowe_install_logs_dir: /var/zowe/logs zowe_apiml_verify_certficates_of_services: false diff --git a/playbooks/host_vars/wlag.yml b/playbooks/host_vars/wlag.yml index abba348768..a456a225c9 100644 --- a/playbooks/host_vars/wlag.yml +++ b/playbooks/host_vars/wlag.yml @@ -9,15 +9,15 @@ work_dir_remote: /var/zowe/ansible zowe_root_dir: /var/zowe/runtime zowe_instance_dir: /var/zowe/zowe-instance-dir zowe_keystore_dir: /var/zowe/keystore -zowe_logs_dir: /var/zowe/logs zowe_install_logs_dir: /var/zowe/logs zowe_dataset_prefix: ZWE.V1R0M0 zowe_apiml_verify_certficates_of_services: false +zowe_jcllib: CLJIA.JCLLIB zowe_proclib_dsname: DSWMG.PROCLIB zowe_xmem_proclib: DSWMG.PROCLIB -# this variable is deprecated in favor of zowe_dataset_prefix zowe_xmem_loadlib: CLJIA.LOADLIB +zowe_xmem_pluginlib: CLJIA.PLUGLIB zowe_xmem_parmlib: CLJIA.PARMLIB # variables for zowe smpe uninstallation and installation # during uninstallation, any data-sets start with {this}.ZOWE.{fmid} will be removed diff --git a/playbooks/hosts b/playbooks/hosts index 7f222041a3..2fabf917b3 100644 --- a/playbooks/hosts +++ b/playbooks/hosts @@ -1,16 +1,8 @@ -[river] -river-0 -river-1 -river-3 - [marist] marist-2 marist-3 marist-4 -[zdnt:children] -river - [tvt] tvt4188 tvt6019 @@ -30,5 +22,3 @@ wlag tvt vm ext - - diff --git a/playbooks/install-docker.yml b/playbooks/install-docker.yml deleted file mode 100644 index 068bf0c07e..0000000000 --- a/playbooks/install-docker.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- - # input: - # - zowe_build_url: optional, full url of zowe build - # - zowe_build_local: optional, path to zowe build exists locally - - name: Test Docker - hosts: all - gather_facts: false - become: false - - tasks: - - # ============================================================================ - # prepare ansible environment for install - - import_role: - name: common - - - import_role: - name: zos - - # ============================================================================ - # uninstall zowe - - name: Uninstall Zowe - when: zowe_uninstall_before_install|default(True) - block: - - import_role: - name: zowe - tasks_from: uninstall - - import_role: - name: fmid - tasks_from: uninstall - - # ============================================================================ - # Upload zowe - - import_role: - name: common - tasks_from: upload-zowe - - # ============================================================================ - # Install Zowe - - import_role: - name: zowe - - # ============================================================================ - # Configure zowe on zos for docker - - import_role: - name: docker - tasks_from: configure-zowe-for-docker - - # ============================================================================ - # Start Zowe - - import_role: - name: start - when: not skip_start|default(False) - - - import_role: - name: docker diff --git a/playbooks/install-fmid.yml b/playbooks/install-fmid.yml index c095977c31..715838ec28 100644 --- a/playbooks/install-fmid.yml +++ b/playbooks/install-fmid.yml @@ -60,7 +60,7 @@ # ============================================================================ # if zowe_build_remote is set, we copy the FMID from zowe_fmids_dir_remote to our work folder - # the value of zowe_build_remote should be FMID like AZWE001 + # the value of zowe_build_remote should be FMID like AZWE002 - name: Copy Zowe FMID files from {{ zowe_fmids_dir_remote }}/{{ zowe_build_remote }} if it has value when: zowe_build_remote is defined import_role: @@ -84,6 +84,12 @@ - import_role: name: configfmid + # ============================================================================ + # Customize for testing + - import_role: + name: custom_for_test + when: zowe_custom_for_test|default(False) + # ============================================================================ # Start Zowe - import_role: diff --git a/playbooks/install-kubernetes.yml b/playbooks/install-kubernetes.yml new file mode 100644 index 0000000000..49c0459cd8 --- /dev/null +++ b/playbooks/install-kubernetes.yml @@ -0,0 +1,21 @@ +--- + # input: + # - kubeconfig: required, a file used to configure access to Kubernetes. + # Can be found in the Kubernetes Node: ~/.kube/config. Update server field from local to actual Node IP (local = 127.0.0.1) + # - ansible_user: z/OS host's User. + # - ansible_password: z/OS host's Password + # - ansible_ssh_host: z/OS host + # For example: ansible-playbook -l localhost install-kubernetes.yml -e kubeconfig=/kubeconfig \ + # -e ansible_user= -e ansible_password= -e ansible_ssh_host= + - name: Test Kuberenetes + hosts: all + gather_facts: false + become: false + roles: + - kwoodson.yedit + + tasks: + # ============================================================================ + # Uninstall and Deploy Zowe Kubernetes + - import_role: + name: kubernetes diff --git a/playbooks/install-ptf.yml b/playbooks/install-ptf.yml index 8a969d9575..fa5650017a 100644 --- a/playbooks/install-ptf.yml +++ b/playbooks/install-ptf.yml @@ -81,6 +81,12 @@ name: configfmid tasks_from: validate_configuration + # ============================================================================ + # Customize for testing + - import_role: + name: custom_for_test + when: zowe_custom_for_test|default(False) + # ============================================================================ # Start Zowe - import_role: diff --git a/playbooks/install.yml b/playbooks/install.yml index 1817a66814..ac518d5d57 100644 --- a/playbooks/install.yml +++ b/playbooks/install.yml @@ -44,6 +44,12 @@ - import_role: name: configure + # ============================================================================ + # Customize for testing + - import_role: + name: custom_for_test + when: zowe_custom_for_test|default(False) + # ============================================================================ # Start Zowe - import_role: diff --git a/playbooks/roles/api-generation/defaults/main.yml b/playbooks/roles/api-generation/defaults/main.yml index 0fce27afcd..684f784588 100644 --- a/playbooks/roles/api-generation/defaults/main.yml +++ b/playbooks/roles/api-generation/defaults/main.yml @@ -24,7 +24,7 @@ zowe_root_dir: ~/zowe zowe_instance_dir: ~/.zowe/instance # zowe job prefix. zowe_job_prefix: ZWE -zowe_proclib_membername: ZWESVSTC +zowe_proclib_membername: ZWESLSTC # ports will be tested zowe_apiml_gateway_port: 7554 zowe_jobs_api_port: 7600 diff --git a/playbooks/roles/common/defaults/main.yml b/playbooks/roles/common/defaults/main.yml index 084d3f4d25..74e3ed16fd 100644 --- a/playbooks/roles/common/defaults/main.yml +++ b/playbooks/roles/common/defaults/main.yml @@ -11,6 +11,8 @@ zos_node_home: file_upload_method: sftp # if we perform hash (MD5) check before uploading the file file_upload_hashcheck: false +# instanceDir +zowe_instance_dir: ~/.zowe/instance # default the security system to RACF. Should be one of RACF, ACF2, or TSS zos_security_system: RACF diff --git a/playbooks/roles/common/tasks/prepare_default_values.yml b/playbooks/roles/common/tasks/prepare_default_values.yml index a48cb6ee0b..e5f9e58795 100644 --- a/playbooks/roles/common/tasks/prepare_default_values.yml +++ b/playbooks/roles/common/tasks/prepare_default_values.yml @@ -26,3 +26,12 @@ set_fact: zowe_external_domain_name: "{{ zowe_zos_host|default('') }}" when: zowe_external_domain_name == '' or zowe_external_domain_name is none + +- name: Find z/OS IP address if it's not defined + when: zowe_external_ip_address is undefined or zowe_external_ip_address is none or zowe_external_ip_address|length == 0 + block: + - name: Set ip address + raw: dig +short $(hostname) | sed -n 2p + register: zowe_external_ip_address_output + - set_fact: + zowe_external_ip_address: "{{ zowe_external_ip_address_output.stdout | trim}}" diff --git a/playbooks/roles/common/tasks/prepare_envvars.yml b/playbooks/roles/common/tasks/prepare_envvars.yml index 8c56ae6329..ec8adb3097 100644 --- a/playbooks/roles/common/tasks/prepare_envvars.yml +++ b/playbooks/roles/common/tasks/prepare_envvars.yml @@ -17,3 +17,6 @@ set_fact: zowe_environment_variable_overrides: "{{ zowe_environment_variable_overrides }} && export {{ item.key }}={{ item.value }}" loop: "{{ zowe_extra_environment_variables|dict2items }}" +- name: Set zowe.yaml file path + set_fact: + zowe_environment_variable_overrides: "{{ zowe_environment_variable_overrides }} && export ZWE_CLI_PARAMETER_CONFIG=\"{{ zowe_instance_dir }}/zowe.yaml\"" diff --git a/playbooks/roles/configfmid/README.md b/playbooks/roles/configfmid/README.md index 0760fe8aa2..a3a93cced6 100644 --- a/playbooks/roles/configfmid/README.md +++ b/playbooks/roles/configfmid/README.md @@ -1,5 +1,5 @@ -# Ansible Role - Configure Zowe FMID +# Ansible Role - Configure Zowe convenience build and PTF -This role will configure Zowe after Zowe FMID has been laid down on the server. +This role will configure Zowe after Zowe runtime has been laid down on the server. -This role is separated from `configure` role because with new changes go into `configure`, it may not be compatible with configuring FMID. +Please note: if you want to configure FMID, should use `configfmid` role. diff --git a/playbooks/roles/configfmid/defaults/main.yml b/playbooks/roles/configfmid/defaults/main.yml index 7397752f42..fc2b8ff1eb 100644 --- a/playbooks/roles/configfmid/defaults/main.yml +++ b/playbooks/roles/configfmid/defaults/main.yml @@ -3,6 +3,27 @@ # Constants # ============================================================================== +# full core components list, they should show up in components section in zowe.yaml +zowe_core_components: +- gateway +- metrics-service +- api-catalog +- discovery +- caching-service +- app-server +- zss +- jobs-api +- files-api +- explorer-jes +- explorer-mvs +- explorer-uss + +# this should list all known cross memory server stc we ever setup during install +zowe_known_xmem_proc_stcs: +- ZWESIS01 +- ZWEXMSTC +- ZWESISTC + # ============================================================================== # Variables should be verified and overwrittern. # ============================================================================== @@ -10,10 +31,15 @@ work_dir_remote: # default zowe runtime root directory zowe_root_dir: ~/zowe +# if your z/OS system has VSAM RLS (record level sharing) enabled. +# usually this value should be true in Parallel Sysplex. +zos_vsam_rls: false # dataset prefix where zowe will be installed zowe_dataset_prefix: # instanceDir zowe_instance_dir: ~/.zowe/instance +# install logs directory +zowe_install_logs_dir: ~/.zowe/logs # zowe job prefix. zowe_job_prefix: ZWE # instance id. This will be put into zowe job name after {{ zowe_job_prefix }} @@ -22,17 +48,37 @@ zowe_instance_id: 1 zos_zosmf_host: # default z/OSMF port zos_zosmf_port: 10443 +# default z/OSMF user +zos_zosmf_user: IZUSVR +# default z/OSMF Certificate Authority +zos_zosmf_ca: # APIML ports +zowe_apiml_metrics_service_port: 7551 zowe_apiml_catalog_port: 7552 zowe_apiml_discovery_port: 7553 zowe_apiml_gateway_port: 7554 zowe_apiml_verify_certficates_of_services: true +zowe_apiml_nonstrict_verify_certficates_of_services: true +# APIML configuration properties +zowe_apiml_gateway_timeout_millis: 600000 +zowe_apiml_security_x509_enabled: false +zowe_apiml_security_zosmf_applid: IZUDFLT +zowe_apiml_security_auth_provider: zosmf +zowe_apiml_security_zosmf_jwt_autoconfiguration_mode: auto # explorer APIs/plugins ports zowe_jobs_api_port: 7600 zowe_mvs_api_port: 7559 zowe_jobs_explorer_port: 7560 zowe_mvs_explorer_port: 7561 zowe_uss_explorer_port: 7562 +# caching service +zowe_caching_service_port: 7555 +zowe_caching_service_persistent: VSAM +# the final data set name will be: {zowe_dataset_prefix}.{zowe_caching_service_vsam_dsprefix}{zowe_instance_id} +# for example: IBMUSER.ZWE.CACHE1 +zowe_caching_service_vsam_dsprefix: CACHE +zowe_caching_vsam_storage_class: +zowe_caching_vsam_volume: # zlux ports zowe_zlux_port: 7556 zowe_zss_https: True @@ -49,10 +95,14 @@ zowe_external_certficate_alias: zowe_external_certficate_authorities: zowe_keystore_dir: ~/.zowe/keystore zowe_keystore_password: password -zowe_keystore_alias: localhost +zowe_keyring_alias: ZoweKeyring zowe_keyring_certname: ZoweCert +zowe_keyring_external_intermediate_ca: +zowe_keyring_external_root_ca: +zowe_keystore_alias: localhost +zowe_jcllib: zowe_proclib_dsname: auto -zowe_proclib_membername: ZWESVSTC +zowe_proclib_membername: ZWESLSTC zowe_runtime_user: ZWESVUSR zowe_runtime_group: ZWEADMIN zowe_auto_create_user_group: false @@ -63,8 +113,9 @@ zowe_configure_skip_zwesecur: false # these are default variables for cross memory configuration zowe_xmem_proclib: zowe_xmem_parmlib: -# this variable is deprecated in favor of zowe_dataset_prefix +# this is optional, it will fall back to {{zowe_dataset_prefix}}.SZWEAUTH zowe_xmem_loadlib: +zowe_xmem_pluginlib: zowe_xmem_proclib_member_zss: ZWESISTC zowe_xmem_proclib_member_aux: ZWESASTC zowe_xmem_stc_user: ZWESIUSR @@ -80,6 +131,9 @@ zowe_external_domain_name: # optional, no default value # required for zD&T (external IP is different from internal IP) zowe_external_ip_address: - -# property added to instance.env for extender test - Note this variable is for PTF installation verification purpose, not used by any extensions. You are safe to ignore. -zowe_extender_test_property: EXAMPLE_EXTENDER_PROPERTY=TEST123 +# Restrict permissions to keystore/truststore after the certificate setup script +zowe_lock_keystore: true +# comma separated string +zowe_launch_components: +# log level for Zowe launch scripts +zowe_launch_scripts_loglevel: diff --git a/playbooks/roles/configfmid/tasks/configure_instance.yml b/playbooks/roles/configfmid/tasks/configure_instance.yml deleted file mode 100644 index 2531de7721..0000000000 --- a/playbooks/roles/configfmid/tasks/configure_instance.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -# this playbook call bin/zowe-configure-instance.sh to create instance -- name: Create Zowe instance - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/bin" - script_filename: ./zowe-configure-instance.sh - script_parameters: "-c \"{{ zowe_instance_dir }}\"" - -- name: Check instance directory - raw: test -f "{{ zowe_instance_dir }}/bin/zowe-start.sh" - register: zowe_configure_instance_result - -- name: Check file existence check exit code - fail: - msg: "After configuring instance, {{ zowe_instance_dir }}/bin/zowe-start.sh doesn't exist." - when: zowe_configure_instance_result.rc != 0 - -- name: Update instance.env - raw: >- - cat "{{ zowe_instance_dir }}/instance.env" | \ - sed -e "s+^ZOWE_EXPLORER_HOST=.*\$+ZOWE_EXPLORER_HOST={{ zowe_zos_host }}+" | \ - sed -e "s+^ZOWE_PREFIX=.*\$+ZOWE_PREFIX={{ zowe_job_prefix }}+" | \ - sed -e "s+^ZOWE_INSTANCE=.*\$+ZOWE_INSTANCE={{ zowe_instance_id }}+" | \ - sed -e "s+^ZOSMF_HOST=.*\$+ZOSMF_HOST={{ zos_zosmf_host }}+" | \ - sed -e "s+^ZOSMF_PORT=.*\$+ZOSMF_PORT={{ zos_zosmf_port }}+" | \ - sed -e "s+^KEYSTORE_DIRECTORY=.*\$+KEYSTORE_DIRECTORY={{ zowe_keystore_dir }}+" | \ - sed -e "s+^CATALOG_PORT=.*\$+CATALOG_PORT={{ zowe_apiml_catalog_port }}+" | \ - sed -e "s+^DISCOVERY_PORT=.*\$+DISCOVERY_PORT={{ zowe_apiml_discovery_port }}+" | \ - sed -e "s+^GATEWAY_PORT=.*\$+GATEWAY_PORT={{ zowe_apiml_gateway_port }}+" | \ - sed -e "s+^JOBS_API_PORT=.*\$+JOBS_API_PORT={{ zowe_jobs_api_port }}+" | \ - sed -e "s+^FILES_API_PORT=.*\$+FILES_API_PORT={{ zowe_mvs_api_port }}+" | \ - sed -e "s+^JES_EXPLORER_UI_PORT=.*\$+JES_EXPLORER_UI_PORT={{ zowe_jobs_explorer_port }}+" | \ - sed -e "s+^MVS_EXPLORER_UI_PORT=.*\$+MVS_EXPLORER_UI_PORT={{ zowe_mvs_explorer_port }}+" | \ - sed -e "s+^USS_EXPLORER_UI_PORT=.*\$+USS_EXPLORER_UI_PORT={{ zowe_uss_explorer_port }}+" | \ - sed -e "s+^ZWED_SERVER_HTTPS_PORT=.*\$+ZWED_SERVER_HTTPS_PORT={{ zowe_zlux_port }}+" | \ - sed -e "s+^ZWES_SERVER_PORT=.*\$+ZWES_SERVER_PORT={{ zowe_zss_port }}+" | \ - sed -e "s+^ZWES_XMEM_SERVER_NAME=.*\$+ZWES_XMEM_SERVER_NAME={{ zowe_zss_xmem_name }}+" | \ - sed -e "s+^ZWED_SSH_PORT=.*\$+ZWED_SSH_PORT={{ zowe_zlux_terminal_ssh_port }}+" | \ - sed -e "s+^ZWED_TN3270_PORT=.*\$+ZWED_TN3270_PORT={{ zowe_zlux_terminal_telnet_port }}+" | \ - sed -e "s+^ZWED_TN3270_SECURITY=.*\$+ZWED_TN3270_SECURITY={{ zowe_zlux_terminal_telnet_security_type }}+" \ - > "{{ zowe_instance_dir }}/instance.env.tmp" && \ - mv "{{ zowe_instance_dir }}/instance.env.tmp" "{{ zowe_instance_dir }}/instance.env" - -- name: Add 'extension' parameter to instance.env - raw: echo "{{ zowe_extender_test_property }}" >> "{{ zowe_instance_dir }}/instance.env" - -- name: Show instance.env - raw: cat "{{ zowe_instance_dir }}/instance.env" diff --git a/playbooks/roles/configfmid/tasks/create_security_defn.yml b/playbooks/roles/configfmid/tasks/create_security_defn.yml deleted file mode 100644 index 8321d73bce..0000000000 --- a/playbooks/roles/configfmid/tasks/create_security_defn.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -# this playbook runs SZWESAMP(ZWESECUR) -- name: Remove ZWESECUR.jcl or ZWESECUR.raw.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWESECUR.raw.jcl"; - rm -f "{{ work_dir_remote }}/ZWESECUR.jcl" - -- name: Copy SZWESAMP(ZWESECUR) to USS - raw: cp "//'{{ zowe_dataset_prefix }}.SZWESAMP(ZWESECUR)'" "{{ work_dir_remote }}/ZWESECUR.raw.jcl" - -- name: Update ZWESECUR.jcl with configurations - raw: >- - cat "{{ work_dir_remote }}/ZWESECUR.raw.jcl" | \ - sed -e "s+ADMINGRP=ZWEADMIN+ADMINGRP={{ zowe_runtime_group }}+" | \ - sed -e "s+ZOWEUSER=ZWESVUSR+ZOWEUSER={{ zowe_runtime_user }}+" | \ - sed -e "s+ZSSUSER=ZWESIUSR+ZSSUSER={{ zowe_xmem_stc_user }}+" | \ - sed -e "s+ZOWESTC=ZWESVSTC+ZOWESTC={{ zowe_proclib_membername }}+" | \ - sed -e "s+ZSSSTC=ZWESISTC+ZSSSTC={{ zowe_xmem_proclib_member_zss }}+" | \ - sed -e "s+AUXSTC=ZWESASTC+AUXSTC={{ zowe_xmem_proclib_member_aux }}+" \ - > "{{ work_dir_remote }}/ZWESECUR.jcl" - when: zowe_auto_create_user_group - -- name: Update ZWESECUR.jcl with configurations - raw: >- - cat "{{ work_dir_remote }}/ZWESECUR.raw.jcl" | \ - sed -e "s+SET PRODUCT=RACF+SET PRODUCT={{ zos_security_system }}+" | \ - sed -e "s+ADMINGRP=ZWEADMIN+ADMINGRP={{ zowe_runtime_group }}+" | \ - sed -e "s+ZOWEUSER=ZWESVUSR+ZOWEUSER={{ zowe_runtime_user }}+" | \ - sed -e "s+ZSSUSER=ZWESIUSR+ZSSUSER={{ zowe_xmem_stc_user }}+" | \ - sed -e "s+ZOWESTC=ZWESVSTC+ZOWESTC={{ zowe_proclib_membername }}+" | \ - sed -e "s+ZSSSTC=ZWESISTC+ZSSSTC={{ zowe_xmem_proclib_member_zss }}+" | \ - sed -e "s+AUXSTC=ZWESASTC+AUXSTC={{ zowe_xmem_proclib_member_aux }}+" | \ - sed -e "s+ADDGROUP+NOADDGROUP+" | \ - sed -e "s+ALTGROUP+NOALTGROUP+" | \ - sed -e "s+ADDUSER+NOADDUSER+" > "{{ work_dir_remote }}/ZWESECUR.jcl" - when: not zowe_auto_create_user_group - -- name: Check ZWESECUR.jcl changes - raw: >- - grep -e "^// *SET " \ - -e ADDGROUP \ - -e ALTGROUP \ - -e ADDUSER \ - "{{ work_dir_remote }}/ZWESECUR.jcl" - -- name: Run ZWESECUR.jcl - import_role: - name: zos - tasks_from: run_jcl - vars: - jcl_filename: "{{ work_dir_remote }}/ZWESECUR.jcl" - -- name: Remove ZWESECUR.jcl or ZWESECUR.raw.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWESECUR.raw.jcl"; - rm -f "{{ work_dir_remote }}/ZWESECUR.jcl" diff --git a/playbooks/roles/configfmid/tasks/install_proc.yml b/playbooks/roles/configfmid/tasks/install_proc.yml deleted file mode 100644 index c01cf6c7fa..0000000000 --- a/playbooks/roles/configfmid/tasks/install_proc.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -# this playbook will copy Zowe proc -- name: Install Zowe Proc - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/scripts/utils" - script_filename: ./zowe-install-proc.sh - script_parameters: "\"{{ zowe_dataset_prefix }}\" \"{{ zowe_proclib_dsname }}\"" \ No newline at end of file diff --git a/playbooks/roles/configfmid/tasks/install_xmem_server.yml b/playbooks/roles/configfmid/tasks/install_xmem_server.yml deleted file mode 100644 index a2a3401f36..0000000000 --- a/playbooks/roles/configfmid/tasks/install_xmem_server.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -# ============================================================================ -# Create loadlib is doesn't exist -- import_role: - name: zos - tasks_from: is_dataset_exist - vars: - dataset: "{{ zowe_xmem_loadlib }}" - -- name: Create {{ zowe_xmem_loadlib }} - raw: tsocmd "allocate da('{{ zowe_xmem_loadlib }}') dsntype(library) dsorg(po) recfm(u) blksize(6144) space(10,2) tracks new" - when: not dataset_exists - -# ============================================================================ -# Create loadlib is doesn't exist -- import_role: - name: zos - tasks_from: is_dataset_exist - vars: - dataset: "{{ zowe_xmem_parmlib }}" - -- name: Create {{ zowe_xmem_parmlib }} - raw: tsocmd "allocate da('{{ zowe_xmem_parmlib }}') dsntype(library) dsorg(po) recfm(f,b) lrecl(80) blksize(23440) dir(64) space(10,2) tracks new" - when: not dataset_exists - -# ============================================================================ -- name: Install Cross Memory Server - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/scripts/utils" - script_filename: ./zowe-install-xmem.sh - script_parameters: "\"{{ zowe_dataset_prefix }}\" \"{{ zowe_xmem_loadlib }}\" \"{{ zowe_xmem_parmlib }}\" \"{{ zowe_xmem_proclib }}\"" - -- name: Show content of ZSS proc {{ zowe_xmem_proclib_member_zss }} - raw: cat "//'{{ zowe_xmem_proclib }}({{ zowe_xmem_proclib_member_zss }})'" - -# ============================================================================ -# Add XMEM loadlib to APF list -- import_role: - name: zos - tasks_from: is_dataset_sms - vars: - dataset: "{{ zowe_xmem_loadlib }}" - -- name: Add loadlib (SMS) to APF list - when: dataset_is_sms - block: - - name: update APF list - import_role: - name: zos - tasks_from: opercmd - vars: - opercmd: "SETPROG APF,ADD,DSNAME={{ zowe_xmem_loadlib }},SMS" - - - name: Check if APF updating response has CSV410I - fail: - msg: "Failed to add {{ zowe_xmem_loadlib }} to APF list: {{ opercmd_result.stdout }}" - when: 'not "CSV410I" in opercmd_result.stdout' - -- name: Add loadlib (non-SMS) to APF list - when: not dataset_is_sms - block: - - import_role: - name: zos - tasks_from: get_dataset_volume - vars: - dataset: "{{ zowe_xmem_loadlib }}" - - - name: update APF list - import_role: - name: zos - tasks_from: opercmd - vars: - opercmd: "SETPROG APF,ADD,DSNAME={{ zowe_xmem_loadlib }},VOLUME={{ dataset_volume }}" - - - name: Check if APF updating response has CSV410I - fail: - msg: "Failed to add {{ zowe_xmem_loadlib }} to APF list: {{ opercmd_result.stdout }}" - when: 'not "CSV410I" in opercmd_result.stdout' - -- debug: - msg: "data set {{ zowe_xmem_loadlib }} is added to APF list" diff --git a/playbooks/roles/configfmid/tasks/main.yml b/playbooks/roles/configfmid/tasks/main.yml index ab8823eb68..053ada89ed 100644 --- a/playbooks/roles/configfmid/tasks/main.yml +++ b/playbooks/roles/configfmid/tasks/main.yml @@ -11,14 +11,18 @@ - zowe_root_dir - zowe_instance_dir - zowe_keystore_dir + - zowe_install_logs_dir - zowe_dataset_prefix + - zowe_jcllib - zowe_proclib_dsname - zowe_proclib_membername - zowe_runtime_group - zowe_runtime_user - zowe_xmem_proclib - zowe_xmem_parmlib - - zowe_xmem_loadlib + # optional + # - zowe_xmem_loadlib + - zowe_xmem_pluginlib - zowe_xmem_proclib_member_zss - zowe_xmem_proclib_member_aux - zowe_xmem_stc_user @@ -27,6 +31,10 @@ - zowe_apiml_catalog_port - zowe_apiml_discovery_port - zowe_apiml_gateway_port + - zowe_apiml_gateway_timeout_millis + - zowe_apiml_security_x509_enabled + - zowe_apiml_security_zosmf_applid + - zowe_apiml_security_auth_provider - zowe_jobs_api_port - zowe_mvs_api_port - zowe_jobs_explorer_port @@ -37,40 +45,292 @@ - zowe_zss_xmem_name - zowe_zlux_terminal_ssh_port - zowe_zlux_terminal_telnet_port + - zos_security_system + - zowe_lock_keystore +- name: Show value of zowe_root_dir + debug: + msg: zowe_root_dir is {{ zowe_root_dir }} # ============================================================================ -- name: Show Zowe manifest - raw: cat "{{ zowe_root_dir }}/manifest.json" +- name: Detect PROCLIB automatically + when: zowe_proclib_dsname == "auto" + block: + - name: Get PROCLIB concatenation + import_role: + name: zos + tasks_from: opercmd + vars: + opercmd: "$D PROCLIB" + - name: Find the first proclib + set_fact: + zowe_proclib_dsname: "{{ opercmd_result.stdout | regex_search(qry, '\\1') | first }}" + vars: + qry: \$HASP319 +DD\(1\)=\(DSNAME=(.+), # ============================================================================ -# Install Zowe proc -- import_role: - name: configfmid - tasks_from: install_proc +- name: Test convenience build install folder + raw: test -f "{{ zowe_instance_dir }}/zowe.yaml" + register: zowe_yaml_exists + ignore_errors: True -# ============================================================================ -# Install Cross Memory Server -- import_role: - name: configfmid - tasks_from: install_xmem_server +- name: Initialize zowe.yaml + raw: >- + mkdir -p "{{ zowe_instance_dir }}" && \ + cp "{{ zowe_root_dir }}/example-zowe.yaml" "{{ zowe_instance_dir }}/zowe.yaml" + when: zowe_yaml_exists.rc != 0 + +- name: Update zowe.yaml zowe.setup.dataset + import_role: + name: zos + tasks_from: update_zowe_yaml vars: - zowe_xmem_install_from_path: "{{ zowe_root_dir }}/scripts/utils" + configs: + # FIXME: we should only keep one set + "zowe.setup.dataset.prefix": "{{ zowe_dataset_prefix }}" + "zowe.setup.dataset.proclib": "{{ zowe_proclib_dsname }}" + "zowe.setup.dataset.parmlib": "{{ zowe_xmem_parmlib }}" + "zowe.setup.dataset.jcllib": "{{ zowe_jcllib }}" + "zowe.setup.dataset.authLoadlib": "{{ zowe_xmem_loadlib }}" + "zowe.setup.dataset.authPluginLib": "{{ zowe_xmem_pluginlib }}" + "zowe.setup.mvs.hlq": "{{ zowe_dataset_prefix }}" + "zowe.setup.mvs.proclib": "{{ zowe_proclib_dsname }}" + "zowe.setup.mvs.parmlib": "{{ zowe_xmem_parmlib }}" + "zowe.setup.mvs.jcllib": "{{ zowe_jcllib }}" + "zowe.setup.mvs.authLoadlib": "{{ zowe_xmem_loadlib }}" + "zowe.setup.mvs.authPluginLib": "{{ zowe_xmem_pluginlib }}" -# ============================================================================ -# Run ZWESECUR -- import_role: - name: configfmid - tasks_from: create_security_defn - when: not zowe_configure_skip_zwesecur +- name: Update zowe.yaml zowe.setup.security + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.security.product": "{{ zos_security_system }}" + "zowe.setup.security.groups.admin": "{{ zowe_runtime_group }}" + "zowe.setup.security.groups.stc": "{{ zowe_xmem_stc_group }}" + "zowe.setup.security.groups.sysProg": "{{ zowe_runtime_group }}" + "zowe.setup.security.users.zowe": "{{ zowe_runtime_user }}" + "zowe.setup.security.users.zis": "{{ zowe_xmem_stc_user }}" + "zowe.setup.security.stcs.zowe": "{{ zowe_proclib_membername }}" + "zowe.setup.security.stcs.zis": "{{ zowe_xmem_proclib_member_zss }}" + "zowe.setup.security.stcs.aux": "{{ zowe_xmem_proclib_member_aux }}" + +- name: Update zowe.yaml zowe.setup.certificate with PKCS12 keystore + when: zos_keystore_mode is undefined or zos_keystore_mode != 'KEYSTORE_MODE_KEYRING' + block: + - name: Delete keyring certificate setup + import_role: + name: zos + tasks_from: delete_zowe_yaml + vars: + configs: + - zowe.setup.certificate.keyring + - name: Update common PKCS12 setup + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.certificate.type": "PKCS12" + "zowe.setup.certificate.pkcs12.directory": "{{ zowe_keystore_dir }}" + "zowe.setup.certificate.pkcs12.lock": "{{ zowe_lock_keystore|string|lower }}" + "zowe.setup.certificate.pkcs12.name": "{{ zowe_keystore_alias }}" + "zowe.setup.certificate.pkcs12.password": "{{ zowe_keystore_password }}" + "zowe.setup.certificate.importCertificateAuthorities.0": "{{ zowe_external_certficate_authorities }}" + - name: Update PKCS12 setup when importing from external keystore + when: zowe_external_certficate is not none and zowe_external_certficate != '' + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.certificate.pkcs12.import.keystore": "{{ zowe_external_certficate }}" + "zowe.setup.certificate.pkcs12.import.password": "{{ zowe_keystore_password }}" + "zowe.setup.certificate.pkcs12.import.alias": "{{ zowe_external_certficate_alias }}" + +- name: Update zowe.yaml zowe.setup.certificate with z/OS keyring + when: zos_keystore_mode is defined and zos_keystore_mode == 'KEYSTORE_MODE_KEYRING' + block: + - name: Delete PKCS12 certificate setup + import_role: + name: zos + tasks_from: delete_zowe_yaml + vars: + configs: + - zowe.setup.certificate.pkcs12 + - name: Update common keyring setup + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.certificate.type": "JCERACFKS" + "zowe.setup.certificate.keyring.name": "{{ zowe_keyring_alias }}" + "zowe.setup.certificate.keyring.label": "{{ zowe_keyring_certname }}" + "zowe.setup.certificate.importCertificateAuthorities.0": "{{ zowe_external_certficate_authorities }},{{ zowe_keyring_external_intermediate_ca }},{{ zowe_keyring_external_root_ca }}" + - name: Update keyring setup when connecting to external certificate + when: zowe_external_certficate is not none and zowe_external_certficate != '' + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + # FIXME: import or connect? + "zowe.setup.certificate.keyring.connect.user": "{{ zowe_external_certficate }}" + "zowe.setup.certificate.keyring.connect.label": "{{ zowe_external_certficate_alias }}" + "zowe.setup.certificate.keyring.import.dsName": "{{ zowe_external_certficate }}" + "zowe.setup.certificate.keyring.import.password": "{{ zowe_external_certficate_alias }}" + - name: Update keyring setup to help import z/OSMF CA + when: zowe_external_certficate is not none and zowe_external_certficate != '' + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.certificate.keyring.zOSMF.ca": "{{ zos_zosmf_ca }}" + "zowe.setup.certificate.keyring.zOSMF.user": "{{ zos_zosmf_user }}" + +- name: Update zowe.yaml zowe.verifyCertificates to STRICT + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.verifyCertificates": "STRICT" + when: zowe_apiml_verify_certficates_of_services and zowe_apiml_nonstrict_verify_certficates_of_services + +- name: Update zowe.yaml zowe.verifyCertificates to NONSTRICT + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.verifyCertificates": "NONSTRICT" + when: not zowe_apiml_verify_certficates_of_services and zowe_apiml_nonstrict_verify_certficates_of_services + +- name: Update zowe.yaml zowe.verifyCertificates to DISABLED + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.verifyCertificates": "DISABLED" + when: not zowe_apiml_verify_certficates_of_services and not zowe_apiml_nonstrict_verify_certficates_of_services + +- name: Update zowe.yaml zowe.setup.vsam + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.vsam.volume": "{{ zowe_caching_vsam_volume }}" + "zowe.setup.vsam.storageClass": "{{ zowe_caching_vsam_storage_class }}" + "components.caching-service.storage.mode": "{{ zowe_caching_service_persistent }}" + "components.caching-service.storage.vsam.name": "{{ zowe_dataset_prefix }}.{{ zowe_caching_service_vsam_dsprefix }}{{ zowe_instance_id }}" + +- name: Update zowe.yaml zowe.setup.vsam.mode to NONRLS + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.vsam.mode": "NONRLS" + when: not zos_vsam_rls + +- name: Update zowe.yaml zowe.setup.vsam.mode to RLS + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.vsam.mode": "RLS" + when: zos_vsam_rls + +- name: Update zowe.yaml runtime configs + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.runtimeDirectory": "{{ zowe_root_dir }}" + "zowe.logDirectory": "{{ zowe_instance_dir }}/logs" + "zowe.workspaceDirectory": "{{ zowe_instance_dir }}/workspace" + "zowe.extensionDirectory": "{{ zowe_extension_dir }}" + "zowe.job.name": "{{ zowe_job_prefix }}{{ zowe_instance_id }}SV" + "zowe.job.prefix": "{{ zowe_job_prefix }}{{ zowe_instance_id }}" + # FIXME: multiplpe domains? + "zowe.externalDomains.0": "{{ zowe_external_domain_name }}" + "zowe.externalPort": "{{ zowe_apiml_gateway_port }}" + "zowe.launchScript.logLevel": "{{ zowe_launch_scripts_loglevel }}" + "java.home": "{{ zos_java_home }}" + "node.home": "{{ zos_node_home }}" + "zOSMF.host": "{{ zos_zosmf_host }}" + "zOSMF.port": "{{ zos_zosmf_port }}" + "zOSMF.applId": "{{ zowe_apiml_security_zosmf_applid }}" + +- name: Update zowe.yaml runtime configs if IP is defined + when: zowe_external_ip_address is not none and zowe_external_ip_address != '' + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.externalDomains.1": "{{ zowe_external_ip_address }}" + +- name: Update zowe.yaml components configs + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "components.gateway.port": "{{ zowe_apiml_gateway_port }}" + "components.metrics-service.port": "{{ zowe_apiml_metrics_service_port }}" + "components.api-catalog.port": "{{ zowe_apiml_catalog_port }}" + "components.discovery.port": "{{ zowe_apiml_discovery_port }}" + "components.caching-service.port": "{{ zowe_caching_service_port }}" + "components.app-server.port": "{{ zowe_zlux_port }}" + "components.zss.port": "{{ zowe_zss_port }}" + "components.jobs-api.port": "{{ zowe_jobs_api_port }}" + "components.files-api.port": "{{ zowe_mvs_api_port }}" + # other gateway configs + "components.gateway.apiml.gateway.timeoutMillis": "{{ zowe_apiml_gateway_timeout_millis }}" + "components.gateway.apiml.security.x509.enabled": "{{ zowe_apiml_security_x509_enabled|string|lower }}" + "components.gateway.apiml.security.auth.provider": "{{ zowe_apiml_security_auth_provider|string|lower }}" + "components.gateway.apiml.security.auth.zosmf.jwtAutoconfiguration": "{{ zowe_apiml_security_zosmf_jwt_autoconfiguration_mode }}" + # FIXME: uncertain configs + # sed -e "s+^ZWES_XMEM_SERVER_NAME=.*\$+ZWES_XMEM_SERVER_NAME={{ zowe_zss_xmem_name }}+" | \ + # sed -e "s+^ZWED_SSH_PORT=.*\$+ZWED_SSH_PORT={{ zowe_zlux_terminal_ssh_port }}+" | \ + # sed -e "s+^ZWED_TN3270_PORT=.*\$+ZWED_TN3270_PORT={{ zowe_zlux_terminal_telnet_port }}+" | \ + # sed -e "s+^ZWED_TN3270_SECURITY=.*\$+ZWED_TN3270_SECURITY={{ zowe_zlux_terminal_telnet_security_type }}+" | \ + +- name: Update zowe.yaml components enable status + when: zowe_launch_components != '' and zowe_launch_components is not none + block: + - name: Disable all components if zowe_launch_components is defined + include_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "components.{{ item }}.enabled": "false" + with_items: "{{ zowe_core_components }}" + - name: Update zowe.yaml components enable status + include_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "components.{{ item }}.enabled": "true" + with_items: "{{ zowe_launch_components.split(',') }}" # ============================================================================ -# Setup certificates -- import_role: - name: configfmid - tasks_from: setup_certificates +- name: Show zowe.yaml before zwe init + raw: cat "{{ zowe_instance_dir }}/zowe.yaml" | grep -v '^ *#' | sed '/^[[:space:]]*$/d' # ============================================================================ -# Configure Zowe Instance -- import_role: - name: configfmid - tasks_from: configure_instance +- name: Init Zowe + import_role: + name: zos + tasks_from: run_zwe + vars: + parameters: "init --update-config -l \"{{ zowe_install_logs_dir }}\"" diff --git a/playbooks/roles/configfmid/tasks/setup_certificates.yml b/playbooks/roles/configfmid/tasks/setup_certificates.yml deleted file mode 100644 index 011565bf84..0000000000 --- a/playbooks/roles/configfmid/tasks/setup_certificates.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -# this playbook runs bin/zowe-setup-certificates.sh to setup certificates for Zowe -# FIXME: HOSTNAME should be combination of zowe_zos_host and zowe_external_domain_name. -# The reason we use zowe_zos_host here is the certificates created here will only -# be used by z/OS side. Docker image may use different certificate with it's -# own zowe-setup-certificates.sh -- name: Prepare zowe-setup-certificates.env - raw: >- - cat "{{ zowe_root_dir }}/bin/zowe-setup-certificates.env" | \ - sed -e "s+^HOSTNAME=.*\$+HOSTNAME={{ zowe_zos_host }}+" | \ - sed -e "s+^IPADDRESS=.*\$+IPADDRESS={{ zowe_external_ip_address }}+" | \ - sed -e "s+^ZOSMF_CERTIFICATE=.*\$+ZOSMF_CERTIFICATE={{ zowe_zosmf_certificate }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE=.*\$+EXTERNAL_CERTIFICATE={{ zowe_external_certficate }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE_ALIAS=.*\$+EXTERNAL_CERTIFICATE_ALIAS={{ zowe_external_certficate_alias }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE_AUTHORITIES=.*\$+EXTERNAL_CERTIFICATE_AUTHORITIES={{ zowe_external_certficate_authorities }}+" | \ - sed -e "s+^VERIFY_CERTIFICATES=.*\$+VERIFY_CERTIFICATES={{ zowe_apiml_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^KEYSTORE_DIRECTORY=.*\$+KEYSTORE_DIRECTORY={{ zowe_keystore_dir }}+" | \ - sed -e "s+^KEYSTORE_PASSWORD=.*\$+KEYSTORE_PASSWORD={{ zowe_keystore_password }}+" | \ - sed -e "s+^KEYSTORE_ALIAS=.*\$+KEYSTORE_ALIAS={{ zowe_keystore_alias }}+" | \ - sed -e "s+^ZOWE_USER_ID=.*\$+ZOWE_USER_ID={{ zowe_runtime_user }}+" | \ - sed -e "s+^ZOWE_GROUP_ID=.*\$+ZOWE_GROUP_ID={{ zowe_runtime_group }}+" \ - > "{{ work_dir_remote }}/zowe-setup-certificates.env" - -- name: Show zowe-setup-certificates.env - raw: cat "{{ work_dir_remote }}/zowe-setup-certificates.env" - -- name: Setup certificates - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/bin" - script_filename: ./zowe-setup-certificates.sh - script_parameters: "-p \"{{ work_dir_remote }}/zowe-setup-certificates.env\"" - -- name: List certifactes directory - raw: ls -l "{{ zowe_keystore_dir }}" diff --git a/playbooks/roles/configfmid/tasks/validate_configuration.yml b/playbooks/roles/configfmid/tasks/validate_configuration.yml deleted file mode 100644 index 0d32303e29..0000000000 --- a/playbooks/roles/configfmid/tasks/validate_configuration.yml +++ /dev/null @@ -1,10 +0,0 @@ -# this playbook is used to check that the custom parameter added to the instance.env is preserved - -- name: Read instance.env - raw: cat "{{ zowe_instance_dir }}/instance.env" - register: instance_contents - -- name: Check if extender property preserved during upgrade - fail: - msg: "property EXAMPLE_EXTENDER_PROPERTY=TEST123 was not preserved during upgrade" - when: instance_contents.stdout.find('{{ zowe_extender_test_property }}') == -1 diff --git a/playbooks/roles/configure/defaults/main.yml b/playbooks/roles/configure/defaults/main.yml index 902c40d8f2..fc2b8ff1eb 100644 --- a/playbooks/roles/configure/defaults/main.yml +++ b/playbooks/roles/configure/defaults/main.yml @@ -3,6 +3,21 @@ # Constants # ============================================================================== +# full core components list, they should show up in components section in zowe.yaml +zowe_core_components: +- gateway +- metrics-service +- api-catalog +- discovery +- caching-service +- app-server +- zss +- jobs-api +- files-api +- explorer-jes +- explorer-mvs +- explorer-uss + # this should list all known cross memory server stc we ever setup during install zowe_known_xmem_proc_stcs: - ZWESIS01 @@ -23,6 +38,8 @@ zos_vsam_rls: false zowe_dataset_prefix: # instanceDir zowe_instance_dir: ~/.zowe/instance +# install logs directory +zowe_install_logs_dir: ~/.zowe/logs # zowe job prefix. zowe_job_prefix: ZWE # instance id. This will be put into zowe job name after {{ zowe_job_prefix }} @@ -36,15 +53,13 @@ zos_zosmf_user: IZUSVR # default z/OSMF Certificate Authority zos_zosmf_ca: # APIML ports +zowe_apiml_metrics_service_port: 7551 zowe_apiml_catalog_port: 7552 zowe_apiml_discovery_port: 7553 zowe_apiml_gateway_port: 7554 zowe_apiml_verify_certficates_of_services: true zowe_apiml_nonstrict_verify_certficates_of_services: true # APIML configuration properties -zowe_apiml_allow_encoded_slashes: true -zowe_apiml_cors_enabled: false -zowe_apiml_prefer_ip_address: false zowe_apiml_gateway_timeout_millis: 600000 zowe_apiml_security_x509_enabled: false zowe_apiml_security_zosmf_applid: IZUDFLT @@ -59,7 +74,7 @@ zowe_uss_explorer_port: 7562 # caching service zowe_caching_service_port: 7555 zowe_caching_service_persistent: VSAM -# the final data set name will be: {zowe_job_prefix}.{zowe_caching_service_vsam_dsprefix}{zowe_instance_id} +# the final data set name will be: {zowe_dataset_prefix}.{zowe_caching_service_vsam_dsprefix}{zowe_instance_id} # for example: IBMUSER.ZWE.CACHE1 zowe_caching_service_vsam_dsprefix: CACHE zowe_caching_vsam_storage_class: @@ -79,15 +94,15 @@ zowe_external_certficate: zowe_external_certficate_alias: zowe_external_certficate_authorities: zowe_keystore_dir: ~/.zowe/keystore -zowe_logs_dir: ~/.zowe/logs zowe_keystore_password: password zowe_keyring_alias: ZoweKeyring zowe_keyring_certname: ZoweCert zowe_keyring_external_intermediate_ca: zowe_keyring_external_root_ca: zowe_keystore_alias: localhost +zowe_jcllib: zowe_proclib_dsname: auto -zowe_proclib_membername: ZWESVSTC +zowe_proclib_membername: ZWESLSTC zowe_runtime_user: ZWESVUSR zowe_runtime_group: ZWEADMIN zowe_auto_create_user_group: false @@ -98,7 +113,9 @@ zowe_configure_skip_zwesecur: false # these are default variables for cross memory configuration zowe_xmem_proclib: zowe_xmem_parmlib: +# this is optional, it will fall back to {{zowe_dataset_prefix}}.SZWEAUTH zowe_xmem_loadlib: +zowe_xmem_pluginlib: zowe_xmem_proclib_member_zss: ZWESISTC zowe_xmem_proclib_member_aux: ZWESASTC zowe_xmem_stc_user: ZWESIUSR @@ -116,9 +133,7 @@ zowe_external_domain_name: zowe_external_ip_address: # Restrict permissions to keystore/truststore after the certificate setup script zowe_lock_keystore: true -# +# comma separated string zowe_launch_components: - -# PKCS#11 token name and label of jwt secret used by SSO -zowe_token_name: ZWETOKEN -zowe_token_label: jwtsecret +# log level for Zowe launch scripts +zowe_launch_scripts_loglevel: diff --git a/playbooks/roles/configure/tasks/configure_instance.yml b/playbooks/roles/configure/tasks/configure_instance.yml deleted file mode 100644 index c1565bc39c..0000000000 --- a/playbooks/roles/configure/tasks/configure_instance.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -# this playbook call bin/zowe-configure-instance.sh to create instance -- name: Create Zowe instance - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/bin" - script_filename: ./zowe-configure-instance.sh - script_parameters: "-c \"{{ zowe_instance_dir }}\"" - -- name: Check instance directory - raw: test -f "{{ zowe_instance_dir }}/bin/zowe-start.sh" - register: zowe_configure_instance_result - -- name: Check file existence check exit code - fail: - msg: "After configuring instance, {{ zowe_instance_dir }}/bin/zowe-start.sh doesn't exist." - when: zowe_configure_instance_result.rc != 0 - -# add ZWE_LAUNCH_COMPONENTS if not exist, instead of just replace -- name: Update instance.env - raw: >- - cat "{{ zowe_instance_dir }}/instance.env" | \ - sed -e "s+^ZOWE_EXPLORER_HOST=.*\$+ZOWE_EXPLORER_HOST={{ zowe_zos_host }}+" | \ - sed -e "s+^ZOWE_PREFIX=.*\$+ZOWE_PREFIX={{ zowe_job_prefix }}+" | \ - sed -e "s+^ZOWE_INSTANCE=.*\$+ZOWE_INSTANCE={{ zowe_instance_id }}+" | \ - sed -e "s+^ZOSMF_HOST=.*\$+ZOSMF_HOST={{ zos_zosmf_host }}+" | \ - sed -e "s+^ZOSMF_PORT=.*\$+ZOSMF_PORT={{ zos_zosmf_port }}+" | \ - sed -e "s+^KEYSTORE_DIRECTORY=.*\$+KEYSTORE_DIRECTORY={{ zowe_keystore_dir }}+" | \ - sed -e "s+^CATALOG_PORT=.*\$+CATALOG_PORT={{ zowe_apiml_catalog_port }}+" | \ - sed -e "s+^DISCOVERY_PORT=.*\$+DISCOVERY_PORT={{ zowe_apiml_discovery_port }}+" | \ - sed -e "s+^GATEWAY_PORT=.*\$+GATEWAY_PORT={{ zowe_apiml_gateway_port }}+" | \ - sed -e "s+^APIML_ALLOW_ENCODED_SLASHES=.*\$+APIML_ALLOW_ENCODED_SLASHES={{ zowe_apiml_allow_encoded_slashes|string|lower }}+" | \ - sed -e "s+^APIML_CORS_ENABLED=.*\$+APIML_CORS_ENABLED={{ zowe_apiml_cors_enabled|string|lower }}+" | \ - sed -e "s+^APIML_PREFER_IP_ADDRESS=.*\$+APIML_PREFER_IP_ADDRESS={{ zowe_apiml_prefer_ip_address|string|lower }}+" | \ - sed -e "s+^APIML_GATEWAY_TIMEOUT_MILLIS=.*\$+APIML_GATEWAY_TIMEOUT_MILLIS={{ zowe_apiml_gateway_timeout_millis }}+" | \ - sed -e "s+^APIML_SECURITY_X509_ENABLED=.*\$+APIML_SECURITY_X509_ENABLED={{ zowe_apiml_security_x509_enabled|string|lower }}+" | \ - sed -e "s+^APIML_SECURITY_ZOSMF_APPLID=.*\$+APIML_SECURITY_ZOSMF_APPLID={{ zowe_apiml_security_zosmf_applid|string|lower }}+" | \ - sed -e "s+^APIML_SECURITY_AUTH_PROVIDER=.*\$+APIML_SECURITY_AUTH_PROVIDER={{ zowe_apiml_security_auth_provider|string|lower }}+" | \ - sed -e "s+^JOBS_API_PORT=.*\$+JOBS_API_PORT={{ zowe_jobs_api_port }}+" | \ - sed -e "s+^FILES_API_PORT=.*\$+FILES_API_PORT={{ zowe_mvs_api_port }}+" | \ - sed -e "s+^JES_EXPLORER_UI_PORT=.*\$+JES_EXPLORER_UI_PORT={{ zowe_jobs_explorer_port }}+" | \ - sed -e "s+^MVS_EXPLORER_UI_PORT=.*\$+MVS_EXPLORER_UI_PORT={{ zowe_mvs_explorer_port }}+" | \ - sed -e "s+^USS_EXPLORER_UI_PORT=.*\$+USS_EXPLORER_UI_PORT={{ zowe_uss_explorer_port }}+" | \ - sed -e "s+^ZWED_SERVER_HTTPS_PORT=.*\$+ZWED_SERVER_HTTPS_PORT={{ zowe_zlux_port }}+" | \ - sed -e "s+^ZWES_SERVER_PORT=.*\$+ZWES_SERVER_PORT={{ zowe_zss_port }}+" | \ - sed -e "s+^ZWES_XMEM_SERVER_NAME=.*\$+ZWES_XMEM_SERVER_NAME={{ zowe_zss_xmem_name }}+" | \ - sed -e "s+^ZWED_SSH_PORT=.*\$+ZWED_SSH_PORT={{ zowe_zlux_terminal_ssh_port }}+" | \ - sed -e "s+^ZWED_TN3270_PORT=.*\$+ZWED_TN3270_PORT={{ zowe_zlux_terminal_telnet_port }}+" | \ - sed -e "s+^ZWED_TN3270_SECURITY=.*\$+ZWED_TN3270_SECURITY={{ zowe_zlux_terminal_telnet_security_type }}+" | \ - sed -e "s+^ZWE_LAUNCH_COMPONENTS=.*\$+ZWE_LAUNCH_COMPONENTS={{ zowe_launch_components }}+" \ - > "{{ zowe_instance_dir }}/instance.env.tmp" && \ - mv "{{ zowe_instance_dir }}/instance.env.tmp" "{{ zowe_instance_dir }}/instance.env" - -- name: Add/update APIML_SECURITY_ZOSMF_JWT_AUTOCONFIGURATION_MODE - raw: |- - export INSTANCE_DIR={{ zowe_instance_dir }} - export ZOWE_ROOT_DIR={{ zowe_root_dir }} - . {{ zowe_root_dir }}/bin/utils/utils.sh - update_zowe_instance_variable APIML_SECURITY_ZOSMF_JWT_AUTOCONFIGURATION_MODE "{{ zowe_apiml_security_zosmf_jwt_autoconfiguration_mode }}" - -- name: Show instance.env - raw: cat "{{ zowe_instance_dir }}/instance.env" diff --git a/playbooks/roles/configure/tasks/configure_jwt_secret_certificate.yml b/playbooks/roles/configure/tasks/configure_jwt_secret_certificate.yml deleted file mode 100644 index 9b07761420..0000000000 --- a/playbooks/roles/configure/tasks/configure_jwt_secret_certificate.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -# Add client certificate to security system and map it to the user. - -- name: Import client certificate to security systems - block: - - import_role: - name: common - tasks_from: validate_variables - vars: - variable_list: - - dataset - - label - - certificate - - name: Delete old dataset - raw: tsocmd "delete '{{ zowe_dataset_prefix }}.CERT.{{ dataset }}' scratch nonvsam" - ignore_errors: True - - - name: Allocate empty sequentional dataset - raw: tsocmd "alloc dataset('{{ zowe_dataset_prefix }}.CERT.{{ dataset }}') block(900) lrecl(80) dsorg(ps) recfm(v,b) new" - - - name: Copy certificate to dataset - raw: tsocmd "OGET '{{ certificate }}' '{{ zowe_dataset_prefix }}.CERT.{{ dataset }}' TEXT" - - - name: Import certificate to RACF - when: zos_security_system == 'RACF' - raw: |- - tsocmd "racdcert add('{{ zowe_dataset_prefix }}.CERT.{{ dataset }}') id({{ zowe_runtime_user }}) withlabel('{{ label }}') trust" - tsocmd "SETROPTS RACLIST(DIGTCERT, DIGTRING) REFRESH" - tsocmd "RACDCERT LIST ID({{ zowe_runtime_user }})" - ignore_errors: True - - - name: Import certificate to TSS - when: zos_security_system == 'TSS' - raw: |- - tsocmd "TSS CHKCERT DCDSN('{{ zowe_dataset_prefix }}.CERT.{{ dataset }}')" - tsocmd "TSS ADD({{ zowe_runtime_user }}) DIGICERT({{ dataset }}) LABLCERT('{{ label }}') DCDSN('{{ zowe_dataset_prefix }}.CERT.{{ dataset }}') TRUST" - tsocmd "TSS LIST({{ zowe_runtime_user }}) DIGICERT(ALL)" - ignore_errors: True - diff --git a/playbooks/roles/configure/tasks/create_keyring.yml b/playbooks/roles/configure/tasks/create_keyring.yml deleted file mode 100644 index 8256c509ff..0000000000 --- a/playbooks/roles/configure/tasks/create_keyring.yml +++ /dev/null @@ -1,102 +0,0 @@ ---- -# this playbook runs SZWESAMP(ZWEKRING) - -- name: Validate that we were in keyring mode - fail: - msg: "Error. This play should only be run when in keyring mode" - when: zos_keystore_mode is undefined or zos_keystore_mode != 'KEYSTORE_MODE_KEYRING' - -- name: Remove ZWEKRING.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWEKRING.jcl" - rm -f "{{ work_dir_remote }}/ZWEKRING.raw.jcl" - -- name: Copy SZWESAMP(ZWEKRING) to USS - raw: cp "//'{{ zowe_dataset_prefix }}.SZWESAMP(ZWEKRING)'" "{{ work_dir_remote }}/ZWEKRING.raw.jcl" - -- name: Set ip address - raw: dig +short $(hostname) | sed -n 2p - when: zowe_external_ip_address is undefined or zowe_external_ip_address is none or zowe_external_ip_address|length == 0 - register: zowe_external_ip_address_output - -- set_fact: - zowe_external_ip_address: "{{ zowe_external_ip_address_output.stdout | trim}}" - when: zowe_external_ip_address is undefined or zowe_external_ip_address is none or zowe_external_ip_address|length == 0 - -- name: Show ip zowe_external_ip_address - debug: - var: zowe_external_ip_address - -- name: Automatically detect zos_zosmf_ca - when: zos_zosmf_ca is undefined or zos_zosmf_ca is none or zos_zosmf_ca|length == 0 - block: - - name: Get z/OSMF keyring for RACF - # this only works for RACF - raw: tsocmd 'RACDCERT LIST ID({{ zos_zosmf_user }})' 2>&1 | grep -v RACDCERT | awk "/Ring:/{x=NR+10;next}(NR<=x){print}" | awk '{print $1}' | sed -e 's/^>//' -e 's/<$//' | tr -d '\n' - ignore_errors: True - register: zosmf_keyring_output - - name: Show zosmf_keyring_output - debug: - var: zosmf_keyring_output.stdout - - - name: Get z/OSMF CA - # this only works for RACF - raw: tsocmd 'RACDCERT LISTRING({{ zosmf_keyring_output.stdout }}) ID({{ zos_zosmf_user }})' 2>&1 | grep -v RACDCERT | grep 'CERTAUTH' | head -n 1 | awk '{print $1}' | tr -d '\n' - ignore_errors: True - register: zosmf_ca_output - - name: Update zos_zosmf_ca - set_fact: - zos_zosmf_ca: "{{ zosmf_ca_output.stdout }}" - -- name: Show z/OSMF CA - debug: - var: zos_zosmf_ca -- name: Check value of zos_zosmf_ca - fail: - msg: "To successfully verify certificates, zos_zosmf_ca is required" - when: (zowe_apiml_verify_certficates_of_services or zowe_apiml_nonstrict_verify_certficates_of_services) and (zos_zosmf_ca is undefined or zos_zosmf_ca is none or zos_zosmf_ca|length == 0) - -- name: Update ZWEKRING.jcl with configurations - raw: >- - cat "{{ work_dir_remote }}/ZWEKRING.raw.jcl" | \ - sed -e "s%SET PRODUCT=RACF%SET PRODUCT={{ zos_security_system }}%" | \ - sed -e "s%SET HOSTNAME=''%SET HOSTNAME='{{ zowe_zos_host }}'%" | \ - sed -e "s%SET IPADDRES=''%SET IPADDRES='{{ zowe_external_ip_address }}'%" | \ - sed -e "s%SET JWTLABEL='jwtsecret'%SET JWTLABEL='{{ zowe_token_label }}'%" | \ - sed -e "s%SET LABEL='localhost'%SET LABEL='{{ zowe_keyring_certname }}'%" \ - > "{{ work_dir_remote }}/ZWEKRING.jcl" - -- name: Update ZWEKRING.jcl IFZOWECA with configurations - when: zowe_keyring_external_intermediate_ca is not none or zowe_keyring_external_root_ca is not none - raw: >- - cat "{{ work_dir_remote }}/ZWEKRING.jcl" | \ - sed -e "s%SET IFZOWECA=0%SET IFZOWECA=1%" | \ - sed -e "s%SET ITRMZWCA=''%SET ITRMZWCA='{{ zowe_keyring_external_intermediate_ca }}'%" | \ - sed -e "s%SET ROOTZWCA=''%SET ROOTZWCA='{{ zowe_keyring_external_root_ca }}'%" \ - > "{{ work_dir_remote }}/ZWEKRING.jcl" - -- name: Update ZWEKRING.jcl IFROZFCA with configurations - when: zos_zosmf_ca is not none - raw: >- - cat "{{ work_dir_remote }}/ZWEKRING.jcl" | \ - sed -e "s%SET IFROZFCA=0%SET IFROZFCA=1%" | \ - sed -e "s%SET ROOTZFCA=''%SET ROOTZFCA='{{ zos_zosmf_ca }}'%" \ - > "{{ work_dir_remote }}/ZWEKRING.jcl" - -- name: Check ZWEKRING.jcl changes - raw: >- - grep -e "^// *SET " \ - -e PRODUCT \ - -e HOSTNAME \ - -e IPADDRES \ - -e LABEL \ - -e IFZOWECA -e ITRMZWCA -e ROOTZWCA \ - -e IFROZFCA -e ROOTZFCA \ - "{{ work_dir_remote }}/ZWEKRING.jcl" - -- name: Run ZWEKRING.jcl - import_role: - name: zos - tasks_from: run_jcl - vars: - jcl_filename: "{{ work_dir_remote }}/ZWEKRING.jcl" diff --git a/playbooks/roles/configure/tasks/create_security_defn.yml b/playbooks/roles/configure/tasks/create_security_defn.yml deleted file mode 100644 index 9c7b0a2a05..0000000000 --- a/playbooks/roles/configure/tasks/create_security_defn.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -# this playbook runs SZWESAMP(ZWESECUR) -- name: Remove ZWESECUR.jcl or ZWESECUR.raw.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWESECUR.raw.jcl"; - rm -f "{{ work_dir_remote }}/ZWESECUR.jcl" - -- name: Copy SZWESAMP(ZWESECUR) to USS - raw: cp "//'{{ zowe_dataset_prefix }}.SZWESAMP(ZWESECUR)'" "{{ work_dir_remote }}/ZWESECUR.raw.jcl" - -- name: Update ZWESECUR.jcl with configurations - raw: >- - cat "{{ work_dir_remote }}/ZWESECUR.raw.jcl" | \ - sed -e "s+SET PRODUCT=RACF+SET PRODUCT={{ zos_security_system }}+" | \ - sed -e "s+ADMINGRP=ZWEADMIN+ADMINGRP={{ zowe_runtime_group }}+" | \ - sed -e "s+ZOWEUSER=ZWESVUSR+ZOWEUSER={{ zowe_runtime_user }}+" | \ - sed -e "s+ZSSUSER=ZWESIUSR+ZSSUSER={{ zowe_xmem_stc_user }}+" | \ - sed -e "s+ZOWESTC=ZWESVSTC+ZOWESTC={{ zowe_proclib_membername }}+" | \ - sed -e "s+ZSSSTC=ZWESISTC+ZSSSTC={{ zowe_xmem_proclib_member_zss }}+" | \ - sed -e "s+AUXSTC=ZWESASTC+AUXSTC={{ zowe_xmem_proclib_member_aux }}+" \ - > "{{ work_dir_remote }}/ZWESECUR.jcl" - -- name: Update ZWESECUR.jcl not to create user/group - raw: >- - cat "{{ work_dir_remote }}/ZWESECUR.jcl" | \ - sed -e "s+ADDGROUP+NOADDGROUP+" | \ - sed -e "s+ALTGROUP+NOALTGROUP+" | \ - sed -e "s+ADDUSER+NOADDUSER+" > "{{ work_dir_remote }}/ZWESECUR.jcl" - when: not zowe_auto_create_user_group - -- name: Create APIML.SERVICES class in ZOWE class - raw: >- - cat "{{ work_dir_remote }}/ZWESECUR.jcl" | \ - sed -e 's+/.*PERMIT APIML.SERVICES CLASS(ZOWE) ID(user) ACCESS(READ).*$+PERMIT APIML.SERVICES CLASS(ZOWE) ID({{ zowe_runtime_user }}) ACCESS(READ)+' | \ - sed -e 's+.*RECKEY APIML ADD(SERVICES -.*$+RECKEY APIML ADD(SERVICES -+' | \ - sed -e 's+.*UID(user) SERVICE(READ) ALLOW).*$+UID({{ zowe_runtime_user }}) SERVICE(READ) ALLOW)\nF ACF2,REBUILD(ZWE)+' | \ - sed -e 's+.*TSS PERMIT(user) ZOWE(APIML.SERVICES) ACCESS(READ).*$+TSS PERMIT({{ zowe_runtime_user }}) ZOWE(APIML.SERVICES) ACCESS(READ)+' \ - > "{{ work_dir_remote }}/ZWESECUR.jcl" - -- name: Check ZWESECUR.jcl changes - raw: >- - grep -e "^// *SET " \ - -e ADDGROUP \ - -e ALTGROUP \ - -e ADDUSER \ - "{{ work_dir_remote }}/ZWESECUR.jcl" - -- name: Run ZWESECUR.jcl - import_role: - name: zos - tasks_from: run_jcl - vars: - jcl_filename: "{{ work_dir_remote }}/ZWESECUR.jcl" - -- name: Remove ZWESECUR.jcl or ZWESECUR.raw.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWESECUR.raw.jcl"; - rm -f "{{ work_dir_remote }}/ZWESECUR.jcl" diff --git a/playbooks/roles/configure/tasks/create_sso_token.yml b/playbooks/roles/configure/tasks/create_sso_token.yml deleted file mode 100644 index da3f462e95..0000000000 --- a/playbooks/roles/configure/tasks/create_sso_token.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -# this playbook runs SZWESAMP(ZWESSOTK) - -- name: Remove ZWESSOTK.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWESSOTK.jcl" - rm -f "{{ work_dir_remote }}/ZWESSOTK.raw.jcl" - -- name: Copy SZWESAMP(ZWESSOTK) to USS - raw: cp "//'{{ zowe_dataset_prefix }}.SZWESAMP(ZWESSOTK)'" "{{ work_dir_remote }}/ZWESSOTK.raw.jcl" - -- name: Update ZWESSOTK.jcl with configurations - raw: >- - cat "{{ work_dir_remote }}/ZWESSOTK.raw.jcl" | \ - sed -e "s%SET PRODUCT=RACF%SET PRODUCT={{ zos_security_system }}%" | \ - sed -e "s%SET JWTLABEL='jwtsecret'%SET JWTLABEL='{{ zowe_token_label }}'%" | \ - sed -e "s%SET SSOTOKEN=%SET SSOTOKEN='{{ zowe_token_name }}'%" \ - > "{{ work_dir_remote }}/ZWESSOTK.jcl" - -- name: Check ZWESSOTK.jcl changes - raw: >- - grep -e "^// *SET " \ - -e PRODUCT \ - -e JWTDSNAM \ - -e JWTLABEL \ - -e SSOTOKEN \ - "{{ work_dir_remote }}/ZWESSOTK.jcl" - -- name: Run ZWESSOTK.jcl - import_role: - name: zos - tasks_from: run_jcl - vars: - jcl_filename: "{{ work_dir_remote }}/ZWESSOTK.jcl" diff --git a/playbooks/roles/configure/tasks/create_vsam_dataset.yml b/playbooks/roles/configure/tasks/create_vsam_dataset.yml deleted file mode 100644 index 4b8e986cef..0000000000 --- a/playbooks/roles/configure/tasks/create_vsam_dataset.yml +++ /dev/null @@ -1,98 +0,0 @@ ---- -# this task will create VSAM data set for Caching Service by executing JCL -# SZWESAMP(ZWECSVSM) -# this task supposed to run after configure_instance.yml so it will update -# value of ZWE_CACHING_SERVICE_VSAM_DATASET in instance.env. - -# Variables: -# - zos_vsam_rls -# - zowe_caching_service_port -# - zowe_caching_service_persistent -# - zowe_caching_service_vsam_dsprefix -# - zowe_caching_vsam_storage_class -# - zowe_caching_vsam_volume - -# validate variables -- import_role: - name: common - tasks_from: validate_variables - vars: - variable_list: - - zos_vsam_rls - - zowe_caching_service_port - - zowe_caching_service_persistent - - zowe_caching_service_vsam_dsprefix - -- name: Check if zowe_caching_vsam_storage_class has a value - fail: - msg: zowe_caching_vsam_storage_class is required - when: zos_vsam_rls and (zowe_caching_vsam_storage_class is not defined or zowe_caching_vsam_storage_class is none or zowe_caching_vsam_storage_class == '') - -- name: Check if zowe_caching_vsam_volume has a value - fail: - msg: zowe_caching_vsam_volume is required - when: not zos_vsam_rls and (zowe_caching_vsam_volume is not defined or zowe_caching_vsam_volume is none or zowe_caching_vsam_volume == '') - -- name: Set caching service vsam data set name - set_fact: - zowe_caching_service_vsam_dsname: "{{ zowe_dataset_prefix }}.{{ zowe_caching_service_vsam_dsprefix }}{{ zowe_instance_id }}" - -- import_role: - name: zos - tasks_from: is_dataset_exist - vars: - dataset: "{{ zowe_caching_service_vsam_dsname }}" - -- name: Create {{ zowe_caching_service_vsam_dsname }} - when: not dataset_exists - block: - - name: Remove ZWECSVSM.jcl or ZWECSVSM.raw.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWECSVSM.raw.jcl"; - rm -f "{{ work_dir_remote }}/ZWECSVSM.jcl" - - - name: Copy SZWESAMP(ZWECSVSM) to USS - raw: cp "//'{{ zowe_dataset_prefix }}.SZWESAMP(ZWECSVSM)'" "{{ work_dir_remote }}/ZWECSVSM.raw.jcl" - - - name: Update dsname in ZWECSVSM.jcl - raw: >- - cat "{{ work_dir_remote }}/ZWECSVSM.raw.jcl" | \ - sed -e "48,999s/#dsname/{{ zowe_caching_service_vsam_dsname }}/g" | \ - sed -e "48,999s/#storclas/{{ zowe_caching_vsam_storage_class }}/g" | \ - sed -e "48,999s/#volume/{{ zowe_caching_vsam_volume }}/" \ - > "{{ work_dir_remote }}/ZWECSVSM.jcl" - - - name: Set ZWEVSVSM job MODE configuration - raw: >- - mv "{{ work_dir_remote }}/ZWECSVSM.jcl" "{{ work_dir_remote }}/ZWECSVSM.raw.jcl" && \ - cat "{{ work_dir_remote }}/ZWECSVSM.raw.jcl" | \ - sed -e "s|SET \{1,\}MODE=NONRLS|SET MODE=RLS|" \ - > "{{ work_dir_remote }}/ZWECSVSM.jcl" - when: zos_vsam_rls - - - name: Display ZWECSVSM jcl - raw: cat "{{ work_dir_remote }}/ZWECSVSM.jcl" - - - name: Run ZWECSVSM.jcl - import_role: - name: zos - tasks_from: run_jcl - vars: - jcl_filename: "{{ work_dir_remote }}/ZWECSVSM.jcl" - -- name: Remove ZWECSVSM.jcl or ZWECSVSM.raw.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWECSVSM.raw.jcl"; - rm -f "{{ work_dir_remote }}/ZWECSVSM.jcl" - -- name: Update instance.env for caching service - raw: >- - cat "{{ zowe_instance_dir }}/instance.env" | \ - sed -e "s+^ZWE_CACHING_SERVICE_PORT=.*\$+ZWE_CACHING_SERVICE_PORT={{ zowe_caching_service_port }}+" | \ - sed -e "s+^ZWE_CACHING_SERVICE_PERSISTENT=.*\$+ZWE_CACHING_SERVICE_PERSISTENT={{ zowe_caching_service_persistent }}+" | \ - sed -e "s+^ZWE_CACHING_SERVICE_VSAM_DATASET=.*\$+ZWE_CACHING_SERVICE_VSAM_DATASET={{ zowe_caching_service_vsam_dsname }}+" \ - > "{{ zowe_instance_dir }}/instance.env.tmp" && \ - mv "{{ zowe_instance_dir }}/instance.env.tmp" "{{ zowe_instance_dir }}/instance.env" - -- name: Show caching service settings in instance.env - raw: cat "{{ zowe_instance_dir }}/instance.env" | grep ZWE_CACHING_SERVICE_ diff --git a/playbooks/roles/configure/tasks/install_proc.yml b/playbooks/roles/configure/tasks/install_proc.yml deleted file mode 100644 index 317af386af..0000000000 --- a/playbooks/roles/configure/tasks/install_proc.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# this playbook will copy Zowe proc -- name: Install Zowe Proc - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/scripts/utils" - script_filename: ./zowe-install-proc.sh - script_parameters: "-d \"{{ zowe_dataset_prefix }}\" -r \"{{ zowe_proclib_dsname }}\" -l \"{{ zowe_install_logs_dir }}\"" - -- name: List log dir - raw: ls -l "{{ zowe_install_logs_dir }}" - ignore_errors: True - -- name: Show install proc log - raw: find {{ zowe_install_logs_dir }} -name "zowe-install-proc-*.log" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' - ignore_errors: True \ No newline at end of file diff --git a/playbooks/roles/configure/tasks/install_xmem_server.yml b/playbooks/roles/configure/tasks/install_xmem_server.yml deleted file mode 100644 index 0a1abea917..0000000000 --- a/playbooks/roles/configure/tasks/install_xmem_server.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -# ============================================================================ -# Create parmlib is doesn't exist -- import_role: - name: zos - tasks_from: is_dataset_exist - vars: - dataset: "{{ zowe_xmem_parmlib }}" - -- name: Create {{ zowe_xmem_parmlib }} - raw: tsocmd "allocate da('{{ zowe_xmem_parmlib }}') dsntype(library) dsorg(po) recfm(f,b) lrecl(80) blksize(23440) dir(64) space(10,2) tracks new" - when: not dataset_exists - -# ============================================================================ -- name: Install Cross Memory Server - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/scripts/utils" - script_filename: ./zowe-install-xmem.sh - script_parameters: "-d \"{{ zowe_dataset_prefix }}\" -a \"{{ zowe_xmem_parmlib }}\" -r \"{{ zowe_xmem_proclib }}\" -l \"{{ zowe_install_logs_dir }}\"" - -- name: Show content of ZSS proc {{ zowe_xmem_proclib_member_zss }} - raw: cat "//'{{ zowe_xmem_proclib }}({{ zowe_xmem_proclib_member_zss }})'" - -- name: List log dir - raw: ls -l "{{ zowe_install_logs_dir }}" - ignore_errors: True - -- name: Show install xmem log - raw: find {{ zowe_install_logs_dir }} -name "zowe-install-xmem-*.log" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' - ignore_errors: True - -# ============================================================================ -# Add XMEM auth lib SZWEAUTH to APF list -- import_role: - name: zos - tasks_from: is_dataset_sms - vars: - dataset: "{{ zowe_dataset_prefix }}.SZWEAUTH" - -- name: Add auth lib SZWEAUTH (SMS) to APF list - when: dataset_is_sms - block: - - name: update APF list - import_role: - name: zos - tasks_from: opercmd - vars: - opercmd: "SETPROG APF,ADD,DSNAME={{ zowe_dataset_prefix }}.SZWEAUTH,SMS" - - - name: Check if APF updating response has CSV410I - fail: - msg: "Failed to add {{ zowe_dataset_prefix }}.SZWEAUTH to APF list: {{ opercmd_result.stdout }}" - when: 'not "CSV410I" in opercmd_result.stdout' - -- name: Add auth lib SZWEAUTH (non-SMS) to APF list - when: not dataset_is_sms - block: - - import_role: - name: zos - tasks_from: get_dataset_volume - vars: - dataset: "{{ zowe_dataset_prefix }}.SZWEAUTH" - - - name: update APF list - import_role: - name: zos - tasks_from: opercmd - vars: - opercmd: "SETPROG APF,ADD,DSNAME={{ zowe_dataset_prefix }}.SZWEAUTH,VOLUME={{ dataset_volume }}" - - - name: Check if APF updating response has CSV410I - fail: - msg: "Failed to add {{ zowe_dataset_prefix }}.SZWEAUTH to APF list: {{ opercmd_result.stdout }}" - when: 'not "CSV410I" in opercmd_result.stdout' - -- debug: - msg: "data set {{ zowe_dataset_prefix }}.SZWEAUTH is added to APF list" diff --git a/playbooks/roles/configure/tasks/locate_zowe_start.yml b/playbooks/roles/configure/tasks/locate_zowe_start.yml deleted file mode 100644 index 80ca6287ca..0000000000 --- a/playbooks/roles/configure/tasks/locate_zowe_start.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- -# This task finds the zowe-start.sh in known folders - -# Variables: -# - zowe_instance_dir -# - zowe_root_dir -# Output: -# - zowe_start_path - -# validate variables -- import_role: - name: common - tasks_from: validate_variables - vars: - variable_list: - - zowe_root_dir - - zowe_instance_dir - -- name: Locate zowe-start.sh - block: - - name: Init zowe_start_path variable - set_fact: - zowe_start_path: "" - - name: Check if zowe-start.sh is located at instanceDir - raw: test -f {{ zowe_instance_dir }}/bin/zowe-start.sh && echo "{{ zowe_instance_dir }}/bin/zowe-start.sh" | tr -d '\n' - register: zowe_start_at_instancedir - ignore_errors: yes - when: zowe_start_path == "" - - name: Set zowe_start_path to {{ zowe_start_at_instancedir.stdout }} - set_fact: - zowe_start_path: "{{ zowe_start_at_instancedir.stdout }}" - when: zowe_start_path == "" and zowe_start_at_instancedir.stdout != '' - - name: Check if zowe-start.sh is located at rootDir - raw: test -f {{ zowe_root_dir }}/scripts/zowe-start.sh && echo "{{ zowe_root_dir }}/scripts/zowe-start.sh" | tr -d '\n' - register: zowe_start_at_rootdir - ignore_errors: yes - when: zowe_start_path == "" - - name: Set zowe_start_path to {{ zowe_start_at_rootdir.stdout }} - set_fact: - zowe_start_path: "{{ zowe_start_at_rootdir.stdout }}" - when: zowe_start_path == "" and zowe_start_at_rootdir.stdout != '' - - name: Show zowe_start_path value - debug: - var: zowe_start_path diff --git a/playbooks/roles/configure/tasks/locate_zowe_stop.yml b/playbooks/roles/configure/tasks/locate_zowe_stop.yml deleted file mode 100644 index de31309423..0000000000 --- a/playbooks/roles/configure/tasks/locate_zowe_stop.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- -# This task finds the zowe-stop.sh in known folders - -# Variables: -# - zowe_instance_dir -# - zowe_root_dir -# Output: -# - zowe_stop_path - -# validate variables -- import_role: - name: common - tasks_from: validate_variables - vars: - variable_list: - - zowe_root_dir - - zowe_instance_dir - -- name: Locate zowe-stop.sh - block: - - name: Init zowe_stop_path variable - set_fact: - zowe_stop_path: "" - - name: Check if zowe-stop.sh is located at instanceDir - raw: test -f {{ zowe_instance_dir }}/bin/zowe-stop.sh && echo "{{ zowe_instance_dir }}/bin/zowe-stop.sh" | tr -d '\n' - register: zowe_stop_at_instancedir - ignore_errors: yes - when: zowe_stop_path == "" - - name: Set zowe_stop_path to {{ zowe_stop_at_instancedir.stdout }} - set_fact: - zowe_stop_path: "{{ zowe_stop_at_instancedir.stdout }}" - when: zowe_stop_path == "" and zowe_stop_at_instancedir.stdout != '' - - name: Check if zowe-stop.sh is located at rootDir - raw: test -f {{ zowe_root_dir }}/scripts/zowe-stop.sh && echo "{{ zowe_root_dir }}/scripts/zowe-stop.sh" | tr -d '\n' - register: zowe_stop_at_rootdir - ignore_errors: yes - when: zowe_stop_path == "" - - name: Set zowe_stop_path to {{ zowe_stop_at_rootdir.stdout }} - set_fact: - zowe_stop_path: "{{ zowe_stop_at_rootdir.stdout }}" - when: zowe_stop_path == "" and zowe_stop_at_rootdir.stdout != '' - - name: Show zowe_stop_path value - debug: - var: zowe_stop_path diff --git a/playbooks/roles/configure/tasks/main.yml b/playbooks/roles/configure/tasks/main.yml index 3d9b9440af..053ada89ed 100644 --- a/playbooks/roles/configure/tasks/main.yml +++ b/playbooks/roles/configure/tasks/main.yml @@ -11,14 +11,18 @@ - zowe_root_dir - zowe_instance_dir - zowe_keystore_dir + - zowe_install_logs_dir - zowe_dataset_prefix + - zowe_jcllib - zowe_proclib_dsname - zowe_proclib_membername - zowe_runtime_group - zowe_runtime_user - zowe_xmem_proclib - zowe_xmem_parmlib - - zowe_xmem_loadlib + # optional + # - zowe_xmem_loadlib + - zowe_xmem_pluginlib - zowe_xmem_proclib_member_zss - zowe_xmem_proclib_member_aux - zowe_xmem_stc_user @@ -27,9 +31,6 @@ - zowe_apiml_catalog_port - zowe_apiml_discovery_port - zowe_apiml_gateway_port - - zowe_apiml_allow_encoded_slashes - - zowe_apiml_cors_enabled - - zowe_apiml_prefer_ip_address - zowe_apiml_gateway_timeout_millis - zowe_apiml_security_x509_enabled - zowe_apiml_security_zosmf_applid @@ -46,137 +47,290 @@ - zowe_zlux_terminal_telnet_port - zos_security_system - zowe_lock_keystore +- name: Show value of zowe_root_dir + debug: + msg: zowe_root_dir is {{ zowe_root_dir }} # ============================================================================ -- name: Show Zowe manifest - raw: cat "{{ zowe_root_dir }}/manifest.json" +- name: Detect PROCLIB automatically + when: zowe_proclib_dsname == "auto" + block: + - name: Get PROCLIB concatenation + import_role: + name: zos + tasks_from: opercmd + vars: + opercmd: "$D PROCLIB" + - name: Find the first proclib + set_fact: + zowe_proclib_dsname: "{{ opercmd_result.stdout | regex_search(qry, '\\1') | first }}" + vars: + qry: \$HASP319 +DD\(1\)=\(DSNAME=(.+), # ============================================================================ -# Install Zowe proc -- import_role: - name: configure - tasks_from: install_proc +- name: Test convenience build install folder + raw: test -f "{{ zowe_instance_dir }}/zowe.yaml" + register: zowe_yaml_exists + ignore_errors: True -# ============================================================================ -# Install Cross Memory Server -- import_role: - name: configure - tasks_from: install_xmem_server +- name: Initialize zowe.yaml + raw: >- + mkdir -p "{{ zowe_instance_dir }}" && \ + cp "{{ zowe_root_dir }}/example-zowe.yaml" "{{ zowe_instance_dir }}/zowe.yaml" + when: zowe_yaml_exists.rc != 0 + +- name: Update zowe.yaml zowe.setup.dataset + import_role: + name: zos + tasks_from: update_zowe_yaml vars: - zowe_xmem_install_from_path: "{{ zowe_root_dir }}/scripts/utils" + configs: + # FIXME: we should only keep one set + "zowe.setup.dataset.prefix": "{{ zowe_dataset_prefix }}" + "zowe.setup.dataset.proclib": "{{ zowe_proclib_dsname }}" + "zowe.setup.dataset.parmlib": "{{ zowe_xmem_parmlib }}" + "zowe.setup.dataset.jcllib": "{{ zowe_jcllib }}" + "zowe.setup.dataset.authLoadlib": "{{ zowe_xmem_loadlib }}" + "zowe.setup.dataset.authPluginLib": "{{ zowe_xmem_pluginlib }}" + "zowe.setup.mvs.hlq": "{{ zowe_dataset_prefix }}" + "zowe.setup.mvs.proclib": "{{ zowe_proclib_dsname }}" + "zowe.setup.mvs.parmlib": "{{ zowe_xmem_parmlib }}" + "zowe.setup.mvs.jcllib": "{{ zowe_jcllib }}" + "zowe.setup.mvs.authLoadlib": "{{ zowe_xmem_loadlib }}" + "zowe.setup.mvs.authPluginLib": "{{ zowe_xmem_pluginlib }}" -# ============================================================================ -# Run ZWESECUR -- import_role: - name: configure - tasks_from: create_security_defn - when: not zowe_configure_skip_zwesecur +- name: Update zowe.yaml zowe.setup.security + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.security.product": "{{ zos_security_system }}" + "zowe.setup.security.groups.admin": "{{ zowe_runtime_group }}" + "zowe.setup.security.groups.stc": "{{ zowe_xmem_stc_group }}" + "zowe.setup.security.groups.sysProg": "{{ zowe_runtime_group }}" + "zowe.setup.security.users.zowe": "{{ zowe_runtime_user }}" + "zowe.setup.security.users.zis": "{{ zowe_xmem_stc_user }}" + "zowe.setup.security.stcs.zowe": "{{ zowe_proclib_membername }}" + "zowe.setup.security.stcs.zis": "{{ zowe_xmem_proclib_member_zss }}" + "zowe.setup.security.stcs.aux": "{{ zowe_xmem_proclib_member_aux }}" -# ============================================================================ -# Make sure we uninstall keyring setup before we do it again to avoid failures like -# RACDCERT ADD('ZOWEAD3.SMPE.CERT.JWTSCRT') ID(ZWESVUSR) WITHLABEL('JWTSECRET') TRUST -# IRRD111I The certificate cannot be added. The label jwtsecret is already in use. -- import_role: - name: zowe - tasks_from: uninstall_keyring +- name: Update zowe.yaml zowe.setup.certificate with PKCS12 keystore + when: zos_keystore_mode is undefined or zos_keystore_mode != 'KEYSTORE_MODE_KEYRING' + block: + - name: Delete keyring certificate setup + import_role: + name: zos + tasks_from: delete_zowe_yaml + vars: + configs: + - zowe.setup.certificate.keyring + - name: Update common PKCS12 setup + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.certificate.type": "PKCS12" + "zowe.setup.certificate.pkcs12.directory": "{{ zowe_keystore_dir }}" + "zowe.setup.certificate.pkcs12.lock": "{{ zowe_lock_keystore|string|lower }}" + "zowe.setup.certificate.pkcs12.name": "{{ zowe_keystore_alias }}" + "zowe.setup.certificate.pkcs12.password": "{{ zowe_keystore_password }}" + "zowe.setup.certificate.importCertificateAuthorities.0": "{{ zowe_external_certficate_authorities }}" + - name: Update PKCS12 setup when importing from external keystore + when: zowe_external_certficate is not none and zowe_external_certficate != '' + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.certificate.pkcs12.import.keystore": "{{ zowe_external_certficate }}" + "zowe.setup.certificate.pkcs12.import.password": "{{ zowe_keystore_password }}" + "zowe.setup.certificate.pkcs12.import.alias": "{{ zowe_external_certficate_alias }}" -# ============================================================================ -# Run ZWEKRING -- import_role: - name: configure - tasks_from: create_keyring +- name: Update zowe.yaml zowe.setup.certificate with z/OS keyring when: zos_keystore_mode is defined and zos_keystore_mode == 'KEYSTORE_MODE_KEYRING' - -# ============================================================================ -# Setup certificates for USS keystore (self-signed) -- import_role: - name: configure - tasks_from: setup_certificates - when: zos_keystore_mode is undefined or zos_keystore_mode != 'KEYSTORE_MODE_KEYRING' + block: + - name: Delete PKCS12 certificate setup + import_role: + name: zos + tasks_from: delete_zowe_yaml + vars: + configs: + - zowe.setup.certificate.pkcs12 + - name: Update common keyring setup + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.certificate.type": "JCERACFKS" + "zowe.setup.certificate.keyring.name": "{{ zowe_keyring_alias }}" + "zowe.setup.certificate.keyring.label": "{{ zowe_keyring_certname }}" + "zowe.setup.certificate.importCertificateAuthorities.0": "{{ zowe_external_certficate_authorities }},{{ zowe_keyring_external_intermediate_ca }},{{ zowe_keyring_external_root_ca }}" + - name: Update keyring setup when connecting to external certificate + when: zowe_external_certficate is not none and zowe_external_certficate != '' + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + # FIXME: import or connect? + "zowe.setup.certificate.keyring.connect.user": "{{ zowe_external_certficate }}" + "zowe.setup.certificate.keyring.connect.label": "{{ zowe_external_certficate_alias }}" + "zowe.setup.certificate.keyring.import.dsName": "{{ zowe_external_certficate }}" + "zowe.setup.certificate.keyring.import.password": "{{ zowe_external_certficate_alias }}" + - name: Update keyring setup to help import z/OSMF CA + when: zowe_external_certficate is not none and zowe_external_certficate != '' + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.setup.certificate.keyring.zOSMF.ca": "{{ zos_zosmf_ca }}" + "zowe.setup.certificate.keyring.zOSMF.user": "{{ zos_zosmf_user }}" -# ============================================================================ -# Setup client certificates +- name: Update zowe.yaml zowe.verifyCertificates to STRICT + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.verifyCertificates": "STRICT" + when: zowe_apiml_verify_certficates_of_services and zowe_apiml_nonstrict_verify_certficates_of_services -# Upload client certificate -- import_role: - name: configure - tasks_from: upload_certificate +- name: Update zowe.yaml zowe.verifyCertificates to NONSTRICT + import_role: + name: zos + tasks_from: update_zowe_yaml vars: - filename: USER-cert.cer - method: scp -# Upload client CA certificate -# This certificate will be configured in task Add the external CA to the truststore -- import_role: - name: configure - tasks_from: upload_certificate + configs: + "zowe.verifyCertificates": "NONSTRICT" + when: not zowe_apiml_verify_certficates_of_services and zowe_apiml_nonstrict_verify_certficates_of_services + +- name: Update zowe.yaml zowe.verifyCertificates to DISABLED + import_role: + name: zos + tasks_from: update_zowe_yaml vars: - filename: APIML_External_Certificate_Authority.cer - method: scp + configs: + "zowe.verifyCertificates": "DISABLED" + when: not zowe_apiml_verify_certficates_of_services and not zowe_apiml_nonstrict_verify_certficates_of_services -# Upload client CA certificate in PKCS12 -# This certificate will be configured in task Add the external CA to the keyring -- import_role: - name: configure - tasks_from: upload_certificate +- name: Update zowe.yaml zowe.setup.vsam + import_role: + name: zos + tasks_from: update_zowe_yaml vars: - filename: APIML_External_Certificate_Authority.p12 - method: sftp + configs: + "zowe.setup.vsam.volume": "{{ zowe_caching_vsam_volume }}" + "zowe.setup.vsam.storageClass": "{{ zowe_caching_vsam_storage_class }}" + "components.caching-service.storage.mode": "{{ zowe_caching_service_persistent }}" + "components.caching-service.storage.vsam.name": "{{ zowe_dataset_prefix }}.{{ zowe_caching_service_vsam_dsprefix }}{{ zowe_instance_id }}" -- import_role: - name: configure - tasks_from: configure_client_certificates +- name: Update zowe.yaml zowe.setup.vsam.mode to NONRLS + import_role: + name: zos + tasks_from: update_zowe_yaml vars: - certificate: "{{ work_dir_remote }}/USER-cert.cer" - dataset: USER - label: API ML Client + configs: + "zowe.setup.vsam.mode": "NONRLS" + when: not zos_vsam_rls -- import_role: - name: configure - tasks_from: configure_jwt_secret_certificate +- name: Update zowe.yaml zowe.setup.vsam.mode to RLS + import_role: + name: zos + tasks_from: update_zowe_yaml vars: - certificate: "{{ zowe_keystore_dir }}/{{ zowe_keystore_alias }}/{{ zowe_keystore_alias }}.keystore.{{ zowe_token_label }}.pem" - dataset: JWTSCRT - label: "{{ zowe_token_label }}" - when: zowe_apiml_security_x509_enabled and ( zos_keystore_mode is undefined or zos_keystore_mode != 'KEYSTORE_MODE_KEYRING' ) + configs: + "zowe.setup.vsam.mode": "RLS" + when: zos_vsam_rls -# ============================================================================ -# Setup certificates for keyring (self-signed) -- import_role: - name: configure - tasks_from: setup_keyring_certificates - when: zos_keystore_mode is defined and zos_keystore_mode == 'KEYSTORE_MODE_KEYRING' +- name: Update zowe.yaml runtime configs + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.runtimeDirectory": "{{ zowe_root_dir }}" + "zowe.logDirectory": "{{ zowe_instance_dir }}/logs" + "zowe.workspaceDirectory": "{{ zowe_instance_dir }}/workspace" + "zowe.extensionDirectory": "{{ zowe_extension_dir }}" + "zowe.job.name": "{{ zowe_job_prefix }}{{ zowe_instance_id }}SV" + "zowe.job.prefix": "{{ zowe_job_prefix }}{{ zowe_instance_id }}" + # FIXME: multiplpe domains? + "zowe.externalDomains.0": "{{ zowe_external_domain_name }}" + "zowe.externalPort": "{{ zowe_apiml_gateway_port }}" + "zowe.launchScript.logLevel": "{{ zowe_launch_scripts_loglevel }}" + "java.home": "{{ zos_java_home }}" + "node.home": "{{ zos_node_home }}" + "zOSMF.host": "{{ zos_zosmf_host }}" + "zOSMF.port": "{{ zos_zosmf_port }}" + "zOSMF.applId": "{{ zowe_apiml_security_zosmf_applid }}" -# ============================================================================ -# Create SSO token and bind to JWT secret certificate -- import_role: - name: configure - tasks_from: create_sso_token - when: zowe_apiml_security_x509_enabled +- name: Update zowe.yaml runtime configs if IP is defined + when: zowe_external_ip_address is not none and zowe_external_ip_address != '' + import_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "zowe.externalDomains.1": "{{ zowe_external_ip_address }}" -# ============================================================================ -# Add external API ML CA to the truststore -- name: Add the external CA to the truststore +- name: Update zowe.yaml components configs import_role: name: zos - tasks_from: run_script + tasks_from: update_zowe_yaml vars: - script_chdir: "{{ zowe_root_dir }}/bin" - script_filename: ./apiml_cm.sh - script_parameters: "--action trust --service-password {{ zowe_keystore_password }} --service-truststore {{ zowe_keystore_dir }}/{{ zowe_keystore_alias }}/{{ zowe_keystore_alias }}.truststore --service-storetype PKCS12 --certificate {{ work_dir_remote }}/APIML_External_Certificate_Authority.cer --alias amlexca" - when: zos_keystore_mode is undefined or zos_keystore_mode != 'KEYSTORE_MODE_KEYRING' + configs: + "components.gateway.port": "{{ zowe_apiml_gateway_port }}" + "components.metrics-service.port": "{{ zowe_apiml_metrics_service_port }}" + "components.api-catalog.port": "{{ zowe_apiml_catalog_port }}" + "components.discovery.port": "{{ zowe_apiml_discovery_port }}" + "components.caching-service.port": "{{ zowe_caching_service_port }}" + "components.app-server.port": "{{ zowe_zlux_port }}" + "components.zss.port": "{{ zowe_zss_port }}" + "components.jobs-api.port": "{{ zowe_jobs_api_port }}" + "components.files-api.port": "{{ zowe_mvs_api_port }}" + # other gateway configs + "components.gateway.apiml.gateway.timeoutMillis": "{{ zowe_apiml_gateway_timeout_millis }}" + "components.gateway.apiml.security.x509.enabled": "{{ zowe_apiml_security_x509_enabled|string|lower }}" + "components.gateway.apiml.security.auth.provider": "{{ zowe_apiml_security_auth_provider|string|lower }}" + "components.gateway.apiml.security.auth.zosmf.jwtAutoconfiguration": "{{ zowe_apiml_security_zosmf_jwt_autoconfiguration_mode }}" + # FIXME: uncertain configs + # sed -e "s+^ZWES_XMEM_SERVER_NAME=.*\$+ZWES_XMEM_SERVER_NAME={{ zowe_zss_xmem_name }}+" | \ + # sed -e "s+^ZWED_SSH_PORT=.*\$+ZWED_SSH_PORT={{ zowe_zlux_terminal_ssh_port }}+" | \ + # sed -e "s+^ZWED_TN3270_PORT=.*\$+ZWED_TN3270_PORT={{ zowe_zlux_terminal_telnet_port }}+" | \ + # sed -e "s+^ZWED_TN3270_SECURITY=.*\$+ZWED_TN3270_SECURITY={{ zowe_zlux_terminal_telnet_security_type }}+" | \ -- name: Add the external CA to the keyring - raw: "{{ zowe_root_dir }}/bin/utils/keyring-util/keyring-util IMPORT {{ zowe_runtime_user }} {{ zowe_keyring_alias }} amlexca CERTAUTH {{ work_dir_remote }}/APIML_External_Certificate_Authority.p12 password" - when: zos_keystore_mode is defined and zos_keystore_mode == 'KEYSTORE_MODE_KEYRING' +- name: Update zowe.yaml components enable status + when: zowe_launch_components != '' and zowe_launch_components is not none + block: + - name: Disable all components if zowe_launch_components is defined + include_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "components.{{ item }}.enabled": "false" + with_items: "{{ zowe_core_components }}" + - name: Update zowe.yaml components enable status + include_role: + name: zos + tasks_from: update_zowe_yaml + vars: + configs: + "components.{{ item }}.enabled": "true" + with_items: "{{ zowe_launch_components.split(',') }}" # ============================================================================ -# Configure Zowe Instance -- import_role: - name: configure - tasks_from: configure_instance +- name: Show zowe.yaml before zwe init + raw: cat "{{ zowe_instance_dir }}/zowe.yaml" | grep -v '^ *#' | sed '/^[[:space:]]*$/d' # ============================================================================ -# Create VSAM data set for this instance -- import_role: - name: configure - tasks_from: create_vsam_dataset +- name: Init Zowe + import_role: + name: zos + tasks_from: run_zwe + vars: + parameters: "init --update-config -l \"{{ zowe_install_logs_dir }}\"" diff --git a/playbooks/roles/configure/tasks/purge_job_outputs.yml b/playbooks/roles/configure/tasks/purge_job_outputs.yml deleted file mode 100644 index e776b4a8fd..0000000000 --- a/playbooks/roles/configure/tasks/purge_job_outputs.yml +++ /dev/null @@ -1,128 +0,0 @@ ---- -# This task will purge all Zowe job output - -# ============================================================================ -- import_role: - name: configure - tasks_from: locate_xmem - -# ============================================================================ -# Purge Zowe Job Output -- include_role: - name: zos - tasks_from: list_jobs - vars: - list_jobs_name: "{{ zowe_job_prefix }}{{ zowe_instance_id }}SV" - -- include_role: - name: zos - tasks_from: purge_job_output - vars: - purge_job_output_id: "{{ item }}" - loop: "{{ list_jobs_result.stdout_lines }}" - -# ============================================================================ -# Purge Cross Memory Job Output -- include_role: - name: zos - tasks_from: list_jobs - when: zowe_xmem_stc_name != "" - vars: - list_jobs_name: "{{ zowe_xmem_stc_name }}" - -- include_role: - name: zos - tasks_from: purge_job_output - vars: - purge_job_output_id: "{{ item }}" - loop: "{{ list_jobs_result.stdout_lines }}" - -# ============================================================================ -# Purge ZWESECUR -- include_role: - name: zos - tasks_from: list_jobs - vars: - list_jobs_name: "ZWESECUR" - -- include_role: - name: zos - tasks_from: purge_job_output - vars: - purge_job_output_id: "{{ item }}" - loop: "{{ list_jobs_result.stdout_lines }}" - -# ============================================================================ -# Purge ZWESECUR -- include_role: - name: zos - tasks_from: list_jobs - vars: - list_jobs_name: "ZWESECUR" - -- include_role: - name: zos - tasks_from: purge_job_output - vars: - purge_job_output_id: "{{ item }}" - loop: "{{ list_jobs_result.stdout_lines }}" - -# ============================================================================ -# Purge ZWECSVSM -- include_role: - name: zos - tasks_from: list_jobs - vars: - list_jobs_name: "ZWECSVSM" - -- include_role: - name: zos - tasks_from: purge_job_output - vars: - purge_job_output_id: "{{ item }}" - loop: "{{ list_jobs_result.stdout_lines }}" - -# ============================================================================ -# Purge ZWEKRING -- include_role: - name: zos - tasks_from: list_jobs - vars: - list_jobs_name: "ZWEKRING" - -- include_role: - name: zos - tasks_from: purge_job_output - vars: - purge_job_output_id: "{{ item }}" - loop: "{{ list_jobs_result.stdout_lines }}" - -# ============================================================================ -# Purge ZWESSOTK -- include_role: - name: zos - tasks_from: list_jobs - vars: - list_jobs_name: "ZWESSOTK" - -- include_role: - name: zos - tasks_from: purge_job_output - vars: - purge_job_output_id: "{{ item }}" - loop: "{{ list_jobs_result.stdout_lines }}" - -# ============================================================================ -# Purge ZWENOSSO -- include_role: - name: zos - tasks_from: list_jobs - vars: - list_jobs_name: "ZWENOSSO" - -- include_role: - name: zos - tasks_from: purge_job_output - vars: - purge_job_output_id: "{{ item }}" - loop: "{{ list_jobs_result.stdout_lines }}" diff --git a/playbooks/roles/configure/tasks/setup_certificates.yml b/playbooks/roles/configure/tasks/setup_certificates.yml deleted file mode 100644 index 23958a6ccb..0000000000 --- a/playbooks/roles/configure/tasks/setup_certificates.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -# this playbook runs bin/zowe-setup-certificates.sh to setup certificates for Zowe -# FIXME: HOSTNAME should be combination of zowe_zos_host and zowe_external_domain_name. -# The reason we use zowe_zos_host here is the certificates created here will only -# be used by z/OS side. Docker image may use different certificate with it's -# own zowe-setup-certificates.sh -- name: Prepare zowe-setup-certificates.env - raw: >- - cat "{{ zowe_root_dir }}/bin/zowe-setup-certificates.env" | \ - sed -e "s+^HOSTNAME=.*\$+HOSTNAME={{ zowe_zos_host }}+" | \ - sed -e "s+^IPADDRESS=.*\$+IPADDRESS={{ zowe_external_ip_address }}+" | \ - sed -e "s+^ZOSMF_CERTIFICATE=.*\$+ZOSMF_CERTIFICATE={{ zowe_zosmf_certificate }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE=.*\$+EXTERNAL_CERTIFICATE={{ zowe_external_certficate }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE_ALIAS=.*\$+EXTERNAL_CERTIFICATE_ALIAS={{ zowe_external_certficate_alias }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE_AUTHORITIES=.*\$+EXTERNAL_CERTIFICATE_AUTHORITIES={{ zowe_external_certficate_authorities }}+" | \ - sed -e "s+^VERIFY_CERTIFICATES=.*\$+VERIFY_CERTIFICATES={{ zowe_apiml_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^NONSTRICT_VERIFY_CERTIFICATES=.*\$+NONSTRICT_VERIFY_CERTIFICATES={{ zowe_apiml_nonstrict_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^KEYSTORE_DIRECTORY=.*\$+KEYSTORE_DIRECTORY={{ zowe_keystore_dir }}+" | \ - sed -e "s+^KEYSTORE_PASSWORD=.*\$+KEYSTORE_PASSWORD={{ zowe_keystore_password }}+" | \ - sed -e "s+^KEYSTORE_ALIAS=.*\$+KEYSTORE_ALIAS={{ zowe_keystore_alias }}+" | \ - sed -e "s+^ZOWE_USER_ID=.*\$+ZOWE_USER_ID={{ zowe_runtime_user }}+" | \ - sed -e "s+^ZOWE_GROUP_ID=.*\$+ZOWE_GROUP_ID={{ zowe_runtime_group }}+" | \ - sed -e "s+^ZOWE_LOCK_KEYSTORE=.*\$+ZOWE_LOCK_KEYSTORE={{ zowe_lock_keystore }}+" \ - > "{{ work_dir_remote }}/zowe-setup-certificates.env" - when: not zowe_apiml_security_x509_enabled - -- name: Prepare zowe-setup-certificates.env - raw: >- - cat "{{ zowe_root_dir }}/bin/zowe-setup-certificates.env" | \ - sed -e "s+^HOSTNAME=.*\$+HOSTNAME={{ zowe_zos_host }}+" | \ - sed -e "s+^IPADDRESS=.*\$+IPADDRESS={{ zowe_external_ip_address }}+" | \ - sed -e "s+^ZOSMF_CERTIFICATE=.*\$+ZOSMF_CERTIFICATE={{ zowe_zosmf_certificate }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE=.*\$+EXTERNAL_CERTIFICATE={{ zowe_external_certficate }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE_ALIAS=.*\$+EXTERNAL_CERTIFICATE_ALIAS={{ zowe_external_certficate_alias }}+" | \ - sed -e "s+^EXTERNAL_CERTIFICATE_AUTHORITIES=.*\$+EXTERNAL_CERTIFICATE_AUTHORITIES={{ zowe_external_certficate_authorities }}+" | \ - sed -e "s+^VERIFY_CERTIFICATES=.*\$+VERIFY_CERTIFICATES={{ zowe_apiml_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^NONSTRICT_VERIFY_CERTIFICATES=.*\$+NONSTRICT_VERIFY_CERTIFICATES={{ zowe_apiml_nonstrict_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^KEYSTORE_DIRECTORY=.*\$+KEYSTORE_DIRECTORY={{ zowe_keystore_dir }}+" | \ - sed -e "s+^KEYSTORE_PASSWORD=.*\$+KEYSTORE_PASSWORD={{ zowe_keystore_password }}+" | \ - sed -e "s+^KEYSTORE_ALIAS=.*\$+KEYSTORE_ALIAS={{ zowe_keystore_alias }}+" | \ - sed -e "s+^PKCS11_TOKEN_NAME=.*\$+PKCS11_TOKEN_NAME={{ zowe_token_name }}+" | \ - sed -e "s+^PKCS11_TOKEN_LABEL=.*\$+PKCS11_TOKEN_LABEL={{ zowe_token_label }}+" | \ - sed -e "s+^ZOWE_USER_ID=.*\$+ZOWE_USER_ID={{ zowe_runtime_user }}+" | \ - sed -e "s+^ZOWE_GROUP_ID=.*\$+ZOWE_GROUP_ID={{ zowe_runtime_group }}+" | \ - sed -e "s+^ZOWE_LOCK_KEYSTORE=.*\$+ZOWE_LOCK_KEYSTORE={{ zowe_lock_keystore }}+" \ - > "{{ work_dir_remote }}/zowe-setup-certificates.env" - when: zowe_apiml_security_x509_enabled - -- name: Show zowe-setup-certificates.env - raw: cat "{{ work_dir_remote }}/zowe-setup-certificates.env" - -- name: Setup certificates - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/bin" - script_filename: ./zowe-setup-certificates.sh - script_parameters: "-p \"{{ work_dir_remote }}/zowe-setup-certificates.env\" -l \"{{ zowe_install_logs_dir }}\"" - -- name: List log dir - raw: ls -l "{{ zowe_install_logs_dir }}" - ignore_errors: True - -- name: Show setup certificate log - raw: find {{ zowe_install_logs_dir }} -name "zowe-setup-certificates-*.log" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' - ignore_errors: True - -- name: List certificates directory - raw: ls -l "{{ zowe_keystore_dir }}" - diff --git a/playbooks/roles/configure/tasks/setup_keyring_certificates.yml b/playbooks/roles/configure/tasks/setup_keyring_certificates.yml deleted file mode 100644 index b24a1d9f7b..0000000000 --- a/playbooks/roles/configure/tasks/setup_keyring_certificates.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -# this playbook runs bin/zowe-setup-certificates.sh to setup certificates for Zowe in Keyring mode -# FIXME: HOSTNAME should be combination of zowe_zos_host and zowe_external_domain_name. -# The reason we use zowe_zos_host here is the certificates created here will only -# be used by z/OS side. Docker image may use different certificate with it's -# own zowe-setup-certificates.sh - -- name: Validate that we were in keyring mode - fail: - msg: "Error. This play should only be run when in keyring mode" - when: zos_keystore_mode is undefined or zos_keystore_mode != 'KEYSTORE_MODE_KEYRING' - -- name: Prepare zowe-setup-keyring-certificates.env - raw: >- - cat "{{ zowe_root_dir }}/bin/zowe-setup-keyring-certificates.env" | \ - sed -e "s+^HOSTNAME=.*\$+HOSTNAME={{ zowe_zos_host }}+" | \ - sed -e "s+^IPADDRESS=.*\$+IPADDRESS={{ zowe_external_ip_address }}+" | \ - sed -e "s+^VERIFY_CERTIFICATES=.*\$+VERIFY_CERTIFICATES={{ zowe_apiml_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^NONSTRICT_VERIFY_CERTIFICATES=.*\$+NONSTRICT_VERIFY_CERTIFICATES={{ zowe_apiml_nonstrict_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^KEYSTORE_DIRECTORY=.*\$+KEYSTORE_DIRECTORY={{ zowe_keystore_dir }}+" | \ - sed -e "s+^ZOWE_CERTIFICATE_LABEL=.*\$+ZOWE_CERTIFICATE_LABEL={{ zowe_keyring_certname }}+" | \ - sed -e "s+^ZOWE_USER_ID=.*\$+ZOWE_USER_ID={{ zowe_runtime_user }}+" | \ - sed -e "s+^ZOWE_KEYRING=.*\$+ZOWE_KEYRING={{ zowe_keyring_alias }}+" \ - > "{{ work_dir_remote }}/zowe-setup-keyring-certificates.env" - when: not zowe_apiml_security_x509_enabled - -- name: Prepare zowe-setup-keyring-certificates.env - raw: >- - cat "{{ zowe_root_dir }}/bin/zowe-setup-keyring-certificates.env" | \ - sed -e "s+^HOSTNAME=.*\$+HOSTNAME={{ zowe_zos_host }}+" | \ - sed -e "s+^IPADDRESS=.*\$+IPADDRESS={{ zowe_external_ip_address }}+" | \ - sed -e "s+^VERIFY_CERTIFICATES=.*\$+VERIFY_CERTIFICATES={{ zowe_apiml_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^NONSTRICT_VERIFY_CERTIFICATES=.*\$+NONSTRICT_VERIFY_CERTIFICATES={{ zowe_apiml_nonstrict_verify_certficates_of_services|string|lower }}+" | \ - sed -e "s+^KEYSTORE_DIRECTORY=.*\$+KEYSTORE_DIRECTORY={{ zowe_keystore_dir }}+" | \ - sed -e "s+^ZOWE_CERTIFICATE_LABEL=.*\$+ZOWE_CERTIFICATE_LABEL={{ zowe_keyring_certname }}+" | \ - sed -e "s+^PKCS11_TOKEN_NAME=.*\$+PKCS11_TOKEN_NAME={{ zowe_token_name }}+" | \ - sed -e "s+^PKCS11_TOKEN_LABEL=.*\$+PKCS11_TOKEN_LABEL={{ zowe_token_label }}+" | \ - sed -e "s+^ZOWE_USER_ID=.*\$+ZOWE_USER_ID={{ zowe_runtime_user }}+" | \ - sed -e "s+^ZOWE_KEYRING=.*\$+ZOWE_KEYRING={{ zowe_keyring_alias }}+" \ - > "{{ work_dir_remote }}/zowe-setup-keyring-certificates.env" - when: zowe_apiml_security_x509_enabled - -- name: Show zowe-setup-keyring-certificates.env - raw: cat "{{ work_dir_remote }}/zowe-setup-keyring-certificates.env" - -- name: Setup keyring certificates - import_role: - name: zos - tasks_from: run_script - vars: - script_chdir: "{{ zowe_root_dir }}/bin" - script_filename: ./zowe-setup-certificates.sh - script_parameters: "-p \"{{ work_dir_remote }}/zowe-setup-keyring-certificates.env\" -l \"{{ zowe_install_logs_dir }}\"" - -- name: List log dir - raw: ls -l "{{ zowe_install_logs_dir }}" - ignore_errors: True - -- name: Show setup certificate log - raw: find {{ zowe_install_logs_dir }} -name "zowe-setup-certificates-*.log" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' - ignore_errors: True - -- name: List certificates directory - raw: ls -l "{{ zowe_keystore_dir }}" diff --git a/playbooks/roles/configure/tasks/show_logs.yml b/playbooks/roles/configure/tasks/show_logs.yml index cbb19289f5..e47f13c039 100644 --- a/playbooks/roles/configure/tasks/show_logs.yml +++ b/playbooks/roles/configure/tasks/show_logs.yml @@ -1,18 +1,23 @@ --- # Show all Zowe Job Logs +# ============================================================================ +- name: Show final zowe.yaml + raw: cat "{{ zowe_instance_dir }}/zowe.yaml" | grep -v '^ *#' | sed '/^[[:space:]]*$/d' + # ============================================================================ - import_role: name: configure tasks_from: locate_xmem # ============================================================================ +# Show zowe job log - import_role: name: zos tasks_from: show_job_log vars: - show_job_log_id: - show_job_log_owner: '*' + show_job_log_id: "" + show_job_log_owner: "*" show_job_log_name: "{{ zowe_job_prefix }}{{ zowe_instance_id }}SV" - import_role: @@ -20,15 +25,44 @@ tasks_from: show_job_log when: zowe_xmem_stc_name != "" vars: - show_job_log_id: - show_job_log_owner: '*' + show_job_log_id: "" + show_job_log_owner: "*" show_job_log_name: "{{ zowe_xmem_stc_name }}" # ============================================================================ +# Show zwe init job logs +- include_role: + name: zos + tasks_from: show_all_job_logs + vars: + show_jobs_name: "{{ job_name_to_show }}" + loop: + - ZWESECUR + - ZWEKRING + - ZWENOKYR + loop_control: + loop_var: job_name_to_show + +# ============================================================================ +# Show SMPE job logs +- include_role: + name: fmid + tasks_from: show_logs + +# ============================================================================ +- name: List install log dir + raw: ls -l "{{ zowe_install_logs_dir }}" + ignore_errors: True + - name: Show Zowe installation logs raw: find "{{ zowe_install_logs_dir }}" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' ignore_errors: True +# ============================================================================ +- name: List runtime log dir + raw: ls -l "{{ zowe_instance_dir }}/logs" + ignore_errors: True + - name: Show Zowe runtime logs raw: find "{{ zowe_instance_dir }}/logs" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' ignore_errors: True diff --git a/playbooks/roles/custom_for_test/README.md b/playbooks/roles/custom_for_test/README.md new file mode 100644 index 0000000000..1fe76a7793 --- /dev/null +++ b/playbooks/roles/custom_for_test/README.md @@ -0,0 +1,6 @@ +# Ansible Role - Custom test environment + +This role will custom Zowe instance for testing purpose. + +NOTE: This role is not required to start Zowe, but it's required to run sanity + tests provided by zowe-install-packaging. diff --git a/playbooks/roles/custom_for_test/defaults/main.yml b/playbooks/roles/custom_for_test/defaults/main.yml new file mode 100644 index 0000000000..fc2b8ff1eb --- /dev/null +++ b/playbooks/roles/custom_for_test/defaults/main.yml @@ -0,0 +1,139 @@ +--- +# ============================================================================== +# Constants +# ============================================================================== + +# full core components list, they should show up in components section in zowe.yaml +zowe_core_components: +- gateway +- metrics-service +- api-catalog +- discovery +- caching-service +- app-server +- zss +- jobs-api +- files-api +- explorer-jes +- explorer-mvs +- explorer-uss + +# this should list all known cross memory server stc we ever setup during install +zowe_known_xmem_proc_stcs: +- ZWESIS01 +- ZWEXMSTC +- ZWESISTC + +# ============================================================================== +# Variables should be verified and overwrittern. +# ============================================================================== +# temporary folder on remote +work_dir_remote: +# default zowe runtime root directory +zowe_root_dir: ~/zowe +# if your z/OS system has VSAM RLS (record level sharing) enabled. +# usually this value should be true in Parallel Sysplex. +zos_vsam_rls: false +# dataset prefix where zowe will be installed +zowe_dataset_prefix: +# instanceDir +zowe_instance_dir: ~/.zowe/instance +# install logs directory +zowe_install_logs_dir: ~/.zowe/logs +# zowe job prefix. +zowe_job_prefix: ZWE +# instance id. This will be put into zowe job name after {{ zowe_job_prefix }} +zowe_instance_id: 1 +# default z/OSMF port. Optional, default value is ansible_ssh_host +zos_zosmf_host: +# default z/OSMF port +zos_zosmf_port: 10443 +# default z/OSMF user +zos_zosmf_user: IZUSVR +# default z/OSMF Certificate Authority +zos_zosmf_ca: +# APIML ports +zowe_apiml_metrics_service_port: 7551 +zowe_apiml_catalog_port: 7552 +zowe_apiml_discovery_port: 7553 +zowe_apiml_gateway_port: 7554 +zowe_apiml_verify_certficates_of_services: true +zowe_apiml_nonstrict_verify_certficates_of_services: true +# APIML configuration properties +zowe_apiml_gateway_timeout_millis: 600000 +zowe_apiml_security_x509_enabled: false +zowe_apiml_security_zosmf_applid: IZUDFLT +zowe_apiml_security_auth_provider: zosmf +zowe_apiml_security_zosmf_jwt_autoconfiguration_mode: auto +# explorer APIs/plugins ports +zowe_jobs_api_port: 7600 +zowe_mvs_api_port: 7559 +zowe_jobs_explorer_port: 7560 +zowe_mvs_explorer_port: 7561 +zowe_uss_explorer_port: 7562 +# caching service +zowe_caching_service_port: 7555 +zowe_caching_service_persistent: VSAM +# the final data set name will be: {zowe_dataset_prefix}.{zowe_caching_service_vsam_dsprefix}{zowe_instance_id} +# for example: IBMUSER.ZWE.CACHE1 +zowe_caching_service_vsam_dsprefix: CACHE +zowe_caching_vsam_storage_class: +zowe_caching_vsam_volume: +# zlux ports +zowe_zlux_port: 7556 +zowe_zss_https: True +zowe_zss_port: 7557 +# make sure that this equals to zssCrossMemoryServerName in install in zowe-install-apf-server.yaml +zowe_zss_xmem_name: ZWESIS_STD +zowe_zlux_terminal_ssh_port: 22 +zowe_zlux_terminal_telnet_port: 23 +# The security type of the tn3270 connection - valid values are blank('') for telnet, or 'tls' +zowe_zlux_terminal_telnet_security_type: +zowe_zosmf_certificate: +zowe_external_certficate: +zowe_external_certficate_alias: +zowe_external_certficate_authorities: +zowe_keystore_dir: ~/.zowe/keystore +zowe_keystore_password: password +zowe_keyring_alias: ZoweKeyring +zowe_keyring_certname: ZoweCert +zowe_keyring_external_intermediate_ca: +zowe_keyring_external_root_ca: +zowe_keystore_alias: localhost +zowe_jcllib: +zowe_proclib_dsname: auto +zowe_proclib_membername: ZWESLSTC +zowe_runtime_user: ZWESVUSR +zowe_runtime_group: ZWEADMIN +zowe_auto_create_user_group: false +# if we want to skip executing ZWESECUR job +zowe_configure_skip_zwesecur: false + +################################################################################ +# these are default variables for cross memory configuration +zowe_xmem_proclib: +zowe_xmem_parmlib: +# this is optional, it will fall back to {{zowe_dataset_prefix}}.SZWEAUTH +zowe_xmem_loadlib: +zowe_xmem_pluginlib: +zowe_xmem_proclib_member_zss: ZWESISTC +zowe_xmem_proclib_member_aux: ZWESASTC +zowe_xmem_stc_user: ZWESIUSR +zowe_xmem_stc_group: ZWEADMIN + +# optional, default to ansible_ssh_host +# required for zD&T (external IP is different from internal IP) +zowe_zos_host: +# optional, default to zowe_zos_host +# for z/OS deployment, this can be left empty and be same as zowe_zos_host +# for all-in-one docker deployment, this can be set to domain where you start docker container +zowe_external_domain_name: +# optional, no default value +# required for zD&T (external IP is different from internal IP) +zowe_external_ip_address: +# Restrict permissions to keystore/truststore after the certificate setup script +zowe_lock_keystore: true +# comma separated string +zowe_launch_components: +# log level for Zowe launch scripts +zowe_launch_scripts_loglevel: diff --git a/playbooks/roles/configure/files/APIML_External_Certificate_Authority.cer b/playbooks/roles/custom_for_test/files/APIML_External_Certificate_Authority.cer similarity index 100% rename from playbooks/roles/configure/files/APIML_External_Certificate_Authority.cer rename to playbooks/roles/custom_for_test/files/APIML_External_Certificate_Authority.cer diff --git a/playbooks/roles/configure/files/APIML_External_Certificate_Authority.p12 b/playbooks/roles/custom_for_test/files/APIML_External_Certificate_Authority.p12 similarity index 100% rename from playbooks/roles/configure/files/APIML_External_Certificate_Authority.p12 rename to playbooks/roles/custom_for_test/files/APIML_External_Certificate_Authority.p12 diff --git a/playbooks/roles/configure/files/USER-PRIVATEKEY.key b/playbooks/roles/custom_for_test/files/USER-PRIVATEKEY.key similarity index 100% rename from playbooks/roles/configure/files/USER-PRIVATEKEY.key rename to playbooks/roles/custom_for_test/files/USER-PRIVATEKEY.key diff --git a/playbooks/roles/configure/files/USER-cert.cer b/playbooks/roles/custom_for_test/files/USER-cert.cer similarity index 100% rename from playbooks/roles/configure/files/USER-cert.cer rename to playbooks/roles/custom_for_test/files/USER-cert.cer diff --git a/playbooks/roles/configure/files/ZWECCADD.jcl b/playbooks/roles/custom_for_test/files/ZWECCADD.jcl similarity index 100% rename from playbooks/roles/configure/files/ZWECCADD.jcl rename to playbooks/roles/custom_for_test/files/ZWECCADD.jcl diff --git a/playbooks/roles/docker/meta/main.yml b/playbooks/roles/custom_for_test/meta/main.yml similarity index 95% rename from playbooks/roles/docker/meta/main.yml rename to playbooks/roles/custom_for_test/meta/main.yml index 16f8e8849b..789fda0dd4 100644 --- a/playbooks/roles/docker/meta/main.yml +++ b/playbooks/roles/custom_for_test/meta/main.yml @@ -1,6 +1,6 @@ galaxy_info: author: Zowe Committers - description: Install Zowe Docker + description: Custom configuration to setup test environments company: Zowe license: EPL-2.0 diff --git a/playbooks/roles/configure/tasks/add_client_certificate_acf2.yml b/playbooks/roles/custom_for_test/tasks/add_client_certificate_acf2.yml similarity index 100% rename from playbooks/roles/configure/tasks/add_client_certificate_acf2.yml rename to playbooks/roles/custom_for_test/tasks/add_client_certificate_acf2.yml diff --git a/playbooks/roles/configure/tasks/configure_client_certificates.yml b/playbooks/roles/custom_for_test/tasks/configure_client_certificates.yml similarity index 100% rename from playbooks/roles/configure/tasks/configure_client_certificates.yml rename to playbooks/roles/custom_for_test/tasks/configure_client_certificates.yml diff --git a/playbooks/roles/custom_for_test/tasks/main.yml b/playbooks/roles/custom_for_test/tasks/main.yml new file mode 100644 index 0000000000..0aa791a553 --- /dev/null +++ b/playbooks/roles/custom_for_test/tasks/main.yml @@ -0,0 +1,101 @@ +--- +# This playbook performs regular configuration after Zowe is installed. + +# ============================================================================ +- include_role: + name: common + tasks_from: validate_variables + vars: + variable_list: + - work_dir_remote + - zowe_root_dir + # - zowe_instance_dir + # - zowe_keystore_dir + # - zowe_install_logs_dir + # - zowe_dataset_prefix + # - zowe_jcllib + # - zowe_proclib_dsname + # - zowe_proclib_membername + # - zowe_runtime_group + # - zowe_runtime_user + # - zowe_xmem_proclib + # - zowe_xmem_parmlib + # # optional + # # - zowe_xmem_loadlib + # - zowe_xmem_pluginlib + # - zowe_xmem_proclib_member_zss + # - zowe_xmem_proclib_member_aux + # - zowe_xmem_stc_user + # - zowe_job_prefix + # - zowe_instance_id + # - zowe_apiml_catalog_port + # - zowe_apiml_discovery_port + # - zowe_apiml_gateway_port + # - zowe_apiml_gateway_timeout_millis + # - zowe_apiml_security_x509_enabled + # - zowe_apiml_security_zosmf_applid + # - zowe_apiml_security_auth_provider + # - zowe_jobs_api_port + # - zowe_mvs_api_port + # - zowe_jobs_explorer_port + # - zowe_mvs_explorer_port + # - zowe_uss_explorer_port + # - zowe_zlux_port + # - zowe_zss_port + # - zowe_zss_xmem_name + # - zowe_zlux_terminal_ssh_port + # - zowe_zlux_terminal_telnet_port + # - zos_security_system + # - zowe_lock_keystore + +# # ============================================================================ +# # Setup client certificates + +# # Upload client certificate +# - include_role: +# name: configure +# tasks_from: upload_certificate +# vars: +# filename: USER-cert.cer +# method: scp +# # Upload client CA certificate +# # This certificate will be configured in task Add the external CA to the truststore +# - include_role: +# name: configure +# tasks_from: upload_certificate +# vars: +# filename: APIML_External_Certificate_Authority.cer +# method: scp + +# # Upload client CA certificate in PKCS12 +# # This certificate will be configured in task Add the external CA to the keyring +# - include_role: +# name: configure +# tasks_from: upload_certificate +# vars: +# filename: APIML_External_Certificate_Authority.p12 +# method: sftp + +# - include_role: +# name: configure +# tasks_from: configure_client_certificates +# vars: +# certificate: "{{ work_dir_remote }}/USER-cert.cer" +# dataset: USER +# label: API ML Client + +# # ============================================================================ +# # Add external API ML CA to the truststore +# - name: Add the external CA to the truststore +# include_role: +# name: zos +# tasks_from: run_script +# vars: +# script_chdir: "{{ zowe_root_dir }}/bin" +# script_filename: ./apiml_cm.sh +# script_parameters: "--action trust --service-password {{ zowe_keystore_password }} --service-truststore {{ zowe_keystore_dir }}/{{ zowe_keystore_alias }}/{{ zowe_keystore_alias }}.truststore --service-storetype PKCS12 --certificate {{ work_dir_remote }}/APIML_External_Certificate_Authority.cer --alias amlexca" +# when: zos_keystore_mode is undefined or zos_keystore_mode != 'KEYSTORE_MODE_KEYRING' + +# - name: Add the external CA to the keyring +# raw: "{{ zowe_root_dir }}/bin/utils/keyring-util/keyring-util IMPORT {{ zowe_runtime_user }} {{ zowe_keyring_alias }} amlexca CERTAUTH {{ work_dir_remote }}/APIML_External_Certificate_Authority.p12 password" +# when: zos_keystore_mode is defined and zos_keystore_mode == 'KEYSTORE_MODE_KEYRING' diff --git a/playbooks/roles/configure/tasks/upload_certificate.yml b/playbooks/roles/custom_for_test/tasks/upload_certificate.yml similarity index 100% rename from playbooks/roles/configure/tasks/upload_certificate.yml rename to playbooks/roles/custom_for_test/tasks/upload_certificate.yml diff --git a/playbooks/roles/docker/defaults/main.yml b/playbooks/roles/docker/defaults/main.yml deleted file mode 100644 index 05b1e840b4..0000000000 --- a/playbooks/roles/docker/defaults/main.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# ============================================================================== -# Constants -# ============================================================================== -# 360 * 10 seconds = 1hour -wait_for_zowe_service_retries: 60 -# Every 10 seconds -wait_for_zowe_service_delay: 5 -# zowe docker image -zowe_docker_image: ompzowe/server-bundle -zowe_docker_tag: amd64 - -# ============================================================================== -# Variables should be verified and overwrittern. -# ============================================================================== -# default z/OSMF port. Optional, default value is ansible_ssh_host -zos_zosmf_host: -# default z/OSMF port -zos_zosmf_port: 10443 -zowe_zss_https: True -zowe_zss_port: 7557 -zowe_launch_components: zss - -zowe_zlux_terminal_telnet_port: 23 -# The security type of the tn3270 connection - valid values are blank('') for telnet, or 'tls' -zowe_zlux_terminal_telnet_security_type: - -zowe_root_dir: ~/ diff --git a/playbooks/roles/docker/tasks/configure-zowe-for-docker.yml b/playbooks/roles/docker/tasks/configure-zowe-for-docker.yml deleted file mode 100644 index 1e25f39cbc..0000000000 --- a/playbooks/roles/docker/tasks/configure-zowe-for-docker.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- name: Reset zowe_launch_components for docker install - set_fact: - zowe_launch_components: zss - -- import_role: - name: configure - -- name: Attach new line to instance.env to make sure we don't accidentally append to last line - raw: echo "" >> "{{ zowe_instance_dir }}/instance.env" - -# zowe_launch_components reset may not work, let's make sure ZWE_LAUNCH_COMPONENTS -# is defined in instance.env -- name: Check if ZWE_LAUNCH_COMPONENTS exists in instance.env - raw: grep ZWE_LAUNCH_COMPONENTS '{{ zowe_instance_dir }}/instance.env' - ignore_errors: True - register: check_zwe_launch_components_existence - -# FIXME: the reason why we don't ensure ZWE_LAUNCH_COMPONENTS exists in instance.env -# in configure role is verifying backward compatibility? -- name: Attach ZWE_LAUNCH_COMPONENTS if instance.env doesn't have this entry - when: check_zwe_launch_components_existence.rc != 0 - raw: echo "ZWE_LAUNCH_COMPONENTS={{ zowe_launch_components }}" >> '{{ zowe_instance_dir }}/instance.env' - -- name: Make zss available externally - raw: echo "ZWED_agent_https_ipAddresses=0.0.0.0" >> "{{ zowe_instance_dir }}/instance.env" - -- name: Show instance.env - raw: cat "{{ zowe_instance_dir }}/instance.env" diff --git a/playbooks/roles/docker/tasks/docker-logs.yml b/playbooks/roles/docker/tasks/docker-logs.yml deleted file mode 100644 index 7663cfaeca..0000000000 --- a/playbooks/roles/docker/tasks/docker-logs.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: get docker logs of container {{container_id}} - raw: docker logs {{container_id}} - when: container_id is defined - delegate_to: localhost - ignore_errors: True - -- name: get docker logs using docker ps - raw: docker ps --format "{% raw %}{{.ID}} {{.Image}}{% endraw %}" | grep {{ zowe_docker_image }} | awk '{print $1}' | xargs -r docker logs - when: container_id is not defined - delegate_to: localhost - ignore_errors: True \ No newline at end of file diff --git a/playbooks/roles/docker/tasks/docker-pull.yml b/playbooks/roles/docker/tasks/docker-pull.yml deleted file mode 100644 index 38146c54f7..0000000000 --- a/playbooks/roles/docker/tasks/docker-pull.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -# ============================================================================ -# download from Artifactory if zowe_docker_image_url exists -- name: Download Zowe docker image from zowe_docker_image_url if it has value - when: zowe_docker_image_url is defined and zowe_docker_image_url != '' - block: - - name: Download zowe build if zowe_docker_image_url exists - get_url: - url: "{{ zowe_docker_image_url }}" - dest: "{{ work_dir_local }}/{{ inventory_hostname }}/zowe_docker_image.tar" - delegate_to: localhost - - - name: Update zowe_docker_image_local - set_fact: - zowe_docker_image_local: "{{ work_dir_local }}/{{ inventory_hostname }}/zowe_docker_image.tar" - - -# ============================================================================ -# load Docker image if zowe_docker_image_local exists -- name: Download Zowe from zowe_docker_image_local if it has value - when: zowe_docker_image_local is defined and zowe_docker_image_local != '' - block: - - name: Load docker image - raw: docker load --input "{{ zowe_docker_image_local }}" - register: docker_load_result - delegate_to: localhost - # we made assumption the tar file only contains one docker image - - set_fact: - docker_image_loaded: "{{ docker_load_result.stdout | regex_findall('Loaded image:[ ]+(.+)') | join('') | regex_findall('(.+):(.+)') }}" - - set_fact: - zowe_docker_image: "{{ docker_image_loaded[0][0] }}" - zowe_docker_tag: "{{ docker_image_loaded[0][1] }}" - - debug: - msg: "Docker imaged loaded is: {{ zowe_docker_image }}:{{ zowe_docker_tag }}" - -# ============================================================================ -# pull image from Docker Hub -- name: Pull docker image {{zowe_docker_image}}:{{zowe_docker_tag}} from Docker Hub - when: zowe_docker_image_local is undefined or zowe_docker_image_local == '' - raw: docker pull {{zowe_docker_image}}:{{zowe_docker_tag}} - delegate_to: localhost diff --git a/playbooks/roles/docker/tasks/docker-start.yml b/playbooks/roles/docker/tasks/docker-start.yml deleted file mode 100644 index 8f6f3d2496..0000000000 --- a/playbooks/roles/docker/tasks/docker-start.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- name: start docker in detached mode - raw: >- - docker run -d --rm --env ZOWE_EXPLORER_HOST={{ zowe_external_domain_name }} \ - --env ZOWE_IP_ADDRESS=0.0.0.0 \ - --env ZOSMF_HOST={{zos_zosmf_host}} \ - --env ZOSMF_PORT={{zos_zosmf_port}} \ - --env ZWED_agent_host={{zowe_zos_host}} \ - --env ZWED_agent_https_port={{zowe_zss_port}} \ - --env ZWED_TN3270_PORT={{zowe_zlux_terminal_telnet_port}} \ - --env ZWED_TN3270_SECURITY={{ zowe_zlux_terminal_telnet_security_type }} \ - --env ZWED_SSH_HOST={{zowe_zos_host}} \ - --env GATEWAY_PORT={{zowe_apiml_gateway_port}} \ - --expose {{zowe_apiml_gateway_port}} \ - -p {{zowe_apiml_discovery_port}}:7553 \ - -p {{zowe_apiml_gateway_port}}:{{zowe_apiml_gateway_port}} \ - -p {{zowe_zlux_port}}:7556 \ - {{zowe_docker_image}}:{{zowe_docker_tag}} - register: container_id_response - delegate_to: localhost - -- name: Set container_id - set_fact: - container_id: "{{ container_id_response.stdout_lines[0] }}" - -# wait for docker to start -- import_role: - name: docker - tasks_from: wait-for-docker - -# get docker logs -- import_role: - name: docker - tasks_from: docker-logs diff --git a/playbooks/roles/docker/tasks/main.yml b/playbooks/roles/docker/tasks/main.yml deleted file mode 100644 index 51047dbab1..0000000000 --- a/playbooks/roles/docker/tasks/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# Docker Pull & Run -- import_role: - name: docker - tasks_from: uninstall - -- import_role: - name: docker - tasks_from: docker-pull - -# Docker Start -- import_role: - name: docker - tasks_from: docker-start \ No newline at end of file diff --git a/playbooks/roles/docker/tasks/uninstall.yml b/playbooks/roles/docker/tasks/uninstall.yml deleted file mode 100644 index 5ed04e4b2f..0000000000 --- a/playbooks/roles/docker/tasks/uninstall.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: remove docker if running - raw: >- - docker ps --format "{% raw %}{{.ID}} {{.Image}}{% endraw %}" 2>&1 | grep {{ zowe_docker_image }} | awk '{print $1}' | xargs -r docker rm -f - ignore_errors: True - delegate_to: localhost \ No newline at end of file diff --git a/playbooks/roles/docker/tasks/wait-for-docker.yml b/playbooks/roles/docker/tasks/wait-for-docker.yml deleted file mode 100644 index 0c039998c6..0000000000 --- a/playbooks/roles/docker/tasks/wait-for-docker.yml +++ /dev/null @@ -1,105 +0,0 @@ ---- -# ============================================================================ -- name: Update zowe_test_user from ansible_user if it's not defined - # hide log to avoid exposing zowe_test_user - no_log: True - set_fact: - zowe_test_user: "{{ hostvars[inventory_hostname].ansible_user }}" - when: zowe_test_user == '' or zowe_test_user is none - -- name: Update zowe_test_password from ansible_password if it's not defined - # hide log to avoid exposing zowe_test_password - no_log: True - set_fact: - zowe_test_password: "{{ hostvars[inventory_hostname].ansible_password }}" - when: zowe_test_password == '' or zowe_test_password is none - -# ============================================================================ -# verify variables -- import_role: - name: common - tasks_from: validate_variables - vars: - variable_list: - - zowe_zos_host - - zowe_external_domain_name - - zowe_zss_port - - zowe_zlux_port - - zowe_jobs_api_port - - zowe_apiml_gateway_port - -- name: Wait for being able to login to ZSS at port {{zowe_zss_port}} - uri: - # ZSS is always running on z/OS side - url: "{{ zowe_zss_https | ternary('https', 'http') }}://{{ zowe_zos_host }}:{{ zowe_zss_port }}/login" - follow_redirects: none - method: POST - body_format: json - body: - username: "{{ zowe_test_user }}" - password: "{{ zowe_test_password }}" - validate_certs: false - status_code: - - 200 - register: _result - until: _result.status == 200 - retries: "{{ wait_for_zowe_service_retries | int }}" - delay: "{{ wait_for_zowe_service_delay | int }}" - when: '"zss" in zowe_launch_components' - delegate_to: localhost - # hide log to avoid exposing zowe_test_user and zowe_test_password - no_log: True - -- name: Wait for APIML port {{zowe_apiml_gateway_port}} to be available - uri: - url: "https://{{ zowe_external_domain_name }}:{{zowe_apiml_gateway_port}}" - follow_redirects: none - method: GET - validate_certs: false - register: _result - until: _result.status == 200 - retries: "{{ wait_for_zowe_service_retries | int }}" - delay: "{{ wait_for_zowe_service_delay | int }}" - delegate_to: localhost - -- name: Wait for being able to login to App Server at port {{zowe_zlux_port}} - uri: - url: "https://{{ zowe_external_domain_name }}:{{zowe_zlux_port}}/auth" - follow_redirects: none - method: POST - body_format: json - body: - username: "{{ zowe_test_user }}" - password: "{{ zowe_test_password }}" - validate_certs: false - status_code: - - 200 - - 204 - register: _result - until: _result.status == 200 - retries: "{{ wait_for_zowe_service_retries | int }}" - delay: "{{ wait_for_zowe_service_delay | int }}" - delegate_to: localhost - # hide log to avoid exposing zowe_test_user and zowe_test_password - no_log: True - -- name: Wait for being able to login to API Catalog - uri: - url: "https://{{ zowe_external_domain_name }}:{{zowe_apiml_gateway_port}}/api/v1/apicatalog/auth/login" - follow_redirects: none - method: POST - body_format: json - body: - username: "{{ zowe_test_user }}" - password: "{{ zowe_test_password }}" - validate_certs: false - status_code: - - 200 - - 204 - register: _result - until: _result.status == 204 - retries: "{{ wait_for_zowe_service_retries | int }}" - delay: "{{ wait_for_zowe_service_delay | int }}" - delegate_to: localhost - # hide log to avoid exposing zowe_test_user and zowe_test_password - no_log: True diff --git a/playbooks/roles/ext/defaults/main.yml b/playbooks/roles/ext/defaults/main.yml index c501fe7afa..6b357d13a7 100644 --- a/playbooks/roles/ext/defaults/main.yml +++ b/playbooks/roles/ext/defaults/main.yml @@ -12,4 +12,5 @@ zos_uss_user_profile: ~/.profile zowe_root_dir: ~/zowe zowe_instance_dir: ~/.zowe/instance zowe_extension_dir: ~/zowe/extensions -zowe_logs_dir: ~/.zowe/logs +# install logs directory +zowe_install_logs_dir: ~/.zowe/logs diff --git a/playbooks/roles/ext/tasks/main.yml b/playbooks/roles/ext/tasks/main.yml index ef526d9e80..f6f46a17f3 100644 --- a/playbooks/roles/ext/tasks/main.yml +++ b/playbooks/roles/ext/tasks/main.yml @@ -11,7 +11,7 @@ - zowe_root_dir - zowe_instance_dir - zowe_extension_dir - - zowe_logs_dir + - zowe_install_logs_dir # ============================================================================ # Download Extension @@ -28,14 +28,14 @@ vars: script_chdir: "{{ zowe_root_dir }}/bin" script_filename: ./zowe-install-component.sh - script_parameters: "-d \"{{ zowe_extension_dir }}\" -i \"{{ zowe_instance_dir }}\" -o \"{{ work_dir_remote }}/{{ zowe_extension_filename }}\" -l \"{{ zowe_logs_dir }}\"" + script_parameters: "-d \"{{ zowe_extension_dir }}\" -i \"{{ zowe_instance_dir }}\" -o \"{{ work_dir_remote }}/{{ zowe_extension_filename }}\" -l \"{{ zowe_install_logs_dir }}\"" # ============================================================================ # Display logs - name: List log dir - raw: ls -l "{{ zowe_logs_dir}}" + raw: ls -l "{{ zowe_install_logs_dir}}" ignore_errors: True - name: Show installation log - raw: find {{ zowe_logs_dir}} -name "zowe-install-component*.log" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' - ignore_errors: True \ No newline at end of file + raw: find {{ zowe_install_logs_dir}} -name "zowe-install-component*.log" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' + ignore_errors: True diff --git a/playbooks/roles/fmid/defaults/main.yml b/playbooks/roles/fmid/defaults/main.yml index c7180d56ba..0ba0f6f32b 100644 --- a/playbooks/roles/fmid/defaults/main.yml +++ b/playbooks/roles/fmid/defaults/main.yml @@ -8,6 +8,7 @@ work_dir_local: .tmp # this should list all FMIDs we ever setup during install zowe_smpe_knwon_fmids: - AZWE001 +- AZWE002 # default install path for SMP/e zowe_smpe_default_path: usr/lpp/zowe @@ -23,9 +24,9 @@ zowe_build_smpe_fmid_pattern_readme: AZWE*.readme.txt # ============================================================================== # optional, this is the folder where we pre-upload all Zowe FMIDs on the z/OS server # example content of this folder should be: -# - AZWE001.htm -# - AZWE001.pax.Z -# - AZWE001.readme.txt +# - AZWE002.htm +# - AZWE002.pax.Z +# - AZWE002.readme.txt zowe_fmids_dir_remote: # HLQ of SMPE # during uninstallation, any data-sets start with {zowe_smpe_hlq_dsn}.ZOWE.{fmid} will be removed diff --git a/playbooks/roles/fmid/tasks/purge_job_outputs.yml b/playbooks/roles/fmid/tasks/purge_job_outputs.yml new file mode 100644 index 0000000000..c0b254bf5b --- /dev/null +++ b/playbooks/roles/fmid/tasks/purge_job_outputs.yml @@ -0,0 +1,24 @@ +--- +# This task will purge all Zowe SMPE job output + +# ============================================================================ +# Purge SMPE jobs +- name: Purge SMPE job logs + include_role: + name: zos + tasks_from: purge_all_job_outputs + vars: + purge_jobs_name: "{{ job_name_to_purge }}" + loop: + - ZWE0GUNZ + loop_control: + loop_var: job_name_to_purge +- name: Purge SMPE job logs + include_role: + name: zos + tasks_from: purge_all_job_outputs + vars: + purge_jobs_name: "{{ job_name_to_purge }}" + loop: "{{ zowe_smpe_fmid_install_steps }}" + loop_control: + loop_var: job_name_to_purge diff --git a/playbooks/roles/fmid/tasks/show_logs.yml b/playbooks/roles/fmid/tasks/show_logs.yml new file mode 100644 index 0000000000..13ea98a41b --- /dev/null +++ b/playbooks/roles/fmid/tasks/show_logs.yml @@ -0,0 +1,22 @@ +--- +# Show SMPE related Job Logs + +# ============================================================================ +# Show SMPE job logs +- include_role: + name: zos + tasks_from: show_all_job_logs + vars: + show_jobs_name: "{{ job_name_to_show }}" + loop: + - ZWE0GUNZ + loop_control: + loop_var: job_name_to_show +- include_role: + name: zos + tasks_from: show_all_job_logs + vars: + show_jobs_name: "{{ job_name_to_show }}" + loop: "{{ zowe_smpe_fmid_install_steps }}" + loop_control: + loop_var: job_name_to_show diff --git a/playbooks/roles/fmid/tasks/uninstall.yml b/playbooks/roles/fmid/tasks/uninstall.yml index 0360b53480..0d7d5dfe81 100644 --- a/playbooks/roles/fmid/tasks/uninstall.yml +++ b/playbooks/roles/fmid/tasks/uninstall.yml @@ -11,6 +11,13 @@ - zowe_smpe_hlq_tzone - zowe_smpe_hlq_dzone +# ============================================================================ +# Clean up history SMPE job output +- import_role: + name: fmid + tasks_from: purge_job_outputs + when: cleanup_zowe_job_history + # ============================================================================ - name: Remove SMPE installation folders raw: echo rm -fr {{ item }} | su diff --git a/playbooks/roles/fmid/templates/install-SMPE-PAX.sh.j2 b/playbooks/roles/fmid/templates/install-SMPE-PAX.sh.j2 index 74f9cf770a..6ec69aeb00 100644 --- a/playbooks/roles/fmid/templates/install-SMPE-PAX.sh.j2 +++ b/playbooks/roles/fmid/templates/install-SMPE-PAX.sh.j2 @@ -40,7 +40,7 @@ $SCRIPT Hlq Csihlq Thlq Dhlq Pathprefix download_path zfs_path FMID PREFIX volse b. For GIMUNZIP job: 6 download_path /tmp where PAX and README are located 7 zfs_path /tmp/zowe/smpe SMPDIR where GIMUNZIP unzips the PAX file - 8 FMID AZWE001 The FMID for this release (omitted in archid of SMPMCS?) + 8 FMID AZWE002 The FMID for this release (omitted in archid of SMPMCS?) 9 PREFIX ZOE RELFILE prefix? 10 volser B3PRD3 volume serial number of a DASD volume to hold MVS datasets @@ -219,7 +219,7 @@ fi # Extract the GIMUNZIP job step # sed -n '/\/\/GIMUNZIP /,$p' $download_path/$FMID.$README > gimunzip.jcl0 sed -n '/\/\/GIMUNZIP /,$p' $zfs_path/readme.EBCDIC.jcl > $zfs_path/gimunzip.jcl0 -# chmod a+r AZWE001.readme.EBCDIC.txt +# chmod a+r AZWE002.readme.EBCDIC.txt # Tailor the GIMUNZIP JCL # sed "\ diff --git a/playbooks/roles/kubernetes/README.md b/playbooks/roles/kubernetes/README.md new file mode 100644 index 0000000000..b78fa33cd1 --- /dev/null +++ b/playbooks/roles/kubernetes/README.md @@ -0,0 +1,160 @@ +# Zowe Container Installation: Ansible Kubernetes Testing + + +- [Zowe Container Installation: Ansible Kubernetes Testing](#zowe-container-installation-ansible-kubernetes-testing) + - [Introduction](#introduction) + - [Prerequisite](#prerequisite) + - [Environment Variables](#environment-variables) + - [More details about the environmental variables:](#more-details-about-the-environmental-variables) + - [Examples:](#examples) + +## Introduction + +This README covers the Zowe containers installation using Ansible Kubernetes Test. In this installation test, given the list of prerequisites in place, ansible first removes any Zowe containers deployed previous in the Kubernetes cluster and then it deploys all the Zowe containers to Kuberenetes cluster and wait till all of the pods become in Ready state. Since there are different Kubernetes platform, it is necessary to provide all the possible way to run the test using correct environment variables. To learn more about the Zowe container installation, please check [Installation Document](https://github.com/zowe/zowe-install-packaging/tree/master/containers/kubernetes). + + +## Prerequisite + +In order to run this test, make sure that you have the required software and environments. + +1. On the IBM Z – z/OS: + - Zowe installed on z/OS for users of ZSS and ZIS (default when you use the Zowe Application Framework app-server, the Zowe Desktop, or products that are based on them) + - z/OSMF installed on z/OS for users of it (default when you use gateway, API Mediation Layer, Web Explorers, or products that are based on them) + +2. Kubernetes Cluster - it could be installed/configured on BareMetal (zLinux/x86) or cloud (IBM Cloud Kubernetes, Google Cloud Kubernetes, OpenShift) +3. Test Running System: Ansible – with module Kubernetes.core and kwoodson.yedit installed. + ``` + Testing Environment Requirement: Ansible versions: >=2.9.17; Collection supports Python 3.6+. + + Ansible Required Module Installlation Steps: + 1. ansible-galaxy collection install kubernetes.core + 2. ansible-galaxy install kwoodson.yedit + 3. pip3 install openshift pyyaml kubernetes + + To check whether it is installed, run: ansible-galaxy collection list + ``` + +When running Kubernetes ansible test you’ll be required to provide essential environmental variable based on the platform (Kubernetes cluster) targeted. + +In the rest of the README, it will cover list of environmental variable and how to run the test for different platform. E.g. BareMetal (own Cluster with Kubernetes), IBM Cloud Kubernetes, OpenShift and etc. + +## Environment Variables + +Here is the list of environmental variables with example or default value: + + +|Environmental Variable | Default Value | Example Value | +|-----------------------|:-------------:|--------------------------------:| +|ansible_user | | | +|ansible_password | | | +|ansible_ssh_host | | | +|kubeconfig | | ~/.kube/config | +|k8s_context | | docker-desktop | +|zowe_instance_dir | | | +|work_dir_remote | | | +|k8s_storageclass | hostpath | | +|k8s_pv_name | | zowe-workspace-pv | +|k8s_pvc_labels | | “billingType”, “region”, “zone” | +|k8s_service | loadbalancer | | +|k8s_service_annot | | “ip-type”,”zone”,”vlan” | +|k8s_list_domain_ip | localhost | | +|k8s_networking | | ingress | +|k8s_gateway_domain | | *.nio.io | +|k8s_discovery_domain | | *.nio.io | + + +### More details about the environmental variables: + +**ansible_user**: z/OS host user name + +**ansible_password**: z/OS host password + +**ansible_ssh_host**: z/OS host IP address / domain + +**kubeconfig**: Path to an existing Kubernetes config file. If not provided, and no other connection options are provided, it loads the default configuration file from host's ~/.kube/config.json. + +**k8s_context**: The name of a context found in the kube config file. + +**zowe_instance_dir**: Location of the zowe instance directory. It's used to find `conver-for-k8.sh` script file, which runs to get configmap and secrets for z/OS system. + +**work_dir_remote**: Location of the working directory in z/OS. It's used to in `conver-for-k8.sh` script file to store config/secret files. + +**k8s_storageclass**: Zowe's PVC has a default StorageClass value (=hostpath) that may not apply to all Kubernetes clusters. Check and provide the storageClassName. You can use `kubectl get sc` to confirm which StorageClass you can use. + +**k8s_pv_name**: The name of the persistence volume name. If you provide PV name, it will be the main location to look for volume information. + +**k8s_pvc_labels**: Add information about the PVC using labels. For example, IBM Cloud requires additional information about pvc through labels. You can get the information from https://cloud.ibm.com/docs/containers?topic=containers-file_storage#file_qs and you can specify in host or group environment variables files, as following: + +``` +k8s_pvc_labels: + billingType: (For example, hourly.) + region: (Found in here: (https://cloud.ibm.com/kubernetes/clusters/"cluster-id"/overview?region=us-south&resourceGroup="resource-group-id")) + zone: (ou should be able to see this zone in your cluster home information page (using above url)) +``` + +**k8s_service**: Type of Service. Default is “loadbalancer”. Please use the below table to check which service you’ll need based on the Kubernetes provider. + +|Kubernetes provider | k8s_service | +|:-------------------|:-------------------------| +|docker-desktop | LoadBalancer | +|bare-metal | LoadBalancer or NodePort | +|cloud-vendors | LoadBalancer | +|OpenShift | LoadBalancer or NodePort | + +**k8s_service_annot**: Add information about the Service using Annotation. For example, IBM Cloud Kubernetes load-balancer's require additional information about service using Annotation. You can specify in host or group environment variables files, like the folllowing: +``` +k8s_service_annot: + service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type: ( You can get them using the following link - https://cloud.ibm.com/docs/containers?topic=containers-cs_network_planning#public_access and https://cloud.ibm.com/docs/containers?topic=containers-loadbalancer ) + service.kubernetes.io/ibm-load-balancer-cloud-provider-zone: (use `ibmcloud ks zone ls` to list zones) + service.kubernetes.io/ibm-load-balancer-cloud-provider-vlan: "vlan" (use `ibmcloud ks vlan ls --zone ` to list VLANs) +``` + +**k8s_list_domain_ip**: Used by the `convert_for_k8s` script, it is a comma-separated list of domains you will use to visit the Zowe Kubernetes cluster. These domains and IP addresses will be added to your new certificate if needed. The default value is localhost. + +**k8s_networking**: It gives the Services externally-reachable URLs and may provide other abilities such as traffic load balancing. Please use the table below to configure for your platoform. + +|Kubernetes provider | k8s_networking | +|:-------------------|:-----------------| +|bare-metal | Ingress | +|OpenShift | Route | + +**k8s_gateway_domain**: If you’re using k8s_networking, and if you have your own domain name for gatway service then please provided it here. i.e. k8s_gateway_domain: ”gateway.io” + +**k8s_discovery_domain**: If you’re using k8s_networking, and if you have your own domain name for discovery service then please provided it here. i.e. k8s_discovery_domain: ”discovery.io” + +## Examples: + +**Install Zowe containers on local Kubernetes service provisioned by Docker-Desktop:** +``` +ansible-playbook -l install-kubernetes.yml -e k8s_context=docker-desktop -e ansible_user= -e ansible_password= -e ansible_ssh_host= -e zowe_instance_dir= -e work_dir_remote= +``` +**Install Zowe containers on Kubernetes running on BareMetal:** +``` +ansible-playbook -l install-kubernetes.yml -e kubeconfig=/kubeconfig -e ansible_user= -e ansible_password= -e ansible_ssh_host= -e k8s_gateway_domain="*.nio.io" -e k8s_discovery_domain="*.nio.io" -e k8s_storageclass= -e k8s_service=nodeport -e k8s_list_domain_ip="1.2.3.4.nip.io,1.2.3.4" -e k8s_networking=ingress -e zowe_instance_dir= -e work_dir_remote= +``` +**Install Zowe containers on OpenShift:** +``` +ansible-playbook -l install-kubernetes.yml -e kubeconfig=/kubeconfig -e k8s_context= -e ansible_user= -e ansible_password= -e ansible_ssh_host= -e k8s_storageclass= -e k8s_list_domain_ip="1.2.3.4.gate.io,1.2.3.4.discover.io" -e k8s_networking=route -e zowe_instance_dir= -e k8s_gateway_domain="gate.io" -e k8s_discovery_domain="discover.io" -e work_dir_remote= +``` +**Install Zowe containers on IBM Cloud Kubernetes:** + +Must provide `k8s_service_annot` info. For example, you can setup up in host or group variable file: +``` +k8s_service_annot: + service.kubernetes.io/ibm-load-balancer-cloud-provider-ip-type: + service.kubernetes.io/ibm-load-balancer-cloud-provider-zone: + service.kubernetes.io/ibm-load-balancer-cloud-provider-vlan: +``` + +Must provide `k8s_pvc_labels` info. For example, you can setup up in host or group environment variable file: +``` +k8s_pvc_labels: + billingType: + region: + zone: +``` + +Run: +``` +ansible-playbook -l install-kubernetes.yml -e kubeconfig=/kubeconfig -e k8s_context= -e ansible_user= -e ansible_password= -e ansible_ssh_host= -e k8s_storageclass= -e k8s_list_domain_ip="1.2.3.4.nip.io,1.2.3.4" -e k8s_gateway_domain="*.nio.io" -e k8s_discovery_domain="*.nio.io" -e zowe_instance_dir= -e work_dir_remote= +``` diff --git a/playbooks/roles/kubernetes/defaults/main.yml b/playbooks/roles/kubernetes/defaults/main.yml new file mode 100644 index 0000000000..7ea8ddfee3 --- /dev/null +++ b/playbooks/roles/kubernetes/defaults/main.yml @@ -0,0 +1,51 @@ +--- +# ============================================================================== +# Constants +# ============================================================================== +# 120 * 10 seconds = 20 mins +wait_for_zowe_service_retries: 120 +# Every 10 seconds +wait_for_zowe_service_delay: 10 +# Timeout after 900sec = 15min for Zowe Pods to become ready status +timeout_for_pod_ready: 900 +# Every 60 seconds check if Zowe pods are ready status +wait_for_pod_ready: 60 + + +# ============================================================================== +# Variables should be verified and overwrittern. +# ============================================================================== +# default zowe runtime root directory +zowe_root_dir: ~/zowe +# default z/OSMF port. Optional, default value is ansible_ssh_host +zos_zosmf_host: +# default z/OSMF port +zos_zosmf_port: 10443 +zowe_zss_https: True +zowe_zss_port: 7557 +zowe_launch_components: zss + +zowe_zlux_terminal_telnet_port: 23 +# The security type of the tn3270 connection - valid values are blank('') for telnet, or 'tls' +zowe_zlux_terminal_telnet_security_type: + +# convert-for-k8s script for generating configmap and secrets in z/OS host for Kubernetes +# Please make sure to get the latest script, which has Silent option (-q), to avoid deployment failure. +# Default location is from marist. +convert_for_k8s: + +# Kubernetes environmental variables. +kubeconfig: +k8s_context: +k8s_storageclass: +k8s_pv_name: +#k8s_pvc_labels: +k8s_service: loadbalancer +#k8s_service_annot: +k8s_list_domain_ip: localhost +k8s_networking: +k8s_gateway_domain: +k8s_discovery_domain: + +#list of the apps required for zowe +k8s_required_apps: ["api-catalog", "app-server", "caching", "explorer-jes", "explorer-mvs", "explorer-uss", "discovery", "files-api", "gateway", "jobs-api"] diff --git a/playbooks/roles/kubernetes/meta/main.yml b/playbooks/roles/kubernetes/meta/main.yml new file mode 100644 index 0000000000..c100cb7b08 --- /dev/null +++ b/playbooks/roles/kubernetes/meta/main.yml @@ -0,0 +1,44 @@ +galaxy_info: + author: Zowe Committers + description: Install Zowe Container for Kubernetes + company: Zowe + + license: EPL-2.0 + + min_ansible_version: 2.9 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. + # Please make sure to install the following modules. + # - kubernetes.core + # - kwoodson.yedit \ No newline at end of file diff --git a/playbooks/roles/kubernetes/tasks/deploy-zowe-k8.yaml b/playbooks/roles/kubernetes/tasks/deploy-zowe-k8.yaml new file mode 100644 index 0000000000..bfdc0635b7 --- /dev/null +++ b/playbooks/roles/kubernetes/tasks/deploy-zowe-k8.yaml @@ -0,0 +1,259 @@ +--- + - name: Deploy Zowe namespace + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/common/zowe-ns.yaml + - name: Deploy Zowe ServiceAccount + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/common/zowe-sa.yaml + - name: Git checkout unmodified file + delegate_to: localhost + command: git checkout -- ../containers/kubernetes/samples/* + ignore_errors: True + - name: Edit workspace-pvc file to update storageclass name + delegate_to: localhost + yedit: + src: ../containers/kubernetes/samples/workspace-pvc.yaml + edits: + - key: spec.storageClassName + value: "{{ k8s_storageclass }}" + when: k8s_storageclass != none + - name: Edit workspace-pvc file to update pvc label + delegate_to: localhost + yedit: + src: ../containers/kubernetes/samples/workspace-pvc.yaml + separator: ',' + edits: + - key: metadata,labels,{{ item.key }} + value: + "{{ item.value }}" + loop: "{{ k8s_pvc_labels | default({}) | dict2items }}" + when: k8s_pvc_labels != none + - name: Edit workspace-pvc file to update pv name + delegate_to: localhost + when: k8s_pv_name != none + yedit: + src: ../containers/kubernetes/samples/workspace-pvc.yaml + edits: + - key: spec.storageClassName + value: "" + - key: spec.volumeName + value: "{{ k8s_pv_name }}" + - name: Deploy workspace-pvc manifest + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/workspace-pvc.yaml + +# - name: Run the convert-for-k8s script to gather ConfigMap & Secret from z/OS system for loadbalancer service. +# raw: >- +# {{ convert_for_k8s }} -q -x {{ k8s_list_domain_ip }} +# register: k8s_conf_secret +# when: k8s_service|lower == "loadbalancer" +# - name: Run the convert-for-k8s script to gather ConfigMap & Secret from z/OS system for nodeport service. +# raw: >- +# {{ convert_for_k8s }} -q -x {{ k8s_list_domain_ip }} -e 32554 +# register: k8s_conf_secret +# when: k8s_service|lower == "nodeport" +# - name: save the register config and secret to file +# delegate_to: localhost +# copy: +# content: "{{ k8s_conf_secret.stdout }}" +# dest: config_secret.yaml + - name: Verify if zowe_instance_dir variable is defined. + fail: msg="Please provide zowe_instance_dir; it's required for to run convert_for_k8s script" + when: zowe_instance_dir is none + - name: Run the convert-for-k8s script to gather ConfigMap & Secret from z/OS system for loadbalancer service. + raw: >- + {{ zowe_instance_dir }}/bin/utils/convert-for-k8s.sh -q -x {{ k8s_list_domain_ip }} > {{ work_dir_remote }}/config_secret.yaml + when: k8s_service|lower == "loadbalancer" and k8s_networking != "route" + - name: Run the convert-for-k8s script to gather ConfigMap & Secret from z/OS system for OpenShift. + raw: >- + {{ zowe_instance_dir }}/bin/utils/convert-for-k8s.sh -q -x {{ k8s_list_domain_ip }} -e 443 > {{ work_dir_remote }}/config_secret.yaml + when: k8s_service|lower == "loadbalancer" and k8s_networking == "route" + - name: Run the convert-for-k8s script to gather ConfigMap & Secret from z/OS system for nodeport service. + raw: >- + {{ zowe_instance_dir }}/bin/utils/convert-for-k8s.sh -q -x {{ k8s_list_domain_ip }} -e 32554 > {{ work_dir_remote }}/config_secret.yaml + when: k8s_service|lower == "nodeport" + - name: Copy the created ConfigMap & Secret to local system + delegate_to: localhost + raw: >- + sshpass -p "{{ ansible_password }}" scp "{{ ansible_user }}"@"{{ ansible_ssh_host }}":{{ work_dir_remote }}/config_secret.yaml . + - name: Remove the ConfigMap & Secret file from the z/OS system + raw: rm -f {{ work_dir_remote }}/config_secret.yaml + - name: Deploy the ConfigMaps and Secrets on Zowe K8s + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" +# resource_definition: "{{ k8s_conf_secret.stdout }}" + src: config_secret.yaml + state: present + - name: Deploy API Catalog Service on Zowe K8s + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/api-catalog-service.yaml + + - name: Edit discovery loadbalancer file to update annotations + delegate_to: localhost + yedit: + src: ../containers/kubernetes/samples/discovery-service-lb.yaml + separator: ',' + edits: + - key: metadata,annotations,{{ item.key }} + value: + "{{ item.value }}" + with_items: "{{ k8s_service_annot | default({}) | dict2items }}" + when: k8s_service_annot != none and k8s_service == "loadbalancer" + - name: Edit gateway loadbalancer file to update annotations + delegate_to: localhost + yedit: + src: ../containers/kubernetes/samples/gateway-service-lb.yaml + separator: ',' + edits: + - key: metadata,annotations,{{ item.key }} + value: + "{{ item.value }}" + with_items: "{{ k8s_service_annot | default({}) | dict2items }}" + when: k8s_service_annot != none and k8s_service == "loadbalancer" + + - name: Deploy Gateway Service on Zowe K8s using loadbalancer + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/gateway-service-lb.yaml + when: k8s_service|lower == "loadbalancer" + - name: Deploy Discovery Service on Zowe K8s using loadbalancer + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/discovery-service-lb.yaml + when: k8s_service|lower == "loadbalancer" + - name: Deploy Gateway Service on Zowe K8s uisng NodePort + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/gateway-service-np.yaml + when: k8s_service|lower == "nodeport" + - name: Deploy Discovery Service on Zowe K8s using NodePort + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/discovery-service-np.yaml + when: k8s_service|lower == "nodeport" + - name: Edit BareMetal Gateway Ingress file to update host info + delegate_to: localhost + yedit: + src: ../containers/kubernetes/samples/bare-metal/gateway-ingress.yaml + edits: + - key: spec.rules[0].host + value: '"{{ k8s_gateway_domain }}"' + when: k8s_networking|lower == "ingress" and k8s_gateway_domain != none + - name: Edit BareMetal Discovery Ingress file to update host info + delegate_to: localhost + yedit: + src: ../containers/kubernetes/samples/bare-metal/discovery-ingress.yaml + edits: + - key: spec.rules[0].host + value: '"{{ k8s_discovery_domain }}"' + when: k8s_networking|lower == "ingress" and k8s_discovery_domain != none + - name: Deploy Baremetal Gateway Ingress on Zowe K8s + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/bare-metal/gateway-ingress.yaml + when: k8s_networking|lower == "ingress" + - name: Deploy Baremetal Discovery Ingress on Zowe K8s + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/bare-metal/discovery-ingress.yaml + when: k8s_networking|lower == "ingress" + - name: Edit Openshift Gateway Route file to update host info + delegate_to: localhost + yedit: + src: ../containers/kubernetes/samples/openshift/gateway-route.yaml + edits: + - key: spec.host + value: '"{{ k8s_gateway_domain }}"' + when: k8s_networking|lower == "route" and k8s_gateway_domain != none + - name: Edit Openshift Discovery Route file to update host info + delegate_to: localhost + yedit: + src: ../containers/kubernetes/samples/openshift/discovery-route.yaml + edits: + - key: spec.host + value: '"{{ k8s_discovery_domain }}"' + when: k8s_networking|lower == "route" and k8s_discovery_domain != none + - name: Deploy Openshift Gateway Route on Zowe K8s + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/openshift/gateway-route.yaml + when: k8s_networking|lower == "route" + - name: Deploy Openshift Discovery Route on Zowe K8s + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: ../containers/kubernetes/samples/openshift/discovery-route.yaml + when: k8s_networking|lower == "route" + + - name: Find all the deployment files in the workloads instance-env + delegate_to: localhost + find: + paths: ../containers/kubernetes/workloads/instance-env/ + file_type: file + recurse: yes + register: k8s_manifests + - name: Deploy all the workload pods to Zowe K8s + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: present + src: "{{ item.path }}" + with_items: "{{ k8s_manifests.files }}" + - name: Wait till all the essential pods are in Ready status + delegate_to: localhost + kubernetes.core.k8s_info: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + kind: pod + namespace: zowe + label_selectors: + - app.kubernetes.io/component={{ item }} + wait: true + wait_sleep: "{{ wait_for_pod_ready }}" + wait_timeout: "{{ timeout_for_pod_ready }}" + wait_condition: + type: "Ready" + status: "True" + with_items: "{{ k8s_required_apps }}" diff --git a/playbooks/roles/kubernetes/tasks/main.yml b/playbooks/roles/kubernetes/tasks/main.yml new file mode 100644 index 0000000000..d5c295b029 --- /dev/null +++ b/playbooks/roles/kubernetes/tasks/main.yml @@ -0,0 +1,10 @@ +--- +## Remove existing Zowe Kubernetes +- import_role: + name: kubernetes + tasks_from: remove-zowe-k8 + +# Deploy Zowe to Kubernetes +- import_role: + name: kubernetes + tasks_from: deploy-zowe-k8 \ No newline at end of file diff --git a/playbooks/roles/kubernetes/tasks/remove-zowe-k8.yaml b/playbooks/roles/kubernetes/tasks/remove-zowe-k8.yaml new file mode 100644 index 0000000000..6502272cbe --- /dev/null +++ b/playbooks/roles/kubernetes/tasks/remove-zowe-k8.yaml @@ -0,0 +1,9 @@ +--- + - name: Remove Zowe completely from your Kubernetes Cluster + delegate_to: localhost + kubernetes.core.k8s: + kubeconfig: "{{ kubeconfig }}" + context: "{{ k8s_context }}" + state: absent + src: ../containers/kubernetes/common/zowe-ns.yaml + wait: true diff --git a/playbooks/roles/ptf/templates/install-SMPE-SYSMOD.sh.j2 b/playbooks/roles/ptf/templates/install-SMPE-SYSMOD.sh.j2 index e2368d6335..9748373a5e 100644 --- a/playbooks/roles/ptf/templates/install-SMPE-SYSMOD.sh.j2 +++ b/playbooks/roles/ptf/templates/install-SMPE-SYSMOD.sh.j2 @@ -13,9 +13,9 @@ # Requires opercmd.rexx to check job RC # Inputs -# -rw-r--r-- 1 OMVSKERN SYS1 302706000 Feb 11 08:37 ZOWE.AZWE001.TMP0001 -# -rw-r--r-- 1 OMVSKERN SYS1 7457 Feb 11 08:37 ZOWE.AZWE001.TMP0001.readme.htm -# -rw-r--r-- 1 OMVSKERN SYS1 182429840 Feb 11 08:37 ZOWE.AZWE001.TMP0002 +# -rw-r--r-- 1 OMVSKERN SYS1 302706000 Feb 11 08:37 ZOWE.AZWE002.TMP0001 +# -rw-r--r-- 1 OMVSKERN SYS1 7457 Feb 11 08:37 ZOWE.AZWE002.TMP0001.readme.htm +# -rw-r--r-- 1 OMVSKERN SYS1 182429840 Feb 11 08:37 ZOWE.AZWE002.TMP0002 # $download_path/ZOWE.$FMID.$SYSMOD1.readme.htm # ASCII text of README htm file # $download_path/ZOWE.$FMID.$SYSMOD1 # binary SMP/E SYSMOD file 1 of Zowe product @@ -45,7 +45,7 @@ fi # - #globalcsi ZOE.SMPE.CSI the data set name of your CSI # - #dzone DZONE name of distribution zone # - #tzone TZONE name of target zone -# - #fmid AZWE001 name of FMID +# - #fmid AZWE002 name of FMID # - #sysmod1 TMP0001 SYSMOD file 1 # - #sysmod2 TMP0002 SYSMOD file 2 @@ -65,7 +65,7 @@ $SCRIPT Hlq Csihlq download_path pathprefix FMID SYSMOD1 SYSMOD2 volser install 3 pathprefix /tmp/ Path Prefix of usr/lpp/zowe, where SMP/E will install zowe runtimes 4 download_path /tmp where SYSMODs (binary) and JCL (EBCDIC) are located - 5 FMID AZWE001 The FMID for base release + 5 FMID AZWE002 The FMID for base release 6 SYSMOD1 TMP0001 The name of the first part of the SYSMOD 7 SYSMOD2 TMP0002 The name of the second part of the SYSMOD 8 volser USER10 volume serial number of a DASD volume to hold MVS datasets @@ -302,7 +302,7 @@ do # - #globalcsi ZOE.SMPE.CSI the data set name of your CSI # - #dzone DZONE name of distribution zone # - #tzone TZONE name of target zone -# - #fmid AZWE001 name of FMID +# - #fmid AZWE002 name of FMID # - #sysmod1 TMP0001 SYSMOD file 1 # - #sysmod2 TMP0002 SYSMOD file 2 diff --git a/playbooks/roles/start/defaults/main.yml b/playbooks/roles/start/defaults/main.yml index cd1b5fb532..740605e00a 100644 --- a/playbooks/roles/start/defaults/main.yml +++ b/playbooks/roles/start/defaults/main.yml @@ -2,12 +2,10 @@ # ============================================================================== # Constants # ============================================================================== -# 60 * 10 seconds = 10 mins -wait_for_zowe_service_retries: 60 +# 120 * 10 seconds = 20 mins +wait_for_zowe_service_retries: 120 # Every 10 seconds wait_for_zowe_service_delay: 10 -# If we clean up history job output befor starting new -cleanup_zowe_job_history: True # ============================================================================== # Variables should be verified and overwrittern. diff --git a/playbooks/roles/start/tasks/main.yml b/playbooks/roles/start/tasks/main.yml index a18e872a86..f5ae7bcde9 100644 --- a/playbooks/roles/start/tasks/main.yml +++ b/playbooks/roles/start/tasks/main.yml @@ -1,12 +1,5 @@ --- -# ============================================================================ -# Clean up history job output -- import_role: - name: configure - tasks_from: purge_job_outputs - when: cleanup_zowe_job_history - # ============================================================================ - import_role: name: configure @@ -16,24 +9,20 @@ msg: Cannot find cross memory server when: zowe_xmem_stc_name == "" -- import_role: - name: configure - tasks_from: locate_zowe_start -- name: Check if zowe_start_path has a value - fail: - msg: Cannot find zowe-start.sh - when: zowe_start_path == "" - # ============================================================================ - name: Start Cross Memory Server - import_role: + include_role: name: zos tasks_from: opercmd vars: opercmd: "S {{ zowe_xmem_stc_name }},REUSASID=YES" - name: Start Zowe - raw: "{{ zowe_start_path }}" + include_role: + name: zos + tasks_from: run_zwe + vars: + parameters: "start" # ============================================================================ # Wait for services started diff --git a/playbooks/roles/start/tasks/wait_for_zowe.yml b/playbooks/roles/start/tasks/wait_for_zowe.yml index 0e43bf6cbc..9d24092d02 100644 --- a/playbooks/roles/start/tasks/wait_for_zowe.yml +++ b/playbooks/roles/start/tasks/wait_for_zowe.yml @@ -44,23 +44,11 @@ # ============================================================================ # Wait for Zowe services be started -# - name: Wait for ZSS at {{zowe_zos_host}} port {{ zowe_zss_port }} to be available -# uri: -# url: "{{ zowe_zss_https | ternary('https', 'http') }}://{{ zowe_zos_host }}:{{ zowe_zss_port }}/plugins" -# follow_redirects: none -# method: GET -# validate_certs: false -# register: _result -# until: _result.status == 200 -# retries: "{{ wait_for_zowe_service_retries | int }}" -# delay: "{{ wait_for_zowe_service_delay | int }}" -# when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "zss" in zowe_launch_components) -# delegate_to: localhost -- name: Wait for Desktop at {{zowe_zos_host}} port {{ zowe_zlux_port }} to be available +- name: Wait for APIML port {{ zowe_apiml_gateway_port }} to be available uri: - url: "https://{{ zowe_zos_host }}:{{ zowe_zlux_port }}" - follow_redirects: all + url: "https://{{ zowe_zos_host }}:{{ zowe_apiml_gateway_port }}" + follow_redirects: none method: GET validate_certs: false register: _result @@ -69,12 +57,36 @@ delay: "{{ wait_for_zowe_service_delay | int }}" # if zowe_zos_host and zowe_external_domain_name are not same, zlux could be # started off z/OS and then we couldn't test right now - when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "app-server" in zowe_launch_components) + when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "gateway" in zowe_launch_components) + delegate_to: localhost + +- name: Wait for being able to login to API Catalog + uri: + url: "https://{{ zowe_zos_host }}:{{ zowe_apiml_gateway_port }}/apicatalog/api/v1/auth/login" + follow_redirects: none + method: POST + body_format: json + body: + username: "{{ zowe_test_user }}" + password: "{{ zowe_test_password }}" + validate_certs: false + status_code: + - 200 + - 204 + register: _result + until: _result.status == 204 + retries: "{{ wait_for_zowe_service_retries | int }}" + delay: "{{ wait_for_zowe_service_delay | int }}" + # if zowe_zos_host and zowe_external_domain_name are not same, zlux could be + # started off z/OS and then we couldn't test right now + when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "api-catalog" in zowe_launch_components) delegate_to: localhost + # hide log to avoid exposing zowe_test_user and zowe_test_password + no_log: True - name: Wait for Jobs API port {{ zowe_jobs_api_port }} to be available uri: - url: "https://{{ zowe_zos_host }}:{{ zowe_jobs_api_port }}/api/v1/jobs?prefix=ZWE*&status=ACTIVE" + url: "https://{{ zowe_zos_host }}:{{ zowe_jobs_api_port }}/jobs/api/v1?prefix=ZWE*&status=ACTIVE" url_password: "{{ zowe_test_password }}" url_username: "{{ zowe_test_user }}" follow_redirects: none @@ -86,15 +98,15 @@ delay: "{{ wait_for_zowe_service_delay | int }}" # if zowe_zos_host and zowe_external_domain_name are not same, zlux could be # started off z/OS and then we couldn't test right now - when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "jobs-api" in zowe_launch_components) + when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is not none and "jobs-api" in zowe_launch_components) delegate_to: localhost # hide log to avoid exposing zowe_test_user and zowe_test_password no_log: True -- name: Wait for APIML port {{ zowe_apiml_gateway_port }} to be available +- name: Wait for Desktop at {{zowe_zos_host}} port {{ zowe_zlux_port }} to be available uri: - url: "https://{{ zowe_zos_host }}:{{ zowe_apiml_gateway_port }}" - follow_redirects: none + url: "https://{{ zowe_zos_host }}:{{ zowe_zlux_port }}" + follow_redirects: all method: GET validate_certs: false register: _result @@ -103,12 +115,12 @@ delay: "{{ wait_for_zowe_service_delay | int }}" # if zowe_zos_host and zowe_external_domain_name are not same, zlux could be # started off z/OS and then we couldn't test right now - when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "gateway" in zowe_launch_components) + when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "app-server" in zowe_launch_components) delegate_to: localhost -- name: Wait for being able to login to API Catalog +- name: Wait for being able to login to zLux uri: - url: "https://{{ zowe_zos_host }}:{{ zowe_apiml_gateway_port }}/api/v1/apicatalog/auth/login" + url: "https://{{ zowe_zos_host }}:{{ zowe_zlux_port }}/auth" follow_redirects: none method: POST body_format: json @@ -120,12 +132,12 @@ - 200 - 204 register: _result - until: _result.status == 204 + until: _result.status == 200 retries: "{{ wait_for_zowe_service_retries | int }}" delay: "{{ wait_for_zowe_service_delay | int }}" # if zowe_zos_host and zowe_external_domain_name are not same, zlux could be # started off z/OS and then we couldn't test right now - when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "api-catalog" in zowe_launch_components) + when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "app-server" in zowe_launch_components) delegate_to: localhost # hide log to avoid exposing zowe_test_user and zowe_test_password no_log: True @@ -151,41 +163,15 @@ # # hide log to avoid exposing zowe_test_user and zowe_test_password # no_log: True -- name: Wait for being able to login to zLux - uri: - url: "https://{{ zowe_zos_host }}:{{ zowe_zlux_port }}/auth" - follow_redirects: none - method: POST - body_format: json - body: - username: "{{ zowe_test_user }}" - password: "{{ zowe_test_password }}" - validate_certs: false - status_code: - - 200 - - 204 - register: _result - until: _result.status == 200 - retries: "{{ wait_for_zowe_service_retries | int }}" - delay: "{{ wait_for_zowe_service_delay | int }}" - # if zowe_zos_host and zowe_external_domain_name are not same, zlux could be - # started off z/OS and then we couldn't test right now - when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "app-server" in zowe_launch_components) - delegate_to: localhost - # hide log to avoid exposing zowe_test_user and zowe_test_password - no_log: True - -# This check will be added back later - -#- name: Wait for APIML Caching service to be available -# uri: -# url: "https://{{ zowe_external_domain_name }}:{{ zowe_caching_service_port }}/cachingservice/v2/api-docs" -# follow_redirects: none -# method: GET -# validate_certs: false -# register: _result -# until: _result.status == 200 -# retries: "{{ wait_for_zowe_service_retries | int }}" -# delay: "{{ wait_for_zowe_service_delay | int }}" -# delegate_to: localhost -# when: zowe_apiml_caching_service_start +# - name: Wait for ZSS at {{zowe_zos_host}} port {{ zowe_zss_port }} to be available +# uri: +# url: "{{ zowe_zss_https | ternary('https', 'http') }}://{{ zowe_zos_host }}:{{ zowe_zss_port }}/plugins" +# follow_redirects: none +# method: GET +# validate_certs: false +# register: _result +# until: _result.status == 200 +# retries: "{{ wait_for_zowe_service_retries | int }}" +# delay: "{{ wait_for_zowe_service_delay | int }}" +# when: zowe_zos_host == zowe_external_domain_name and (zowe_launch_components is none or zowe_launch_components == "" or "zss" in zowe_launch_components) +# delegate_to: localhost diff --git a/playbooks/roles/stop/tasks/main.yml b/playbooks/roles/stop/tasks/main.yml index f37f96bde6..6db4c8d6cb 100644 --- a/playbooks/roles/stop/tasks/main.yml +++ b/playbooks/roles/stop/tasks/main.yml @@ -4,44 +4,47 @@ name: configure tasks_from: locate_xmem -- import_role: - name: configure - tasks_from: locate_zowe_stop - # ============================================================================ - name: Stop Cross Memory Server when: zowe_xmem_stc_name != "" - import_role: + include_role: name: zos tasks_from: opercmd vars: opercmd: "P {{ zowe_xmem_stc_name }}" - name: Stop Zowe - when: zowe_stop_path != "" - raw: "{{ zowe_stop_path }}" + block: + - include_role: + name: zos + tasks_from: run_zwe + vars: + parameters: "stop" + ignore_errors: True - name: Stop other known Zowe Cross Memory Server - include_role: - name: zos - tasks_from: opercmd - vars: - opercmd: P {{ item }} - loop: "{{ zowe_known_xmem_jobnames }}" + block: + - include_role: + name: zos + tasks_from: opercmd + vars: + opercmd: P {{ item }} + loop: "{{ zowe_known_xmem_jobnames }}" ignore_errors: True - name: Stopping other known Zowe jobs - include_role: - name: zos - tasks_from: opercmd - vars: - opercmd: C {{ item }} - loop: "{{ zowe_known_jobnames }}" + block: + - include_role: + name: zos + tasks_from: opercmd + vars: + opercmd: P {{ item }} + loop: "{{ zowe_known_jobnames }}" ignore_errors: True - name: Wait for Zowe stopping pause: - seconds: 10 + seconds: 30 - name: Cancelling all address spaces left behind if there are raw: cd "{{ work_dir_remote }}" && ./kill-zombies.sh {{ zowe_runtime_user }} diff --git a/playbooks/roles/verify/defaults/main.yml b/playbooks/roles/verify/defaults/main.yml index ab7d805f37..689c6e3b56 100644 --- a/playbooks/roles/verify/defaults/main.yml +++ b/playbooks/roles/verify/defaults/main.yml @@ -24,7 +24,7 @@ zowe_root_dir: ~/zowe zowe_instance_dir: ~/.zowe/instance # zowe job prefix. zowe_job_prefix: ZWE -zowe_proclib_membername: ZWESVSTC +zowe_proclib_membername: ZWESLSTC zowe_instance_id: 1 # ports will be tested zowe_apiml_gateway_port: 7554 diff --git a/playbooks/roles/zos/defaults/main.yml b/playbooks/roles/zos/defaults/main.yml index 25042540fe..1574b01395 100644 --- a/playbooks/roles/zos/defaults/main.yml +++ b/playbooks/roles/zos/defaults/main.yml @@ -6,8 +6,15 @@ work_dir_remote: # default uss shell profile name zos_uss_user_profile: ~/.profile +# default zowe runtime root directory +zowe_root_dir: ~/zowe +# instanceDir +zowe_instance_dir: ~/.zowe/instance # to check job status, how many retries we do before exit with timeout job_wait_for_retries: 60 # how many seconds delay we wait before next check of job status job_wait_for_delay: 5 + +# zwe command verbose level +zwe_command_verbose_level: "-vv" diff --git a/playbooks/roles/zos/files/show_job_log.rexx b/playbooks/roles/zos/files/show_job_log.rexx index 39f0ab9a3b..e3968bef4f 100644 --- a/playbooks/roles/zos/files/show_job_log.rexx +++ b/playbooks/roles/zos/files/show_job_log.rexx @@ -47,49 +47,21 @@ do ix=1 to JNAME.0 Say 'Return Code :' RETCODE.ix Say '' - /*****************************************/ - /* Issue the ? (JDS) action against the */ - /* row to list the data sets in the job. */ - /******************************************/ - Address SDSF "ISFACT ST TOKEN('"TOKEN.ix"') PARM(NP ?)" , - "( prefix jds_" - if rc<>0 then - exit 20 - - /**********************************************/ - /* Find the JESMSGLG data set and read it */ - /* using ISFBROWSE. Use isflinelim to limit */ - /* the number of REXX variables returned. */ - /**********************************************/ - isflinelim=500 - do jx=1 to jds_DDNAME.0 - - Say '-------------------------------' jds_STEPN.jx':'jds_DDNAME.jx '-------------------------------' - Say '' - - /*****************************************************/ - /* Read the records from the data set. */ - /*****************************************************/ - total_lines = 0 - do until isfnextlinetoken='' - - Address SDSF "ISFBROWSE ST TOKEN('"jds_TOKEN.jx"')" - - do kx=1 to isfline.0 - Say isfline.kx - end - - total_lines = total_lines + isfline.0 - /*****************************/ - /* Set start for next browse */ - /*****************************/ - isfstartlinetoken = isfnextlinetoken - - end - - Say '' - + /* On z/OS v2.5, this line sometimes failed to establish TSO session */ + /* Address SDSF "ISFACT ST TOKEN('"TOKEN.ix"') PARM(NP ?)" */ + /* Possible error message is: */ + /* IRX0250E System abend code 0C4, reason code 00000017. */ + /* IRX0255E Abend in host command ISFACT or address environment routine SDSF. */ + /* 54 *-* Address SDSF "ISFACT ST TOKEN('"TOKEN.ix"') PARM(NP ?)" , "( prefix jds_" */ + /* +++ RC(-196) +++ */ + /* rc= -196 */ + /* Temporary fix is removing call of ISFACT */ + Address SDSF "ISFBROWSE ST TOKEN('"TOKEN.ix"')" + do kx=1 to isfline.0 + Say isfline.kx end + + Say '' end Say '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<' diff --git a/playbooks/roles/zos/files/show_job_log_with_ddname.rexx b/playbooks/roles/zos/files/show_job_log_with_ddname.rexx new file mode 100644 index 0000000000..39f0ab9a3b --- /dev/null +++ b/playbooks/roles/zos/files/show_job_log_with_ddname.rexx @@ -0,0 +1,99 @@ +/* REXX */ + +/* Usage: show_job_log.rexx "jobid=JOB12345 owner=* jobname=*" */ +arg options +parse var options param +upper param +parse var param 'JOBID=' jobid ' OWNER=' owner ' JOBNAME=' jobname + +Say '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>' +Say 'List jobs (Job ID: 'jobid', Owner: 'owner', Job Name: 'jobname')' +Say '' + +rc=isfcalls('ON') + +/* Update ST parameter based on parameters */ +jobid = strip(jobid,'L') +if (jobid <> '') then + do + ISFFILTER='JobID EQ ' jobid + end +owner = strip(owner,'L') +if (owner <> '') then + do + ISFOWNER=owner + end +jobname = strip(jobname,'L') +if (jobname <> '') then + do + ISFPREFIX=jobname + end + +/* Call SDSF ST */ +Address SDSF "ISFEXEC ST (ALTERNATE DELAYED)" +if rc<>0 then + exit 20 + +/*********************/ +/* Loop for all jobs */ +/*********************/ +do ix=1 to JNAME.0 + Say '============================================================================' + Say 'Job ID :' JOBID.ix + Say 'Job Name :' JNAME.ix + Say 'Job Type :' JTYPE.ix + Say 'Job Class :' JCLASS.ix + Say 'Owner :' OWNERID.ix + Say 'Return Code :' RETCODE.ix + Say '' + + /*****************************************/ + /* Issue the ? (JDS) action against the */ + /* row to list the data sets in the job. */ + /******************************************/ + Address SDSF "ISFACT ST TOKEN('"TOKEN.ix"') PARM(NP ?)" , + "( prefix jds_" + if rc<>0 then + exit 20 + + /**********************************************/ + /* Find the JESMSGLG data set and read it */ + /* using ISFBROWSE. Use isflinelim to limit */ + /* the number of REXX variables returned. */ + /**********************************************/ + isflinelim=500 + do jx=1 to jds_DDNAME.0 + + Say '-------------------------------' jds_STEPN.jx':'jds_DDNAME.jx '-------------------------------' + Say '' + + /*****************************************************/ + /* Read the records from the data set. */ + /*****************************************************/ + total_lines = 0 + do until isfnextlinetoken='' + + Address SDSF "ISFBROWSE ST TOKEN('"jds_TOKEN.jx"')" + + do kx=1 to isfline.0 + Say isfline.kx + end + + total_lines = total_lines + isfline.0 + /*****************************/ + /* Set start for next browse */ + /*****************************/ + isfstartlinetoken = isfnextlinetoken + + end + + Say '' + + end +end + +Say '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<' +Say '' + +rc=isfcalls('OFF') +exit 0 diff --git a/playbooks/roles/zos/tasks/delete_zowe_yaml.yml b/playbooks/roles/zos/tasks/delete_zowe_yaml.yml new file mode 100644 index 0000000000..14d662caf3 --- /dev/null +++ b/playbooks/roles/zos/tasks/delete_zowe_yaml.yml @@ -0,0 +1,21 @@ +# This playbook will run zwe command on the server + +# input: +# - configs: configurations list + +- name: Check if zowe_root_dir has a value + fail: + msg: zowe_root_dir is required + when: zowe_root_dir is not defined or zowe_root_dir is none or zowe_root_dir == '' + +- name: Update zowe.yaml configuration + raw: >- + touch {{ zos_uss_user_profile }} && \ + . {{ zos_uss_user_profile }} \ + {{ zowe_environment_variable_overrides | default('') }} && \ + test -f "{{ zowe_root_dir }}/bin/libs/index.sh" && \ + export ZWE_zowe_runtimeDirectory="{{ zowe_root_dir }}" && \ + . "{{ zowe_root_dir }}/bin/libs/index.sh" && \ + cd "{{ zowe_root_dir }}" && \ + delete_zowe_yaml "{{ zowe_instance_dir }}/zowe.yaml" "{{ item }}" + with_items: "{{ configs }}" diff --git a/playbooks/roles/zos/tasks/purge_all_job_outputs.yml b/playbooks/roles/zos/tasks/purge_all_job_outputs.yml new file mode 100644 index 0000000000..a39a39bd4e --- /dev/null +++ b/playbooks/roles/zos/tasks/purge_all_job_outputs.yml @@ -0,0 +1,18 @@ +--- +# This task will purge all jobs with same name + +# Input: +# - purge_jobs_name: job names like ZWESECUR + +- include_role: + name: zos + tasks_from: list_jobs + vars: + list_jobs_name: "{{ purge_jobs_name }}" + +- include_role: + name: zos + tasks_from: purge_job_output + vars: + purge_job_output_id: "{{ item }}" + loop: "{{ list_jobs_result.stdout_lines }}" diff --git a/playbooks/roles/zos/tasks/purge_job_output.yml b/playbooks/roles/zos/tasks/purge_job_output.yml index e1614fa19f..c41597a504 100644 --- a/playbooks/roles/zos/tasks/purge_job_output.yml +++ b/playbooks/roles/zos/tasks/purge_job_output.yml @@ -13,9 +13,10 @@ when: purge_job_output_id is not defined or purge_job_output_id is none or purge_job_output_id == '' - name: Purge log of {{ purge_job_output_id }} - include_role: - name: zos - tasks_from: opercmd - vars: - opercmd: $P O {{ purge_job_output_id.split(",")[0] }} + block: + - include_role: + name: zos + tasks_from: opercmd + vars: + opercmd: $P O {{ purge_job_output_id.split(",")[0] }} ignore_errors: True diff --git a/playbooks/roles/zos/tasks/run_zwe.yml b/playbooks/roles/zos/tasks/run_zwe.yml new file mode 100644 index 0000000000..ba592a6aa5 --- /dev/null +++ b/playbooks/roles/zos/tasks/run_zwe.yml @@ -0,0 +1,19 @@ +# This playbook will run zwe command on the server + +# input: +# - parameters: optional + +- name: Check if zowe_root_dir has a value + fail: + msg: zowe_root_dir is required + when: zowe_root_dir is not defined or zowe_root_dir is none or zowe_root_dir == '' + +- name: Run zwe command + raw: >- + touch {{ zos_uss_user_profile }} && \ + . {{ zos_uss_user_profile }} \ + {{ zowe_environment_variable_overrides | default('') }} && \ + export ZWE_zowe_runtimeDirectory="{{ zowe_root_dir }}" && \ + test -f "{{ zowe_root_dir }}/bin/zwe" && \ + cd "{{ zowe_root_dir }}/bin" && \ + ./zwe {{ parameters | default('') }} {{ zwe_command_verbose_level }} diff --git a/playbooks/roles/zos/tasks/show_all_job_logs.yml b/playbooks/roles/zos/tasks/show_all_job_logs.yml new file mode 100644 index 0000000000..641a007a00 --- /dev/null +++ b/playbooks/roles/zos/tasks/show_all_job_logs.yml @@ -0,0 +1,19 @@ +--- +# this playbook show logs of all jobs by pattern + +# input: +# - show_jobs_name: job name search pattern + +- include_role: + name: zos + tasks_from: list_jobs + vars: + list_jobs_name: "{{ show_jobs_name }}" +- include_role: + name: zos + tasks_from: show_job_log + vars: + show_job_log_id: '{{ item.split(",")[0] }}' + show_job_log_owner: "*" + show_job_log_name: "*" + loop: "{{ list_jobs_result.stdout_lines }}" diff --git a/playbooks/roles/zos/tasks/update_zowe_yaml.yml b/playbooks/roles/zos/tasks/update_zowe_yaml.yml new file mode 100644 index 0000000000..4a7fb91e29 --- /dev/null +++ b/playbooks/roles/zos/tasks/update_zowe_yaml.yml @@ -0,0 +1,21 @@ +# This playbook will run zwe command on the server + +# input: +# - configs: configurations dictionary (in key/value pairs) + +- name: Check if zowe_root_dir has a value + fail: + msg: zowe_root_dir is required + when: zowe_root_dir is not defined or zowe_root_dir is none or zowe_root_dir == '' + +- name: Update zowe.yaml configuration + raw: >- + touch {{ zos_uss_user_profile }} && \ + . {{ zos_uss_user_profile }} \ + {{ zowe_environment_variable_overrides | default('') }} && \ + test -f "{{ zowe_root_dir }}/bin/libs/index.sh" && \ + export ZWE_zowe_runtimeDirectory="{{ zowe_root_dir }}" && \ + . "{{ zowe_root_dir }}/bin/libs/index.sh" && \ + cd "{{ zowe_root_dir }}" && \ + update_zowe_yaml "{{ zowe_instance_dir }}/zowe.yaml" "{{ item }}" "{{ configs[item] | default('') }}" + with_items: "{{ configs.keys() | list }}" diff --git a/playbooks/roles/zowe/defaults/main.yml b/playbooks/roles/zowe/defaults/main.yml index d60e7f6ef5..cd81f7bca4 100644 --- a/playbooks/roles/zowe/defaults/main.yml +++ b/playbooks/roles/zowe/defaults/main.yml @@ -88,6 +88,9 @@ zowe_known_xmem_stc_users: # this profile is abandoned after v1.7.0 zowe_user_profile: ~/.zowe_profile +# If we clean up history job output during uninstall +cleanup_zowe_job_history: True + # ============================================================================== # Variables should be verified and overwrittern. # ============================================================================== @@ -101,7 +104,7 @@ zowe_dataset_prefix: zowe_instance_dir: ~/.zowe/instance # keystore directory zowe_keystore_dir: ~/.zowe/keystore -#logs directory +# install logs directory zowe_install_logs_dir: ~/.zowe/logs ################################################################################ @@ -109,6 +112,7 @@ zowe_install_logs_dir: ~/.zowe/logs zowe_xmem_proclib: zowe_xmem_parmlib: zowe_xmem_loadlib: +zowe_xmem_pluginlib: zowe_xmem_proclib_member_zss: ZWESISTC zowe_xmem_proclib_member_aux: ZWESASTC @@ -119,7 +123,6 @@ zowe_known_keyring_names: - ZoweKeyring zowe_known_keyring_personal_certificates: - ZoweCert -- jwtsecret - "API ML Client" - ZOWE - amlexca @@ -135,7 +138,6 @@ zowe_known_keyring_personal_digicerts: - ZOWECERT - ZOWEJWT - USER -- JWTSCRT - ZOWECC zowe_known_keyring_certauth_digicerts: - ZOWECA diff --git a/playbooks/roles/zowe/tasks/delete_sso_token.yml b/playbooks/roles/zowe/tasks/delete_sso_token.yml deleted file mode 100644 index 1e3a669495..0000000000 --- a/playbooks/roles/zowe/tasks/delete_sso_token.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -# this playbook runs SZWESAMP(ZWENOSSO) - -- name: Remove ZWENOSSO.jcl if exists - raw: >- - rm -f "{{ work_dir_remote }}/ZWENOSSO.jcl" - rm -f "{{ work_dir_remote }}/ZWENOSSO.raw.jcl" - -- name: Find if ZWENOSSO exists - raw: tsocmd listds "'{{ zowe_dataset_prefix }}.SZWESAMP'" members | grep ZWENOSSO - register: samplib_jcl_exists - ignore_errors: True - -- name: Execute ZWENOSSO jcl - when: samplib_jcl_exists.rc == 0 - block: - - name: Copy SZWESAMP(ZWENOSSO) to USS - raw: cp "//'{{ zowe_dataset_prefix }}.SZWESAMP(ZWENOSSO)'" "{{ work_dir_remote }}/ZWENOSSO.raw.jcl" - - - name: Update ZWENOSSO.jcl with configurations - raw: >- - cat "{{ work_dir_remote }}/ZWENOSSO.raw.jcl" | \ - sed -e "s%SET PRODUCT=RACF%SET PRODUCT={{ zos_security_system }}%" | \ - sed -e "s%SET JWTLABEL='jwtsecret'%SET JWTLABEL='{{ zowe_token_label }}'%" | \ - sed -e "s%SET SSOTOKEN=%SET SSOTOKEN='{{ zowe_token_name }}'%" \ - > "{{ work_dir_remote }}/ZWENOSSO.jcl" - - - name: Check ZWENOSSO.jcl changes - raw: >- - grep -e "^// *SET " \ - -e PRODUCT \ - -e JWTLABEL \ - -e SSOTOKEN \ - "{{ work_dir_remote }}/ZWENOSSO.jcl" - - - name: Run ZWENOSSO.jcl - import_role: - name: zos - tasks_from: run_jcl - vars: - jcl_filename: "{{ work_dir_remote }}/ZWENOSSO.jcl" diff --git a/playbooks/roles/zowe/tasks/main.yml b/playbooks/roles/zowe/tasks/main.yml index 2f15b5ff49..323db6d2d9 100644 --- a/playbooks/roles/zowe/tasks/main.yml +++ b/playbooks/roles/zowe/tasks/main.yml @@ -16,30 +16,34 @@ - name: Extract Zowe raw: >- - rm -fr "{{ work_dir_remote }}/extracted" && \ - mkdir -p "{{ work_dir_remote }}/extracted" && \ - cd "{{ work_dir_remote }}/extracted" && \ - pax -ppx -rf '{{ work_dir_remote }}/{{ zowe_build_file }}' + rm -fr "{{ zowe_root_dir }}" && \ + mkdir -p "{{ zowe_root_dir }}" && \ + cd "{{ zowe_root_dir }}" && \ + pax -ppx -rf '{{ work_dir_remote }}/{{ zowe_build_file }}' && \ + echo "Content of {{ zowe_root_dir }} after extracted" && \ + ls -laT -# after extracted, we should have a folder like "zowe-1.9.0" -- name: Check subfolder after Zowe build is extracted - raw: cd "{{ work_dir_remote }}/extracted" && ls -1 | tr -d '\n' - register: zowe_build_extracted_subfolder - failed_when: zowe_build_extracted_subfolder.stdout == "" +- name: Show Zowe manifest + raw: cat "{{ zowe_root_dir }}/manifest.json" -- name: Install Zowe - import_role: +- name: Initialize zowe.yaml + raw: >- + mkdir -p "{{ zowe_instance_dir }}" && \ + cp "{{ zowe_root_dir }}/example-zowe.yaml" "{{ zowe_instance_dir }}/zowe.yaml" + +- name: Update zowe.yaml zowe.setup.dataset.prefix + include_role: name: zos - tasks_from: run_script + tasks_from: update_zowe_yaml vars: - script_chdir: "{{ work_dir_remote }}/extracted/{{ zowe_build_extracted_subfolder.stdout }}/install" - script_filename: ./zowe-install.sh - script_parameters: "-i \"{{ zowe_root_dir }}\" -h \"{{ zowe_dataset_prefix }}\" -l \"{{ zowe_install_logs_dir }}\"" - -- name: List log dir - raw: ls -l "{{ zowe_install_logs_dir }}" - ignore_errors: True + configs: + # FIXME: we should only keep one set + "zowe.setup.dataset.prefix": "{{ zowe_dataset_prefix }}" + "zowe.setup.mvs.hlq": "{{ zowe_dataset_prefix }}" -- name: Show installation log - raw: find {{ zowe_install_logs_dir }} -name "zowe-install-*.log" -type f | xargs -i sh -c 'echo ">>>>>>>>>>>>>>>>>>>>>>>> {} >>>>>>>>>>>>>>>>>>>>>>>" && cat {}' - ignore_errors: True +- name: Install Zowe + include_role: + name: zos + tasks_from: run_zwe + vars: + parameters: "install -l \"{{ zowe_install_logs_dir }}\"" diff --git a/playbooks/roles/zowe/tasks/purge_job_outputs.yml b/playbooks/roles/zowe/tasks/purge_job_outputs.yml new file mode 100644 index 0000000000..f8ebf58894 --- /dev/null +++ b/playbooks/roles/zowe/tasks/purge_job_outputs.yml @@ -0,0 +1,52 @@ +--- +# This task will purge all Zowe job output + +# ============================================================================ +# Purge Zowe Job Output +- include_role: + name: zos + tasks_from: list_jobs + vars: + list_jobs_name: "{{ zowe_job_prefix }}{{ zowe_instance_id }}SV" + +- include_role: + name: zos + tasks_from: purge_job_output + vars: + purge_job_output_id: "{{ item }}" + loop: "{{ list_jobs_result.stdout_lines }}" + +# ============================================================================ +# Purge Cross Memory Job Output +- import_role: + name: configure + tasks_from: locate_xmem + +- include_role: + name: zos + tasks_from: list_jobs + when: zowe_xmem_stc_name != "" + vars: + list_jobs_name: "{{ zowe_xmem_stc_name }}" + +- include_role: + name: zos + tasks_from: purge_job_output + vars: + purge_job_output_id: "{{ item }}" + loop: "{{ list_jobs_result.stdout_lines }}" + +# ============================================================================ +# Purge jobs created by zwe init +- name: Purge other job logs + include_role: + name: zos + tasks_from: purge_all_job_outputs + vars: + purge_jobs_name: "{{ job_name_to_purge }}" + loop: + - ZWESECUR + - ZWEKRING + - ZWENOKYR + loop_control: + loop_var: job_name_to_purge diff --git a/playbooks/roles/zowe/tasks/uninstall.yml b/playbooks/roles/zowe/tasks/uninstall.yml index f9acdc4164..ea1576e4d0 100644 --- a/playbooks/roles/zowe/tasks/uninstall.yml +++ b/playbooks/roles/zowe/tasks/uninstall.yml @@ -13,7 +13,9 @@ - zowe_keystore_dir - zowe_install_logs_dir - zowe_dataset_prefix + - zowe_jcllib - zowe_xmem_loadlib + - zowe_xmem_pluginlib - zowe_xmem_parmlib - zowe_xmem_proclib_member_zss - zowe_xmem_proclib_member_aux @@ -33,6 +35,13 @@ include_role: name: stop +# ============================================================================ +# Clean up history job output +- import_role: + name: zowe + tasks_from: purge_job_outputs + when: cleanup_zowe_job_history + # ============================================================================ - import_role: name: zowe @@ -76,12 +85,7 @@ # ============================================================================ - import_role: name: zowe - tasks_from: uninstall_keyring - -# ============================================================================ -- import_role: - name: zowe - tasks_from: delete_sso_token + tasks_from: uninstall_keyring # ============================================================================ - name: Check APF settings of {{ zowe_xmem_loadlib }} @@ -103,6 +107,26 @@ - zowe_xmem_loadlib_volume.stdout != 'SMS' - zowe_xmem_loadlib_volume.stdout != '*SMS*' +# ============================================================================ +- name: Check APF settings of {{ zowe_xmem_pluginlib }} + raw: >- + '{{ work_dir_remote }}/opercmd.rexx' 'D PROG,APF,DSNAME={{ zowe_xmem_pluginlib }}' | grep '[0-9]\{1,\} \{1,\}[0-9a-zA-Z*]\{1,\} \{1,\}{{ zowe_xmem_pluginlib }}' | awk '{print $2}' | tr -d '\n' + register: zowe_xmem_pluginlib_volume + ignore_errors: true + +- name: Delete APF settings of {{ zowe_xmem_pluginlib }} for SMS volume + raw: >- + '{{ work_dir_remote }}/opercmd.rexx' 'SETPROG APF,DELETE,DSNAME={{ zowe_xmem_pluginlib }},SMS' + when: zowe_xmem_pluginlib_volume.stdout == 'SMS' or zowe_xmem_pluginlib_volume.stdout == '*SMS*' + +- name: Delete APF settings of {{ zowe_xmem_pluginlib }} for non-SMS volume + raw: >- + '{{ work_dir_remote }}/opercmd.rexx' 'SETPROG APF,DELETE,DSNAME={{ zowe_xmem_pluginlib }},VOLUME={{ zowe_xmem_pluginlib_volume.stdout }}' + when: + - zowe_xmem_pluginlib_volume.stdout != '' + - zowe_xmem_pluginlib_volume.stdout != 'SMS' + - zowe_xmem_pluginlib_volume.stdout != '*SMS*' + # ============================================================================ - name: Check APF settings of {{ zowe_dataset_prefix }}.SZWEAUTH raw: >- @@ -124,9 +148,9 @@ - zowe_dataset_authlib_volume.stdout != '*SMS*' # ============================================================================ -- name: Delete members of loadlib/parmlib data sets +- name: Delete members of jcllib/loadlib/parmlib data sets raw: (tsocmd listds "'{{ item[0] }}'" members | sed -e '1,/--MEMBERS--/d' | awk '{$1=$1};1' | grep '^{{ item[1] }}$') && echo "Deleting {{ item[0] }}({{ item[1] }}) ..." && tsocmd DELETE "'{{ item[0] }}({{ item[1] }})'" - loop: "{{ [zowe_xmem_loadlib, zowe_xmem_parmlib]|product([zowe_known_loadlib_members, zowe_known_parmlib_members]|flatten)|list }}" + loop: "{{ [zowe_jcllib, zowe_xmem_loadlib, zowe_xmem_pluginlib, zowe_xmem_parmlib]|product([zowe_known_loadlib_members, zowe_known_parmlib_members]|flatten)|list }}" ignore_errors: True # ============================================================================ @@ -146,4 +170,4 @@ # configure certificate log, added after v1.7.1 # these files should be organized into install_log - "~/zowe_certificate_setup_log" - - "~/zowe-*.log" \ No newline at end of file + - "~/zowe-*.log" diff --git a/playbooks/roles/zowe/tasks/uninstall_keyring_acf2.yml b/playbooks/roles/zowe/tasks/uninstall_keyring_acf2.yml index a16d81d6fc..cc4193f8d3 100644 --- a/playbooks/roles/zowe/tasks/uninstall_keyring_acf2.yml +++ b/playbooks/roles/zowe/tasks/uninstall_keyring_acf2.yml @@ -29,10 +29,6 @@ loop: "{{ zowe_known_tss_keyring_names }}" ignore_errors: True -- name: Add delete Zowe JWT secret ACF2 keyrings statement(s) to JCL - raw: echo " DELETE {{ zowe_runtime_user }}.{{ zowe_token_label}}" >> "{{ work_dir_remote }}/ACFNOKYR.jcl" - ignore_errors: True - - name: Add full cleanup statement(s) to JCL raw: echo " DELETE {{ zowe_runtime_user }}" >> "{{ work_dir_remote }}/ACFNOKYR.jcl" ignore_errors: True diff --git a/playbooks/roles/zowe/tasks/uninstall_keyring_racf.yml b/playbooks/roles/zowe/tasks/uninstall_keyring_racf.yml index 29d5816084..8773bb958e 100644 --- a/playbooks/roles/zowe/tasks/uninstall_keyring_racf.yml +++ b/playbooks/roles/zowe/tasks/uninstall_keyring_racf.yml @@ -2,14 +2,6 @@ # Delete racf Keyrings and certificates we've created # ============================================================================ -- name: Delete zowe token - raw: tsocmd "RACDCERT DELTOKEN({{ zowe_token_name }}) FORCE" - ignore_errors: True - -- name: List zowe token certificates - raw: tsocmd "RACDCERT LISTTOKEN({{ zowe_token_name }})" - ignore_errors: True - - name: Remove Zowe RACF personal certficates from keyrings raw: tsocmd "RACDCERT ID({{ zowe_runtime_user }}) REMOVE(LABEL('{{ item[0] }}') RING({{ item[1] }}))" loop: "{{ zowe_known_keyring_personal_certificates |product(zowe_known_keyring_names)|list }}" @@ -28,11 +20,7 @@ - name: Remove Zowe RACF personal certficates raw: tsocmd "RACDCERT ID({{ zowe_runtime_user }}) DELETE(LABEL('{{ item }}'))" loop: "{{ zowe_known_keyring_personal_certificates }}" - ignore_errors: True - -- name: Remove Zowe RACF JWT secret certficates - raw: tsocmd "RACDCERT ID({{ zowe_runtime_user }}) DELETE(LABEL('{{ zowe_token_label }}'))" - ignore_errors: True + ignore_errors: True - name: Remove Zowe RACF certauth certficates raw: tsocmd "RACDCERT CERTAUTH DELETE(LABEL('{{ item }}'))" diff --git a/playbooks/roles/zowe/tasks/uninstall_keyring_tss.yml b/playbooks/roles/zowe/tasks/uninstall_keyring_tss.yml index e072943af0..54aab394f0 100644 --- a/playbooks/roles/zowe/tasks/uninstall_keyring_tss.yml +++ b/playbooks/roles/zowe/tasks/uninstall_keyring_tss.yml @@ -7,10 +7,6 @@ loop: "{{ zowe_known_keyring_personal_digicerts }}" ignore_errors: True -- name: Remove Zowe TSS personal certficates - raw: tsocmd "TSS REM({{ zowe_runtime_user }}) DIGICERT({{ zowe_token_label }})" - ignore_errors: True - - name: Remove Zowe TSS certauth certficates raw: tsocmd "TSS REM(CERTAUTH) DIGICERT({{ item }})" loop: "{{ zowe_known_keyring_certauth_digicerts }}" @@ -21,10 +17,6 @@ loop: "{{ zowe_known_tss_keyring_names }}" ignore_errors: True -- name: Deleting Zowe TSS token - raw: tsocmd "TSS P11TOKEN TOKENDEL LABLCTKN({{ zowe_token_name }}) FORCE" - ignore_errors: True - - name: List keyrings's TSS certificates raw: tsocmd "TSS LIST({{ zowe_runtime_user }}) KEYRING({{ item }})" loop: "{{ zowe_known_tss_keyring_names }}" diff --git a/playbooks/show-logs.yml b/playbooks/show-logs.yml index 21e16622aa..8d39f5d9a6 100644 --- a/playbooks/show-logs.yml +++ b/playbooks/show-logs.yml @@ -18,10 +18,3 @@ - import_role: name: configure tasks_from: show_logs - - # ============================================================================ - # Show Zowe Docker Logs - - import_role: - name: docker - tasks_from: docker-logs - when: zowe_docker_image is defined and zowe_docker_image != '' \ No newline at end of file diff --git a/signing_keys/EB24BCF92E013D1B9A3B0768762FE6366129AD74.json b/signing_keys/EB24BCF92E013D1B9A3B0768762FE6366129AD74.json new file mode 100644 index 0000000000..90e35f4a43 --- /dev/null +++ b/signing_keys/EB24BCF92E013D1B9A3B0768762FE6366129AD74.json @@ -0,0 +1 @@ +{"key_location": "https://raw.githubusercontent.com/zowe/zowe-install-packaging/master/signing_keys/KEYS.tom","key_signer": "Tom Zhang (CODE SIGNING KEY) ","key_id": "762FE6366129AD74"} diff --git a/signing_keys/KEYS.tom b/signing_keys/KEYS.tom new file mode 100644 index 0000000000..6946aedada --- /dev/null +++ b/signing_keys/KEYS.tom @@ -0,0 +1,53 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Comment: Tom Zhang (CODE SIGNING KEY) + +mQINBGHwRZ0BEADAXff1jb/mwWi2WPKsWRGPvuwfYKuxQt24y5TCYICCIo8KPAfr +MVGEpTUIm4M9P6FDqkEOgllLzfMbmiCQ2DQ0IVWCqkzWKyDwIDENx4V4KlS3C2ws +cXKm73ifyoM4FL3u7RBgo021/wNTGtUtb2dtaIpgwG95n/SPyTCiumt5J0+IzY/S +v+wcddpkaWDfDS3DWSEEiXaIOhTFbv/ZzvzTR2aarfBZWr/CJ2EcsImZcifGYBQO +aU6ixgwrE788rOVAWdpH+TwTBxEak+iJ2RYPyGubo03hXbx8cQe9W78dW8fU3cKj +p0ZXMLo/36ai0b9xpTIJKjCw+ZpowOxI6XVDsxxoCVtSy02hzBVX+byoJdSW0NFF +AUATY1hmX5vrJs9f+t19Keuq2isNp05zMyl7Wit0ObtZrtNh+/d9nB0Uq+mhY+Iz +E2je4tA92+QVkrGDS4MRq4r/73rYWWujG2BceZv9cPIwRUEXnitc+1QJbkbq3ypF +HdzOk9r7zQsQjyT43XIDZ0bWzpypNlOi/FV7VJEdHXPY6yS3nGHjD8aYsKaL1c4Z +LluLTrB4p3geh0WOafk2/MLVrSJ3jzObm1Ff7Cvx6yCtxYiughxCsuu5p1GFQ3Qc +AxiNkY9Yb3S/5g0tegiR9joWNs4UR9mMoeSGx2DchmL/unZstVVBtcKCPQARAQAB +tDRUb20gWmhhbmcgKENPREUgU0lHTklORyBLRVkpIDx0b20ueWN6aGFuZ0BnbWFp +bC5jb20+iQJSBBMBCAA8FiEE6yS8+S4BPRuaOwdodi/mNmEprXQFAmHwRZ0CGwMF +CwkIBwIDIgIBBhUKCQgLAgQWAgMBAh4HAheAAAoJEHYv5jZhKa10yN4P/2HoLzTb +JtgVXQbL/DPbQVvbGDvu+FPp9z+5ovSwsYhmZQ7uT1fthIS9v1GsnbgLxXLdhkOH +e9zbaCTslRsku2TnpR76AI+Cz0QF7eJsu0L98VX41T+iOYhTlVj04SwcUoEm5JBY +HodTNA/bF7E4AtATnOaySfmI0ZAWIS+AaOUJp46cvs8zi44flCnZX2mbpmxe1zkJ +TWmwWtbNSz9wzMQq7sNeIs9cKrn/n3WSxcJ/bnK13FIExfzQawrUSlQSZaJFWvDg +RrT49byJRV02wOmo4V1R+n5K4nhUV949TPf5eC+kLdmj8pafaFzk8a26WkeWJ9NY +yeJtTp/+2IArSIawwmxhv01l34Zbrhj1fgaNP4gR6tDt4O1YvdTRr6OlLWYxAkKX +BNxbNAYY4sSXtB7L0BlnUNYeH76x102Jhv+aDQ3e9/FirZ9HpF8ZOwyUcf1C5aHS +rpkAaWmDxiYyLz66CInXSmat94zPn8T1cfYUEDJ/pz8RlCVdz4f55hYggY8tQW6D +a4KLO1BHfz8hmasQcbQNofmKZG+tOC8GEH2f0WQNUgsseGPdP1KmEAMsdO6yLC2w +IpRMlgeAKdVgYXenuGz0TURM9wA+IoDTNQKG7Q+28goa/AR6jRxL/DRSGwiiI3nk +jfHp0GpRuOpW69Si8m3U1bRA7ltWlUuQtXA/uQINBGHwRZ0BEAC2DhGqC9P2lLgD +IzdKS8dNvP1w3DyGRY5ODXXxCzXx6VK6eKjBzHuJRaPerkxpgatEh6a64Gga+mi6 +qg9ceayWKfj7Yw9qNvoNSM/jqGObBxBCMckhEf/xFZKfrd8Rpd1c5zzNRCdPcNvB +nSNBcdzAEsdHzPK/f5dNGIdZ2hlpWCt8pyFVtpb3ZFYIGVMPWTpkAj4Wm3Znd9vn +2WZOXL7vzWNEcOagVPg+iuY8Udthc8LKWCM0ANp1KdR/fiskt81wkF9/PbYt/XAC +dJCq/DFbjkZ9OHcJNr04hbYkxucQaG01SzQLGyoZ4LHmX3jCYP6VVXeG/nzHn/+N +O5l9uHuT4zmxby5W4qY/CTX/Di+kbI1hEQx7W4BhRFZWZAORpUQtCqNY3N6ieT/Z +UowoRmEZWmw8fjOS3e9VOeblD8oLtFtHpCGuyM62PnKQQKdyaPNBE1O9fCAMkhyC +rPfZkHTHluLCLDed6Y+VONQ1DazNO+rVDIBhCApZlhC20K9Bs1UKAssTaW45wMLZ +uf2USp8q+LyZGzcAj6hOTZjBmhBicxSqPRtTvsyQhhmYCie+4k3FzDXjn3eNAq84 +AnRaUM9QjA4GfZeEsbXco5A/Igmgf0GxeW69Bk7alEwGAH2CEtxGU8pB/VnhF4wH +AO5MwtcctSsKPmh++JjFmcA/onY7VwARAQABiQI2BBgBCAAgFiEE6yS8+S4BPRua +Owdodi/mNmEprXQFAmHwRZ0CGwwACgkQdi/mNmEprXQ96xAArQ+ptTXrrj3y6K16 +FeRalAGJk/yj7HMRDjPF5uWKrVgmFpOL7dAKYAEHU3M+H6KvRsyBlLd9TVyFr0tu +67A29heHT5DM9/sLO6fYGKkjzBw77i12J1+n+NVyeRSSUJQfRt17a2PBcbpuzyav +6upCzbUtY+F8GyGKQisQOsN6tAZ2LbuPUladldh8AfpmarvOOlwubdg4KalSq8F1 +3r+GzEI12LXvZqa09hkNAGYZlrsLwBCOmjlIk4E1YpzyantdYorIK+uYgHXVvDsY +HuNq+ZVRZz2GRPoQylqkqVfGtl8zYD36YYlY9Vzkknh6/1TN+oIAajGc9uT5WrgC +DzlEXOA0yD/gUxneOIdEoR/3+YPaepbQh8zlQiAhE9tLRUyxXU8rricxdCWLQzxU +q5wr5dZUV9sCnPItmrgPGbVoiw4Cz7Edpwh4Jb8RXNvM2lrYkzEx5AzTWcxLPoJl +ksMZdhf3/vYeigSvDs8wsAXQ/wbvWddoJULhprEwts0/eZYUF6AnwTKRIwN1AnIC +nvs6Ym2JwGQ/y0HJ415JQox++llQ6JVJX9lbHnYiIrVEysbssdPZe+LZPrzF7VsI +HC830+bOvJA4gP1luKaF1lv4X0JJTv0TpUrmCDj/l/2N4iT6Dd6d73DbHZQoJ1jc +0CICOK6o6yrfnHaYeBcaW3xcCeU= +=6Fnl +-----END PGP PUBLIC KEY BLOCK----- diff --git a/smpe/bld/SMPMCS.txt b/smpe/bld/SMPMCS.txt index 5086e548d3..530f870fc6 100755 --- a/smpe/bld/SMPMCS.txt +++ b/smpe/bld/SMPMCS.txt @@ -35,6 +35,7 @@ ++SAMP(ZWEKRING) SYSLIB(SZWESAMP) DISTLIB(AZWESAMP) RELFILE(2) . ++SAMP(ZWENOKYR) SYSLIB(SZWESAMP) DISTLIB(AZWESAMP) RELFILE(2) . ++SAMP(ZWENOSEC) SYSLIB(SZWESAMP) DISTLIB(AZWESAMP) RELFILE(2) . +++SAMP(ZWESECKG) SYSLIB(SZWESAMP) DISTLIB(AZWESAMP) RELFILE(2) . ++SAMP(ZWESECUR) SYSLIB(SZWESAMP) DISTLIB(AZWESAMP) RELFILE(2) . ++SAMP(ZWESIPRG) SYSLIB(SZWESAMP) DISTLIB(AZWESAMP) RELFILE(2) . ++SAMP(ZWESIP00) SYSLIB(SZWESAMP) DISTLIB(AZWESAMP) RELFILE(2) . diff --git a/smpe/bld/prepare-PSI.sh b/smpe/bld/prepare-PSI.sh deleted file mode 100644 index db152b2e11..0000000000 --- a/smpe/bld/prepare-PSI.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -#version=1.0 - - -function PSIcreation { - - echo "Called function to create PSI in our script." - - return 0 - } - -PSIcreation - - - diff --git a/smpe/bld/smpe-install.sh b/smpe/bld/smpe-install.sh index 3f6d14c66f..7f92e3c465 100755 --- a/smpe/bld/smpe-install.sh +++ b/smpe/bld/smpe-install.sh @@ -165,7 +165,7 @@ echo The extract $extract contains ls -l $extract opts="" -opts="$opts --hlq $mvsI" # target HLQ +opts="$opts --dataset-prefix $mvsI" # target HLQ opts="$opts -vv" # trace level debug info opts="$opts -l $log" # install log _cmd $extract/$zweScript install $opts stdout, caller can add >/dev/null to trash all fi # status=$? -###### -# FIXME: sometimes zlux-server-framework has strange error like this, ignore this error temporarily -# chown: FSUM6180 file "/ZOWE/tmp/zowe-packaging-20220219020827/zowe/extract/components/app-server/share/zlux-server-framework/node_modules/.bin/node-gyp-build": EDC5129I No such file or directory. (errno2=0x0594003D) -# chown: FSUM6180 file "/ZOWE/tmp/zowe-packaging-20220219020827/zowe/extract/components/app-server/share/zlux-server-framework/node_modules/.bin/node-gyp-build-optional": EDC5129I No such file or directory. (errno2=0x0594003D) -# chown: FSUM6180 file "/ZOWE/tmp/zowe-packaging-20220219020827/zowe/extract/components/app-server/share/zlux-server-framework/node_modules/.bin/node-gyp-build-test": EDC5129I No such file or directory. (errno2=0x0594003D) -###### -# if test $status -ne 0 -# then -# echo "** ERROR $me '$@' ended with status $sTaTuS" -# test ! "$IgNoRe_ErRoR" && exit 8 # EXIT -# fi # +if test $status -ne 0 +then + echo "** ERROR $me '$@' ended with status $sTaTuS" + test ! "$IgNoRe_ErRoR" && exit 8 # EXIT +fi # } # _super # --------------------------------------------------------------------- @@ -469,17 +463,11 @@ else # stderr -> stdout, caller can add >/dev/null to trash all fi # sTaTuS=$? -###### -# FIXME: sometimes zlux-server-framework has strange error like this, ignore this error temporarily -# chown: FSUM6180 file "/ZOWE/tmp/zowe-packaging-20220219020827/zowe/extract/components/app-server/share/zlux-server-framework/node_modules/.bin/node-gyp-build": EDC5129I No such file or directory. (errno2=0x0594003D) -# chown: FSUM6180 file "/ZOWE/tmp/zowe-packaging-20220219020827/zowe/extract/components/app-server/share/zlux-server-framework/node_modules/.bin/node-gyp-build-optional": EDC5129I No such file or directory. (errno2=0x0594003D) -# chown: FSUM6180 file "/ZOWE/tmp/zowe-packaging-20220219020827/zowe/extract/components/app-server/share/zlux-server-framework/node_modules/.bin/node-gyp-build-test": EDC5129I No such file or directory. (errno2=0x0594003D) -###### -# if test $sTaTuS -ne 0 -# then -# echo "** ERROR $me '$@' ended with status $sTaTuS" -# test ! "$IgNoRe_ErRoR" && exit 8 # EXIT -# fi # +if test $sTaTuS -ne 0 +then + echo "** ERROR $me '$@' ended with status $sTaTuS" + test ! "$IgNoRe_ErRoR" && exit 8 # EXIT +fi # } # _cmd # --------------------------------------------------------------------- diff --git a/smpe/bld/smpe.sh b/smpe/bld/smpe.sh index 478d702a3b..8562aaa509 100755 --- a/smpe/bld/smpe.sh +++ b/smpe/bld/smpe.sh @@ -29,7 +29,6 @@ #% -r rootDir use the specified root directory #% ignored when -c is specified #% -s stopAt.sh stop before this sub-script is invoked #debug -#% -S execute script to create zowe PSI #% -V volume allocate data sets on specified volume(s) #% -v vrm FMID 3-char version/release/modification (position 5-7) #% ignored when -c is specified @@ -151,12 +150,12 @@ _cmd umask 0022 # similar to chmod 755 # clear input variables unset alter BUILD BRANCH YAML SuCcEsS count HLQ input reqPTF VERSION \ - ROOT psi stopAt VOLSER VRM fmid1 fmid2 + ROOT stopAt VOLSER VRM fmid1 fmid2 # do NOT unset debug errorRC errorRC=8 # default RC 8 on error # get startup arguments -while getopts a:B:b:c:E:f:h:i:p:r:s:V:v:1:2:?dPS opt +while getopts a:B:b:c:E:f:h:i:p:r:s:V:v:1:2:?dP opt do case "$opt" in a) export alter="$OPTARG";; B) export BUILD="-B $OPTARG";; @@ -170,8 +169,7 @@ do case "$opt" in P) export reqPTF="-P";; p) export VERSION="-p $OPTARG";; r) export ROOT="$OPTARG";; - S) export psi="-S";; - s) export stopAt="$OPTARG";; + s) export stopAt="$OPTARG";; V) export VOLSER="$OPTARG";; v) export VRM="$OPTARG";; 1) export fmid1="$OPTARG";; @@ -274,14 +272,6 @@ _stopAt smpe-service.sh $debug -c $YAML $opts _cmd $here/smpe-service.sh $debug -c $YAML $opts # result (final): $ship # zip with sysmod & readme -# create psi -if test -n "$psi" -then - opts="" - _stopAt prepare-PSI.sh $debug -c $YAML $opts - _cmd $here/prepare-PSI.sh $debug -c $YAML $opts - # TODO create real PSI script from smpe -fi # $psi # signal that we ended successfully test -n "$SuCcEsS" && _cmd touch "$SuCcEsS" diff --git a/tests/installation/jest.config.js b/tests/installation/jest.config.js index 1ef916a9fb..c383e5e082 100644 --- a/tests/installation/jest.config.js +++ b/tests/installation/jest.config.js @@ -25,5 +25,6 @@ module.exports = { titleTemplate: "{classname} - {title}", } ] - ] -}; + ], + testTimeout: 3600000 +}; \ No newline at end of file diff --git a/tests/installation/package.json b/tests/installation/package.json index f7bc7e15f3..d3b45a1c4d 100644 --- a/tests/installation/package.json +++ b/tests/installation/package.json @@ -27,10 +27,5 @@ "test": "jest --no-colors --runInBand", "merge-reports": "node dist/merge-test-reports.js", "lint": "eslint ." - }, - "jest": { - "setupFilesAfterEnv": [ - "./src/__tests__/beforeTests.js" - ] } } diff --git a/tests/installation/src/__tests__/basic/install-api-gen.ts b/tests/installation/src/__tests__/basic/install-api-gen.ts index c50c99970d..0549a772ff 100644 --- a/tests/installation/src/__tests__/basic/install-api-gen.ts +++ b/tests/installation/src/__tests__/basic/install-api-gen.ts @@ -12,26 +12,26 @@ import { checkMandatoryEnvironmentVariables, installAndGenerateApiDocs, } from '../../utils'; - import { TEST_TIMEOUT_CONVENIENCE_BUILD } from '../../constants'; +import { TEST_TIMEOUT_CONVENIENCE_BUILD } from '../../constants'; - const testSuiteName = 'Test convenience build installation'; - describe(testSuiteName, () => { - beforeAll(() => { - // validate variables - checkMandatoryEnvironmentVariables([ - 'TEST_SERVER', - 'ZOWE_BUILD_LOCAL', - ]); - }); - - test('install and generate api documentation', async () => { - await installAndGenerateApiDocs( - testSuiteName, - process.env.TEST_SERVER, - { - 'zowe_build_local': process.env['ZOWE_BUILD_LOCAL'], - 'zowe_lock_keystore': 'false', - } - ); - }, TEST_TIMEOUT_CONVENIENCE_BUILD); +const testSuiteName = 'Test convenience build installation'; +describe(testSuiteName, () => { + beforeAll(() => { + // validate variables + checkMandatoryEnvironmentVariables([ + 'TEST_SERVER', + 'ZOWE_BUILD_LOCAL', + ]); }); + + test('install and generate api documentation', async () => { + await installAndGenerateApiDocs( + testSuiteName, + process.env.TEST_SERVER, + { + 'zowe_build_local': process.env['ZOWE_BUILD_LOCAL'], + 'zowe_lock_keystore': 'false', + } + ); + }, TEST_TIMEOUT_CONVENIENCE_BUILD); +}); diff --git a/tests/installation/src/__tests__/basic/install-docker.ts b/tests/installation/src/__tests__/basic/install-docker.ts deleted file mode 100644 index 9a3ec43f6c..0000000000 --- a/tests/installation/src/__tests__/basic/install-docker.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -import { - checkMandatoryEnvironmentVariables, - installAndVerifyDockerBuild, - showZoweRuntimeLogs, -} from '../../utils'; -import { TEST_TIMEOUT_CONVENIENCE_BUILD } from '../../constants'; - -const extraVars = { - 'zowe_build_local': process.env['ZOWE_BUILD_LOCAL'], - // we start docker container on localhost - 'zowe_docker_image_url': process.env['ZOWE_DOCKER_URL'], - 'zowe_external_domain_name': 'localhost', - 'zowe_sanity_test_testcases': '--config .mocharc-docker.yml', -} - -const testSuiteName = 'Test docker build installation'; -describe(testSuiteName, () => { - beforeAll(() => { - // validate variables - checkMandatoryEnvironmentVariables([ - 'TEST_SERVER', - 'ZOWE_BUILD_LOCAL', - ]); - }); - - test('install and verify', async () => { - await installAndVerifyDockerBuild( - testSuiteName, - process.env.TEST_SERVER, - extraVars - ); - }, TEST_TIMEOUT_CONVENIENCE_BUILD); - - afterAll(async () => { - await showZoweRuntimeLogs(process.env.TEST_SERVER, extraVars); - }) -}); diff --git a/tests/installation/src/__tests__/basic/install-ext.ts b/tests/installation/src/__tests__/basic/install-ext.ts index 8b10831901..ff10c82d3b 100644 --- a/tests/installation/src/__tests__/basic/install-ext.ts +++ b/tests/installation/src/__tests__/basic/install-ext.ts @@ -40,12 +40,12 @@ describe(testSuiteName, () => { beforeAllResult = true; }, TEST_TIMEOUT_CONVENIENCE_BUILD); - process.env.EXTENSIONS_LIST.split(',').forEach((extension) => { + process.env.EXTENSIONS_LIST.split(';').forEach((extension) => { if (!extension){ return; } - const extensionArray = extension.split(':'); - if (extensionArray.length !== 2){ + const extensionArray = extension.split(/[()]/); + if (extensionArray.length !== 3){ return; } diff --git a/tests/installation/src/__tests__/beforeTests.js b/tests/installation/src/__tests__/beforeTests.js deleted file mode 100644 index d49695b1e8..0000000000 --- a/tests/installation/src/__tests__/beforeTests.js +++ /dev/null @@ -1,12 +0,0 @@ -/* -* 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. -* -*/ - -jest.setTimeout(3600000); diff --git a/tests/installation/src/__tests__/extended/node-versions/node-v8.ts b/tests/installation/src/__tests__/extended/node-versions/node-v16.ts similarity index 90% rename from tests/installation/src/__tests__/extended/node-versions/node-v8.ts rename to tests/installation/src/__tests__/extended/node-versions/node-v16.ts index 5a2e863b7a..bf4f96d056 100644 --- a/tests/installation/src/__tests__/extended/node-versions/node-v8.ts +++ b/tests/installation/src/__tests__/extended/node-versions/node-v16.ts @@ -5,7 +5,7 @@ * * SPDX-License-Identifier: EPL-2.0 * - * Copyright IBM Corporation 2020 + * Copyright IBM Corporation 2022 */ import { @@ -16,7 +16,7 @@ import { import { TEST_TIMEOUT_CONVENIENCE_BUILD } from '../../../constants'; const testServer = process.env.TEST_SERVER; -const testSuiteName = 'Test convenience build installation with node.js v8'; +const testSuiteName = 'Test convenience build installation with node.js v16'; describe(testSuiteName, () => { beforeAll(() => { // validate variables @@ -31,7 +31,7 @@ describe(testSuiteName, () => { testServer, { 'zowe_build_local': process.env['ZOWE_BUILD_LOCAL'], - 'zos_node_home': '/ZOWE/node/node-v8.17.0-os390-s390x', + 'zos_node_home': '/ZOWE/node/node-v16.13.0-os390-s390x', 'zowe_lock_keystore': 'false', } ); diff --git a/tests/installation/src/merge-test-reports.ts b/tests/installation/src/merge-test-reports.ts index b2ba3052ed..8fb38543e7 100644 --- a/tests/installation/src/merge-test-reports.ts +++ b/tests/installation/src/merge-test-reports.ts @@ -29,7 +29,7 @@ async function readXml(file: string): Promise { }); const parseOpt: parseStringOptions = {trim: true}; return await parseStringPromise(xml, parseOpt); -}; +} (async (): Promise => { // --------------------------------------------------------- diff --git a/tests/installation/src/utils.ts b/tests/installation/src/utils.ts index f737671686..9de5efe94c 100644 --- a/tests/installation/src/utils.ts +++ b/tests/installation/src/utils.ts @@ -42,7 +42,7 @@ export function checkMandatoryEnvironmentVariables(vars: string[]): void { for (const v of vars) { expect(process.env).toHaveProperty(v); } -}; +} /** * Generate MD5 hash of a variable @@ -51,7 +51,7 @@ export function checkMandatoryEnvironmentVariables(vars: string[]): void { */ export function calculateHash(obj: any): string { return crypto.createHash('md5').update(util.format('%j', obj)).digest('hex'); -}; +} /** * Copy sanity test report to install test report folder for future publish. @@ -69,7 +69,7 @@ export function copySanityTestReport(reportHash: string): void { } else { debug(`junit.xml NOT found in ${SANITY_TEST_REPORTS_DIR}`); } -}; +} /** * Clean up sanity test report directory for next test @@ -78,7 +78,7 @@ export function cleanupSanityTestReportDir(): void { debug(`Clean up sanity test reports directory: ${SANITY_TEST_REPORTS_DIR}`); removeSync(SANITY_TEST_REPORTS_DIR); ensureDirSync(SANITY_TEST_REPORTS_DIR); -}; +} /** * Import extra vars for Ansible playbook from environment variables. @@ -108,7 +108,7 @@ export function importDefaultExtraVars(extraVars: {[key: string]: string}, serve } } }); -}; +} type PlaybookResponse = { reportHash: string; @@ -172,7 +172,7 @@ export function runAnsiblePlaybook(testcase: string, playbook: string, serverId: } }); }); -}; +} /** * Install and verify a Zowe build @@ -219,7 +219,7 @@ async function installAndVerifyZowe(testcase: string, installPlaybook: string, s copySanityTestReport(resultVerify.reportHash); expect(resultVerify.code).toBe(0); -}; +} async function installExtension(testcase: string, serverId: string, extraVars: {[key: string]: string} = {}): Promise { debug(`run install-ext.yml on ${serverId}`); @@ -287,7 +287,7 @@ async function verifyExtension(testcase: string, serverId: string, extraVars: {[ */ export async function installAndVerifyConvenienceBuild(testcase: string, serverId: string, extraVars: {[key: string]: string} = {}): Promise { await installAndVerifyZowe(testcase, 'install.yml', serverId, extraVars); -}; +} /** * Install and verify docker build @@ -334,7 +334,7 @@ export async function installAndVerifyDockerBuild(testcase: string, serverId: st copySanityTestReport(resultVerify.reportHash); expect(resultVerify.code).toBe(0); -}; +} /** * Install and verify SMPE FMID @@ -363,7 +363,7 @@ export async function installAndVerifyExtension(testcase: string, serverId: stri // copy sanity test result to install test report folder copySanityTestReport(resultVerify.reportHash); -}; +} /** * Install and verify SMPE PTF @@ -421,7 +421,7 @@ export async function installAndVerifySmpePtf(testcase: string, serverId: string copySanityTestReport(resultVerify.reportHash); expect(resultVerify.code).toBe(0); -}; +} /** * Install Zowe and generate Swagger API definitions @@ -466,7 +466,7 @@ export async function installAndGenerateApiDocs(testcase: string, serverId: stri copySanityTestReport(resultVerify.reportHash); expect(resultVerify.code).toBe(0); -}; +} /** * Show all Zowe runtime logs @@ -488,4 +488,4 @@ export async function showZoweRuntimeLogs(serverId: string, extraVars: {[key: st } catch (e) { debug(`showZoweRuntimeLogs failed: ${e}`); } -}; +} diff --git a/tests/sanity/test/apiml/test-sample-extension-controller.js b/tests/sanity/test/apiml/test-sample-extension-controller.js new file mode 100644 index 0000000000..6354ac6157 --- /dev/null +++ b/tests/sanity/test/apiml/test-sample-extension-controller.js @@ -0,0 +1,63 @@ +/** + * 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 IBM Corporation 2018, 2019 + */ + +const _ = require('lodash'); +const expect = require('chai').expect; +const debug = require('debug')('zowe-sanity-test:explorer:api-gateway'); +const axios = require('axios'); +const addContext = require('mochawesome/addContext'); + +let REQ; + + +describe('test api gateway sample extension controller', function() { + before('verify environment variables', function() { + // allow self signed certs + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + + expect(process.env.ZOWE_EXTERNAL_HOST, 'ZOWE_EXTERNAL_HOST is empty').to.not.be.empty; + expect(process.env.ZOWE_API_MEDIATION_GATEWAY_HTTP_PORT, 'ZOWE_API_MEDIATION_GATEWAY_HTTP_PORT is not defined').to.not.be.empty; + + REQ = axios.create({ + baseURL: `https://${process.env.ZOWE_EXTERNAL_HOST}:${process.env.ZOWE_API_MEDIATION_GATEWAY_HTTP_PORT}`, + timeout: 30000, + }); + + debug(`Explorer server URL: https://${process.env.ZOWE_EXTERNAL_HOST}:${process.env.ZOWE_API_MEDIATION_GATEWAY_HTTP_PORT}`); + }); + + it('should return the greeting message from the gateway sample extension controller', function() { + debug('Verify access to greeting endpoint via /api/v1/greeting'); + return getAndVerifyGreeting('/api/v1/greeting'); + }); + + function getAndVerifyGreeting(url) { + const _this = this; + + const req = { + method: 'get', + url: url, + }; + debug('request', req); + + return REQ.request(req) + .then(function(res) { + debug('response', _.pick(res, ['status', 'statusText', 'headers', 'data'])); + addContext(_this, { + title: 'http response', + value: res && res.data + }); + + expect(res).to.have.property('status'); + expect(res.status).to.equal(200); + expect(res.data).to.not.be.empty; + }); + } +}); diff --git a/tests/sanity/test/utils-scripts/test-common.js b/tests/sanity/test/utils-scripts/test-common.js deleted file mode 100644 index fbbde63763..0000000000 --- a/tests/sanity/test/utils-scripts/test-common.js +++ /dev/null @@ -1,223 +0,0 @@ -/** - * 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 IBM Corporation 2020, 2021 - */ - -const sshHelper = require('../ssh-helper'); - - -describe('verify utils/common', function() { - - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - }); - - const print_error_message = 'print_error_message'; - describe(`verify ${print_error_message}`, function() { - - it('test single message', async function() { - const error = 'Oh, no - something went wrong'; - const expected_err = `Error 0: ${error}`; - await test_print_error_message(error, expected_err); - }); - - it('test two messages', async function() { - const error_0 = 'Oh, no - something went wrong'; - const error_1 = 'It happened again!'; - const expected_err = `Error 0: ${error_0}\nError 1: ${error_1}`; - const command = `${print_error_message} "${error_0}" && ${print_error_message} "${error_1}"`; - await test_common_function_has_expected_rc_stdout_stderr(command, {}, { stdout: expected_err, stderr: expected_err }); - }); - - async function test_print_error_message(message, expected_message) { - const command = `${print_error_message} "${message}"`; - // Currently we output errors to stdout and stderr - await test_common_function_has_expected_rc_stdout_stderr(command, {}, { stdout: expected_message, stderr: expected_message }); - } - }); - - const print_message = 'print_message'; - describe(`verify ${print_message}`, function() { - - it('test single message', async function() { - const message = 'this is a printed message'; - const command = `${print_message} "${message}"`; - await test_common_function_has_expected_rc_stdout_stderr(command, {}, { stdout: message }); - }); - }); - - const log_message = 'log_message'; - describe(`verify ${log_message}`, function() { - - it('test log message with no log_file', async function() { - const message = 'Log this'; - await test_log_message(message, message); - }); - - describe('with a log file created', async function() { - const temp_dir = '~/delete_1234'; - const log_file = `${temp_dir}/log.txt`; - before('create log file', async function() { - await sshHelper.executeCommandWithNoError(`mkdir -p ${temp_dir} && touch ${log_file} && chmod u+w ${log_file}`); - }); - - after('dispose dummy node', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${temp_dir}`); - }); - - it('test log message with log_file', async function() { - const message = 'Log this'; - await test_log_message(message, message, log_file); - }); - }); - - async function test_log_message(message, expected_out, log_file = '') { - const command = `${log_message} "${message}"`; - if (log_file == '') { - await test_common_function_has_expected_rc_stdout_stderr(command, {}, { stdout: expected_out }); - } else { - //Nothing stdout - await test_common_function_has_expected_rc_stdout_stderr(command, { 'LOG_FILE': log_file }); - //Check log content - await test_common_function_has_expected_rc_stdout_stderr(`cat ${log_file}`, {}, { stdout: expected_out }); - } - } - }); - - const print_and_log_message = 'print_and_log_message'; - describe(`verify ${print_and_log_message}`, function() { - - it('test log message with no log_file', async function() { - const message = 'Log this'; - await test_print_and_log_message(message, message); - }); - - describe('with a log file created', async function() { - const temp_dir = '~/delete_1234'; - const log_file = `${temp_dir}/log.txt`; - before('create log file', async function() { - await sshHelper.executeCommandWithNoError(`mkdir -p ${temp_dir} && touch ${log_file} && chmod u+w ${log_file}`); - }); - - after('dispose dummy node', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${temp_dir}`); - }); - - it('test log message with log_file', async function() { - const message = 'Log this'; - await test_print_and_log_message(message, message, log_file); - }); - }); - - async function test_print_and_log_message(message, expected_out, log_file = '') { - const command = `${print_and_log_message} "${message}"`; - if (log_file == '') { - await test_common_function_has_expected_rc_stdout_stderr(command, {}, { stdout: expected_out }); - } else { - //Check stdout - await test_common_function_has_expected_rc_stdout_stderr(command, { 'LOG_FILE': log_file }, { stdout: expected_out }); - //Check log content - await test_common_function_has_expected_rc_stdout_stderr(`cat ${log_file}`, {}, { stdout: expected_out }); - } - } - }); - - const runtime_check_for_validation_errors_found = 'runtime_check_for_validation_errors_found'; - describe(`verify ${runtime_check_for_validation_errors_found}`, function() { - - it('test log message with no error', async function() { - const errors_found = 0; - await test_common_function_has_expected_rc_stdout_stderr(runtime_check_for_validation_errors_found, { - 'ERRORS_FOUND': errors_found, - 'INSTANCE_DIR': process.env.ZOWE_INSTANCE_DIR, - }); - }); - - it('test log message with specific errors', async function() { - const errors_found = 10; - const message = `${errors_found} errors were found during validation, please check the message, correct any properties required in ${process.env.ZOWE_INSTANCE_DIR}/instance.env and re-launch Zowe`; - await test_common_function_has_expected_rc_stdout_stderr(runtime_check_for_validation_errors_found, { - 'ERRORS_FOUND': errors_found, - 'INSTANCE_DIR': process.env.ZOWE_INSTANCE_DIR, - }, { - rc: errors_found, - stdout: message, - }); - }); - - it('test log message with specific errors without exit', async function() { - const errors_found = 10; - const message = `${errors_found} errors were found during validation, please check the message, correct any properties required in ${process.env.ZOWE_INSTANCE_DIR}/instance.env and re-launch Zowe`; - await test_common_function_has_expected_rc_stdout_stderr(runtime_check_for_validation_errors_found, { - 'ERRORS_FOUND': errors_found, - 'INSTANCE_DIR': process.env.ZOWE_INSTANCE_DIR, - 'ZWE_IGNORE_VALIDATION_ERRORS': 'true', - }, { - rc: 0, - stdout: message, - }); - }); - }); - - const print_formatted_message = 'print_formatted_message'; - describe(`verify ${print_formatted_message}`, function() { - const log_service = 'SANITYTEST'; - const log_stack = 'stack1,stack2'; - const log_message = 'test message'; - const set_log_level = (lvl) => { - const envs = {}; - envs[`ZWE_PRIVATE_LOG_LEVEL_${log_service}`] = lvl; - return envs; - }; - - it('should display INFO formatted log without log level config', async function() { - await test_common_function_has_expected_rc_stdout_stderr(`print_formatted_message "${log_service}" "${log_stack}" INFO "${log_message}"`, - {}, - { - stdout: `INFO (${log_stack}) ${log_message}`, - }, - false); - }); - - it('should display ERROR formatted log without log level config', async function() { - await test_common_function_has_expected_rc_stdout_stderr(`print_formatted_message "${log_service}" "${log_stack}" ERROR "${log_message}"`, - {}, - { - stderr: `ERROR (${log_stack}) ${log_message}`, - }, - false); - }); - - it('should not display DEBUG formatted log without log level config', async function() { - await test_common_function_has_expected_rc_stdout_stderr(`print_formatted_message "${log_service}" "${log_stack}" DEBUG "${log_message}"`, - {}, - {}, - false); - }); - - it('should display DEBUG formatted log if log level is DEBUG', async function() { - await test_common_function_has_expected_rc_stdout_stderr(`print_formatted_message "${log_service}" "${log_stack}" DEBUG "${log_message}"`, - set_log_level('debug'), - { - stdout: `DEBUG (${log_stack}) ${log_message}`, - }, - false); - }); - }); - - async function test_common_function_has_expected_rc_stdout_stderr(command, envs = {}, expected = {}, exact_match = true) { - await sshHelper.testCommand(command, { - envs: Object.assign({ 'ZOWE_ROOT_DIR': process.env.ZOWE_ROOT_DIR }, envs), - sources: [ process.env.ZOWE_ROOT_DIR + '/bin/utils/common.sh' ] - }, expected, exact_match); - } - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-component-utils.js b/tests/sanity/test/utils-scripts/test-component-utils.js deleted file mode 100644 index b6db9b234a..0000000000 --- a/tests/sanity/test/utils-scripts/test-component-utils.js +++ /dev/null @@ -1,365 +0,0 @@ -/** - * 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 IBM Corporation 2020, 2021 - */ - -const { expect } = require('chai'); -const sshHelper = require('../ssh-helper'); -// const debug = require('debug')('zowe-sanity-test:utils-scripts:component-utils'); - -describe('verify utils/component-utils', function() { - let TMP_DIR; - const TMP_EXT_DIR = 'sanity_test_extensions'; - const dummy_component_name = 'sanity_test_dummy'; - let component_runtime_dir; - let component_env_dir; - - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - - // retrieve tmp dir on server side - TMP_DIR = await sshHelper.getTmpDir(); - component_runtime_dir = `${TMP_DIR}/${TMP_EXT_DIR}/${dummy_component_name}`; - component_env_dir = `${TMP_DIR}/.env/${dummy_component_name}`; - }); - - const find_component_directory = 'find_component_directory'; - describe(`verify ${find_component_directory}`, function() { - - it('test with full component lifecycle script path', async function() { - const component = 'jobs-api'; - await test_component_function_has_expected_rc_stdout_stderr( - `${find_component_directory} "${process.env.ZOWE_ROOT_DIR}/components/${component}/bin"`, - {}, - { - stdout: `${process.env.ZOWE_ROOT_DIR}/components/${component}`, - }, - false - ); - }); - - it('test with build in component id', async function() { - const component = 'jobs-api'; - await test_component_function_has_expected_rc_stdout_stderr( - `${find_component_directory} ${component}`, - {}, - { - stdout: `${process.env.ZOWE_ROOT_DIR}/components/${component}`, - }, - false - ); - }); - - describe('with a dummy extension folder created', async function() { - const manifest_file = 'manifest.yaml'; - before('create component manifest file', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir} && cd ${component_runtime_dir} && touch ${manifest_file} && chmod u+w ${manifest_file}`); - }); - - after('dispose dummy component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${TMP_DIR}/${TMP_EXT_DIR}`); - }); - - it('test with dummy extension', async function() { - await test_component_function_has_expected_rc_stdout_stderr( - `${find_component_directory} ${dummy_component_name}`, - { - 'ZWE_EXTENSION_DIR': `${TMP_DIR}/${TMP_EXT_DIR}`, - }, - { - stdout: `${component_runtime_dir}`, - }, - false - ); - }); - }); - - }); - - const is_core_component = 'is_core_component'; - describe(`verify ${is_core_component}`, function() { - before('create test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir} && echo 'name: ${dummy_component_name}' > ${component_runtime_dir}/manifest.yaml`); - }); - - after('dispose test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir}`); - }); - - it('test with core component', async function() { - const component = 'jobs-api'; - await test_component_function_has_expected_rc_stdout_stderr( - 'echo $' + `(${is_core_component} "` + '$' + `(find_component_directory ${component})")`, - {}, - { - stdout: 'true', - } - ); - }); - - it('test with non-core component', async function() { - await test_component_function_has_expected_rc_stdout_stderr( - 'echo $' + `(${is_core_component} "` + '$' + `(find_component_directory ${dummy_component_name})")`, - {}, - { - stdout: 'false', - } - ); - }); - - }); - - const read_component_manifest = 'read_component_manifest'; - describe(`verify ${read_component_manifest}`, function() { - - it('test reading component name', async function() { - const component = 'jobs-api'; - await test_component_function_has_expected_rc_stdout_stderr( - 'echo $' + `(${read_component_manifest} "${process.env.ZOWE_ROOT_DIR}/components/${component}" ".name")`, - {}, - { - stdout: component, - } - ); - }); - - it('test reading component commands.start', async function() { - const component = 'jobs-api'; - await test_component_function_has_expected_rc_stdout_stderr( - 'echo $' + `(${read_component_manifest} "${process.env.ZOWE_ROOT_DIR}/components/${component}" ".commands.start")`, - {}, - { - stdout: 'bin/start.sh', - } - ); - }); - - it('test reading non-existing component manifest entry', async function() { - const component = 'jobs-api'; - await test_component_function_has_expected_rc_stdout_stderr( - 'echo $' + `(${read_component_manifest} "${process.env.ZOWE_ROOT_DIR}/components/${component}" ".commands.somethingDoesNotExist")`, - {}, - { - stdout: 'null', - } - ); - }); - - it('test reading component manifest entry with wrong definition', async function() { - const component = 'jobs-api'; - await test_component_function_has_expected_rc_stdout_stderr( - 'echo $' + `(${read_component_manifest} "${process.env.ZOWE_ROOT_DIR}/components/${component}" ".commands[].start" 2>&1)`, - {}, - { - rc: 0, - stdout: 'Error: Cannot iterate over object', - } - ); - }); - - it('test reading component manifest with an invalid manifest.yaml file', async function() { - const manifest_file = 'manifest.yaml'; - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir} && cd ${component_runtime_dir} && touch ${manifest_file} && chmod u+w ${manifest_file}`); - await sshHelper.executeCommandWithNoError(`echo 'invalid: "invalid-value' >> ${component_runtime_dir}/${manifest_file}`); - await test_component_function_has_expected_rc_stdout_stderr( - 'echo $' + `(${read_component_manifest} "${component_runtime_dir}" ".invalid" 2>&1)`, - {}, - { - rc: 0, - stdout:'Error: error reading input file: Missing closing "quote Error: Unexpected end of JSON input', - } - ); - }); - - }); - - const detect_component_manifest_encoding = 'detect_component_manifest_encoding'; - describe(`verify ${detect_component_manifest_encoding}`, function() { - beforeEach('create test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir}`); - }); - - afterEach('dispose test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir}`); - }); - - it('test detecting component manifest.yaml encoding with default setup', async function() { - // prepare manifest.yaml in default (IBM-1047) encoding - await sshHelper.executeCommandWithNoError(`echo 'name: ${dummy_component_name}' > ${component_runtime_dir}/manifest.yaml`); - - await test_component_function_has_expected_rc_stdout_stderr( - `${detect_component_manifest_encoding} "${component_runtime_dir}"`, - { - 'ZWE_EXTENSION_DIR': `${TMP_DIR}/${TMP_EXT_DIR}`, - }, - { - stdout: 'IBM-1047', - } - ); - }); - it('test detecting component manifest.yaml encoding with customized encoding setup', async function() { - // prepare manifest.yaml in default (IBM-1047) encoding - await sshHelper.executeCommandWithNoError(`cd ${component_runtime_dir} && echo 'name: ${dummy_component_name}' > manifest.yaml.1047 && iconv -f IBM-1047 -t ISO8859-1 manifest.yaml.1047 > manifest.yaml && rm manifest.yaml.1047`); - - await test_component_function_has_expected_rc_stdout_stderr( - `${detect_component_manifest_encoding} "${component_runtime_dir}"`, - { - 'ZWE_EXTENSION_DIR': `${TMP_DIR}/${TMP_EXT_DIR}`, - }, - { - stdout: 'ISO8859-1', - } - ); - }); - - it('test detecting files-api manifest.yaml encoding', async function() { - // files-api is shipped as ZIP and it should be automatically tagged as ISO8859-1 encoding during installation - await test_component_function_has_expected_rc_stdout_stderr( - `${detect_component_manifest_encoding} "${process.env.ZOWE_ROOT_DIR}/components/files-api"`, - {}, - { - stdout: 'ISO8859-1', - } - ); - }); - - it('test detecting explorer-jes manifest.yaml encoding', async function() { - // explorer-jes is shipped as PAX and it's already in IBM-1047 encoding - await test_component_function_has_expected_rc_stdout_stderr( - `${detect_component_manifest_encoding} "${process.env.ZOWE_ROOT_DIR}/components/explorer-jes"`, - {}, - { - stdout: 'IBM-1047', - } - ); - }); - - }); - - const convert_component_manifest = 'convert_component_manifest'; - describe(`verify ${convert_component_manifest}`, function() { - before('create test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir} && rm -fr ${component_env_dir} && mkdir -p ${component_env_dir} && echo 'name: ${dummy_component_name}' > ${component_runtime_dir}/manifest.yaml`); - }); - - after('dispose test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && rm -fr ${component_env_dir}`); - }); - - it('test creating component .manifest.json in workspace', async function() { - await test_component_function_has_expected_rc_stdout_stderr( - `${convert_component_manifest} "${component_runtime_dir}"`, - { - 'ZWE_EXTENSION_DIR': `${TMP_DIR}/${TMP_EXT_DIR}`, - 'ZWELS_INSTANCE_ENV_DIR': `${TMP_DIR}/.env`, - } - ); - - const jsonContent = await sshHelper.executeCommandWithNoError(`_BPXK_AUTOCVT=ON cat ${component_env_dir}/.manifest.json`); - expect(jsonContent).to.be.equal(`{\n "name": "${dummy_component_name}"\n}`); - }); - - }); - - const process_component_apiml_static_definitions = 'process_component_apiml_static_definitions'; - describe(`verify ${process_component_apiml_static_definitions}`, function() { - const static_def_file = 'static-def.yaml'; - // this may change in the future - const static_def_dir = `${process.env.ZOWE_INSTANCE_DIR}/workspace/api-mediation/api-defs`; - const target_static_def_file_pattern = `${dummy_component_name}.static_def_yaml.*.yml`; - - before('create test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir} && echo 'name: ${dummy_component_name}\napimlServices:\n static:\n - file: ${static_def_file}' > ${component_runtime_dir}/manifest.yaml && echo 'services: does not matter' > ${component_runtime_dir}/${static_def_file}`); - }); - - after('dispose test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && rm -fr ${static_def_dir}/${target_static_def_file_pattern}`); - }); - - it('test processing APIML static definitions', async function() { - await test_component_function_has_expected_rc_stdout_stderr( - `${process_component_apiml_static_definitions} "${component_runtime_dir}"`, - { - 'ZWE_EXTENSION_DIR': `${TMP_DIR}/${TMP_EXT_DIR}`, - }, - { - stdout: `process ${dummy_component_name} service static definition file ${static_def_file} ...` - } - ); - - const res = await sshHelper.executeCommand(`ls -1 ${static_def_dir}/${target_static_def_file_pattern}`); - expect(res.rc).to.equal(0); - const target_static_def_file = res.stdout; - - const jsonContent = await sshHelper.executeCommandWithNoError(`_BPXK_AUTOCVT=ON iconv -f IBM-850 -t IBM-1047 ${target_static_def_file}`); - expect(jsonContent).to.be.equal('services: does not matter'); - }); - - }); - - const process_component_desktop_iframe_plugin = 'process_component_desktop_iframe_plugin'; - describe(`verify ${process_component_desktop_iframe_plugin}`, function() { - const dummy_component_title = 'Sanity Test Dummy'; - const dummy_component_id = 'org.zowe.plugins.sanity_test_dummy'; - const dummy_component_url = '/ui/v1/dummy'; - const component_workspace_dir = `${process.env.ZOWE_INSTANCE_DIR}/workspace/${dummy_component_name}`; - const app_server_plugins_dir = `${process.env.ZOWE_INSTANCE_DIR}/workspace/app-server/plugins`; - - before('create test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir} && rm -fr ${component_workspace_dir} && echo 'name: ${dummy_component_name}\nid: ${dummy_component_id}\ntitle: ${dummy_component_title}\ndesktopIframePlugins:\n- url: ${dummy_component_url}\n icon: image.png' > ${component_runtime_dir}/manifest.yaml && echo 'dummy' > ${component_runtime_dir}/image.png`); - }); - - after('dispose test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && rm -fr ${component_workspace_dir} && rm -fr ${app_server_plugins_dir}/${dummy_component_id}.json`); - }); - - it('test processing Desktop iFrame plugins', async function() { - await test_component_function_has_expected_rc_stdout_stderr( - `${process_component_desktop_iframe_plugin} "${component_runtime_dir}"`, - { - 'ZWE_EXTENSION_DIR': `${TMP_DIR}/${TMP_EXT_DIR}`, - }, - { - stdout: 'process desktop plugin #0' - }, - false - ); - - const pluginDefinitionContent = await sshHelper.executeCommandWithNoError(`_BPXK_AUTOCVT=ON cat ${component_workspace_dir}/pluginDefinition.json`); - expect(pluginDefinitionContent).to.have.string(`"identifier": "${dummy_component_id}",`); - - const pluginIndexHtml = await sshHelper.executeCommandWithNoError(`_BPXK_AUTOCVT=ON cat ${component_workspace_dir}/web/index.html`); - expect(pluginIndexHtml).to.have.string(dummy_component_url); - - const pluginRegistryContent = await sshHelper.executeCommandWithNoError(`_BPXK_AUTOCVT=ON cat ${app_server_plugins_dir}/${dummy_component_id}.json`); - expect(pluginRegistryContent).to.have.string(`"identifier": "${dummy_component_id}",`); - }); - - }); - - async function test_component_function_has_expected_rc_stdout_stderr(command, envs = {}, expected = {}, exact_match = true) { - await sshHelper.testCommand( - command, - { - envs: Object.assign({ - 'INSTANCE_DIR': process.env.ZOWE_INSTANCE_DIR, - 'ROOT_DIR': process.env.ZOWE_ROOT_DIR, - }, envs), - sources: [ - process.env.ZOWE_ROOT_DIR + '/bin/internal/prepare-environment.sh' - ] - }, - expected, - exact_match - ); - } - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-file-utils.js b/tests/sanity/test/utils-scripts/test-file-utils.js deleted file mode 100644 index 375e84949e..0000000000 --- a/tests/sanity/test/utils-scripts/test-file-utils.js +++ /dev/null @@ -1,412 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -const sshHelper = require('../ssh-helper'); - - -describe('verify file-utils', function() { - let TMP_DIR; - const TMP_EXT_DIR = 'sanity_test_files_utils'; - const dummy_component_name = 'sanity_test_dummy'; - let component_runtime_dir; - - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - }); - - before('set up temporary directory', async function() { - TMP_DIR = await sshHelper.executeCommandWithNoError('get_tmp_dir', { - sources: [ - `${process.env.ZOWE_ROOT_DIR}/bin/utils/common.sh`, - ] - }); - component_runtime_dir = `${TMP_DIR}/${TMP_EXT_DIR}/${dummy_component_name}`; - }); - - let home_dir; - before('get required parameters', async function() { - home_dir = await sshHelper.executeCommandWithNoError('echo $HOME'); - }); - - describe('verify get_full_path', function() { - - let curr_dir; - // let parent_dir; - before('get required parameters', async function() { - curr_dir = await sshHelper.executeCommandWithNoError('echo $PWD'); - // parent_dir = await sshHelper.executeCommandWithNoError('echo $(cd ../;pwd)'); - }); - - it('test home directory is expanded', async function() { - const input = '~/test'; - const expected = home_dir + '/test'; - await test_get_full_path(input, expected); - }); - - it('test full path is not modified', async function() { - const input = `${process.env.ZOWE_INSTANCE_DIR}/test123`; - const expected = input; - await test_get_full_path(input, expected); - }); - - it('test relative path is evaluated', async function() { - const test_dir = 'test_dir123124'; - const input = `../${test_dir}`; - const expected = `${curr_dir}/../${test_dir}`;// TODO - it would be evaluate to `${parent_dir}/${test_dir}`; - await test_get_full_path(input, expected); - }); - - async function test_get_full_path(input, expected_stdout) { - const command = `get_full_path "${input}"`; - await test_file_utils_function_has_expected_rc_stdout_stderr(command, 0, expected_stdout, ''); - } - }); - - describe('validate_file_not_in_directory', function() { - - it('test file in directory not valid', async function() { - const file = `${home_dir}/test`; - const directory = home_dir; - await test_validate_file_not_in_directory(file, directory, false); - }); - - it('test file in home directory expanded not valid', async function() { - const file = '~/test'; - const directory = home_dir; - await test_validate_file_not_in_directory(file, directory, false); - }); - - it('test siblings without trailing slash is valid', async function() { - const file = '/home/zowe/instance'; - const directory = '/home/zowe/root'; - await test_validate_file_not_in_directory(file, directory, true); - }); - - it('test siblings with trailing slash is valid', async function() { - const file = '/home/zowe/instance'; - const directory = '/home/zowe/root/'; - await test_validate_file_not_in_directory(file, directory, true); - }); - - it('test siblings with both trailing slash is valid', async function() { - const file = '/home/zowe/instance/'; - const directory = '/home/zowe/root/'; - await test_validate_file_not_in_directory(file, directory, true); - }); - - //TODO zip #1325 - until we can evaluate ../ this will fail - it.skip('test relative sibling is valid', async function() { - const file = '/home/zowe/root/../test'; - const directory = '/home/zowe/root/'; - await test_validate_file_not_in_directory(file, directory, true); - }); - - async function test_validate_file_not_in_directory(file, directory, expected_valid) { - const command = `validate_file_not_in_directory "${file}" "${directory}"`; - const expected_rc = expected_valid ? 0 : 1; - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, '', ''); - } - }); - - const validate_file_is_accessible = 'validate_file_is_accessible'; - describe(`verify ${validate_file_is_accessible}`, function() { - - function get_inaccessible_message(file) { - return `File '${file}' doesn't exist, or is not accessible to ${process.env.SSH_USER.toUpperCase()}. If the file exists, check all the parent directories have traversal permission (execute)`; - } - - it('test start script is accessible', async function() { - const file = `${process.env.ZOWE_INSTANCE_DIR}/bin/zowe-start.sh`; - await test_validate_file_is_accessible(file, true); - }); - - it('test junk file is not accessible', async function() { - const directory = '/junk/rubbish/madeup'; - await test_validate_file_is_accessible(directory, false); - }); - - async function test_validate_file_is_accessible(file, expected_valid) { - const command = `${validate_file_is_accessible} "${file}"`; - const expected_rc = expected_valid ? 0 : 1; - const expected_err = expected_valid ? '' : get_inaccessible_message(file); - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_err, expected_err); - } - }); - - describe('validate_directory_is_accessible and writable', function() { - - let temp_dir = 'temp_' + Math.floor(Math.random() * 10e6); - let inaccessible_dir = `${temp_dir}/inaccessible`; - before('set up test directory', async function() { - await sshHelper.executeCommandWithNoError(`mkdir -p ${inaccessible_dir} && chmod a-wx ${temp_dir}`); - }); - - after('clean up test directory', async function() { - await sshHelper.executeCommandWithNoError(`chmod 770 ${temp_dir} && rm -rf ${temp_dir}`); - }); - - function get_inaccessible_message(directory) { - return `Directory '${directory}' doesn't exist, or is not accessible to ${process.env.SSH_USER.toUpperCase()}. If the directory exists, check all the parent directories have traversal permission (execute)`; - } - - it('test home directory is accessible', async function() { - const directory = home_dir; - await test_validate_directory_is_accessible(directory, true); - }); - - it('test junk directory is not accessible', async function() { - const directory = '/junk/rubbish/madeup'; - await test_validate_directory_is_accessible(directory, false); - }); - - // zip-1377 Marist seems to have elevated privileges be able to access non-traversable directories, so this fails - it.skip('test non-traversable directory is not accessible', async function() { - await test_validate_directory_is_accessible(inaccessible_dir, false); - }); - - async function test_validate_directory_is_accessible(directory, expected_valid) { - const command = `validate_directory_is_accessible "${directory}"`; - const expected_rc = expected_valid ? 0 : 1; - const expected_err = expected_valid ? '' : get_inaccessible_message(directory); - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_err, expected_err); - } - - const validate_directories_are_accessible = 'validate_directories_are_accessible'; - describe(`verify ${validate_directories_are_accessible}`, function() { - - it('test single accessible directory works', async function() { - const input = [home_dir]; - await test_validate_directories_are_accessible(input, []); - }); - - it('test one accessible and one inaccessible directories gives a single error', async function() { - const directory_list = [home_dir, '/junk/rubbish/madeup']; - await test_validate_directories_are_accessible(directory_list, ['/junk/rubbish/madeup']); - }); - - it('test two inaccessible directories gives two errors', async function() { - const directory_list = ['/junk/rubbish/madeup', '/junk/rubbish/madeup2']; - await test_validate_directories_are_accessible(directory_list, directory_list); - }); - - async function test_validate_directories_are_accessible(directories_list, invalid_directories) { - const command = `${validate_directories_are_accessible} "${directories_list.join()}"`; - const expected_rc = invalid_directories.length; - const error_list = invalid_directories.map((directory, index) => { - return `Error ${index}: ${get_inaccessible_message(directory)}`; - }); - const expected_err = error_list.join('\n'); - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_err, expected_err); - } - }); - - it('test home directory is writable', async function() { - const directory = home_dir; - await test_validate_directory_is_writable(directory, true); - }); - - it('test junk directory shows as not accessible on writable check', async function() { - const directory = '/junk/rubbish/madeup'; - const command = `validate_directory_is_writable "${directory}"`; - const expected_rc = 1; - const expected_err = get_inaccessible_message(directory); - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_err, expected_err); - }); - - // zip-1377 Marist's ACF2 and TS id seems to have elevated privileges be able to write non-writable directories, so this fails - it.skip('test non-writable directory is not writable', async function() { - await test_validate_directory_is_writable(temp_dir, false); - }); - - async function test_validate_directory_is_writable(directory, expected_valid) { - const command = `validate_directory_is_writable "${directory}"`; - const expected_rc = expected_valid ? 0 : 1; - const expected_err = expected_valid ? '' : `Directory '${directory}' does not have write access`; - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_err, expected_err); - } - }); - - const count_children_in_directory = 'count_children_in_directory'; - describe(`verify ${count_children_in_directory}`, function() { - - let temp_dir = 'temp_' + Math.floor(Math.random() * 10e6); - let dir_with_no_children = `${temp_dir}/no_children`; - let dir_with_1_child = `${temp_dir}/has_child`; - let dir_with_3_children = `${temp_dir}/has_children`; - before('set up test directory', async function() { - await sshHelper.executeCommandWithNoError(`mkdir -p "${dir_with_no_children}" && mkdir -p "${dir_with_1_child}" && touch "${dir_with_1_child}/child" && mkdir -p "${dir_with_3_children}" && touch "${dir_with_3_children}/child1" && touch "${dir_with_3_children}/child2" && touch "${dir_with_3_children}/child3"`); - }); - - after('clean up test directory', async function() { - await sshHelper.executeCommandWithNoError(`chmod 770 ${temp_dir} && rm -rf ${temp_dir}`); - }); - - it('test directory which doesn\'t exist has 0 children', async function() { - await test_count_children_in_directory('/junk/rubbish/madeup', 0); - }); - - it('test directory with no children has 0 children', async function() { - await test_count_children_in_directory(dir_with_no_children, 0); - }); - - it('test directory with a child has 1 children', async function() { - await test_count_children_in_directory(dir_with_1_child, 1); - }); - - it('test directory with 3 children has 3 children', async function() { - await test_count_children_in_directory(dir_with_3_children, 3); - }); - - async function test_count_children_in_directory(directory, expected_children) { - const command = `${count_children_in_directory} "${directory}"`; - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_children, '', ''); - } - - after('clean up test directory', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${temp_dir}`); - }); - }); - - const read_yaml = 'read_yaml'; - describe(`verify ${read_yaml}`, function() { - - before('create test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir}`); - }); - - after('dispose test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir}`); - }); - - it('test read component name', async function() { - const component = 'api-catalog'; - const file = `${process.env.ZOWE_ROOT_DIR}/components/${component}/manifest.yaml`; - const key = '.name'; - await test_read_yaml(file, key, component); - }); - - it('test read non-existing entry in component manifest', async function() { - const component = 'api-catalog'; - const file = `${process.env.ZOWE_ROOT_DIR}/components/${component}/manifest.yaml`; - const key = '.unexistingProperty'; - await test_read_yaml(file, key, null); - }); - - it('test read component manifest with incorrect key', async function() { - const component = 'api-catalog'; - const file = `${process.env.ZOWE_ROOT_DIR}/components/${component}/manifest.yaml`; - const key = '.apimlServices.dynamic.serviceId'; - await test_read_yaml(file, key, null); - }); - - it('test read component manifest with correct key', async function() { - const component = 'api-catalog'; - const file = `${process.env.ZOWE_ROOT_DIR}/components/${component}/manifest.yaml`; - const key = '.apimlServices.dynamic[].serviceId'; - await test_read_yaml(file, key, 'apicatalog'); - }); - - it('test read component yaml template', async function() { - const component = 'jobs-api'; - const file = `${process.env.ZOWE_ROOT_DIR}/components/${component}/apiml-static-registration.yaml.template`; - const key = '.services[].serviceId'; - await test_read_yaml(file, key, 'jobs'); - }); - - it('test invalid yaml file', async function() { - const invalid_yaml = 'invalid.yaml'; - await sshHelper.executeCommandWithNoError(`cd ${component_runtime_dir} && touch ${invalid_yaml} && chmod u+w ${invalid_yaml}`); - await sshHelper.executeCommandWithNoError(`echo 'invalid: "invalid_value' >> ${component_runtime_dir}/${invalid_yaml}`); - const file = `${component_runtime_dir}/${invalid_yaml}`; - const key = '.invalid'; - const err_msg = 'Error: error reading input file: Missing closing "quote'; - await test_read_yaml(file, key, '', false, err_msg); - }); - - async function test_read_yaml(file, key, expected_output, expected_valid=true, expected_err='') { - const command = `${read_yaml} "${file}" "${key}"`; - const expected_rc = expected_valid ? 0 : 1; - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_output, expected_err); - } - }); - - //add invalid files (invalid yaml and json) - const read_json = 'read_json'; - describe(`verify ${read_json}`, function() { - - before('create test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir} && mkdir -p ${component_runtime_dir}`); - }); - - after('dispose test component', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${component_runtime_dir}`); - }); - - const file_name = 'pluginDefinition.json'; - - it('test read component\'s pluginDefinition identifier', async function() { - const component = 'explorer-jes'; - const file = `${process.env.ZOWE_ROOT_DIR}/components/${component}/${file_name}`; - const key = '.identifier'; - await test_read_json(file, key, 'org.zowe.explorer-jes'); - }); - - it('test read non-existing entry in pluginDefinition', async function() { - const component = 'explorer-jes'; - const file = `${process.env.ZOWE_ROOT_DIR}/components/${component}/${file_name}`; - const key = '.unexistingProperty'; - await test_read_json(file, key, null); - }); - - it('test read pluginDefinition with correct key', async function() { - const component = 'explorer-jes'; - const file = `${process.env.ZOWE_ROOT_DIR}/components/${component}/${file_name}`; - const key = '.webContent.framework'; - await test_read_json(file, key, 'iframe'); - }); - - it('test invalid json file', async function() { - const invalid_json = 'invalid.json'; - await sshHelper.executeCommandWithNoError(`cd ${component_runtime_dir} && touch ${invalid_json} && chmod u+w ${invalid_json}`); - await sshHelper.executeCommandWithNoError(`echo '{invalid: "invalid"}' >> ${component_runtime_dir}/${invalid_json}`); - const file = `${component_runtime_dir}/${invalid_json}`; - const key = '.invalid'; - const err_msg = 'Error: Unexpected token'; - await test_read_json(file, key, '', false, err_msg); - }); - - async function test_read_json(file, key, expected_output, expected_valid=true, expected_err='') { - const command = `${read_json} "${file}" "${key}"`; - const expected_rc = expected_valid ? 0 : 1; - await test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_output, expected_err); - } - }); - - async function test_file_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr) { - await sshHelper.testCommand(command, { - envs: { - 'ZOWE_ROOT_DIR': process.env.ZOWE_ROOT_DIR, - }, - sources: [ - //process.env.ZOWE_ROOT_DIR + '/bin/utils/file-utils.sh', - process.env.ZOWE_ROOT_DIR + '/bin/internal/prepare-environment.sh -c ' + process.env.ZOWE_INSTANCE_DIR + ' -r ' + process.env.ZOWE_ROOT_DIR, - ] - }, { - rc: expected_rc, - // Whilst printErrorMessage outputs to STDERR and STDOUT we need to expect the err in both - stdout: expected_stdout, - stderr: expected_stderr, - }); - } - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-install-iframe-plugin.js b/tests/sanity/test/utils-scripts/test-install-iframe-plugin.js deleted file mode 100644 index 0627a5ba5d..0000000000 --- a/tests/sanity/test/utils-scripts/test-install-iframe-plugin.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -const sshHelper = require('../ssh-helper'); - -const install_iframe_script='zowe-install-iframe-plugin.sh'; -const install_iframe_path = `${process.env.ZOWE_ROOT_DIR}/bin/utils/${install_iframe_script}`; - - -describe(`verify ${install_iframe_script}`, function() { - - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - }); - - describe('validate that input is processed correctly', function() { - - const id = 'org.zowe.plugin.example'; - const short_name = 'Example plugin'; - const directory = '/zowe/component/plugin'; - const url = 'https://zowe.org:443/about-us/'; - const tile_image = '/zowe_plugin/artifacts/tile_image.png'; - - it('test legacy mode still works and defaults version to 1.0.0', async function() { - const parameters = `"${id}" "${short_name}" "${url}" "${directory}" "${tile_image}"`; - const expected = get_expected_output(id, short_name, url, directory, tile_image); - await test_install_iframe_has_expected_rc_stdout_stderr(parameters, 4, expected); - }); - - it('test no parameters prints usage correctly', async function() { - const parameters = ''; - const expected = missing_parameters_message(['i','s','u','d','t']); - await test_install_iframe_has_expected_rc_stdout_stderr(parameters, 1, expected); - }); - - it('test missing id prints error and usage correctly', async function() { - const parameters = `-s "${short_name}" -u "${url}" -d "${directory}" -t "${tile_image}"`; - const expected = missing_parameters_message(['i']); - await test_install_iframe_has_expected_rc_stdout_stderr(parameters, 1, expected); - }); - - const getopts_parameters = `-i "${id}" -s "${short_name}" -u "${url}" -d "${directory}" -t "${tile_image}"`; - it('test getopts mode works and defaults version to 1.0.0', async function() { - const expected = get_expected_output(id, short_name, url, directory, tile_image); - await test_install_iframe_has_expected_rc_stdout_stderr(getopts_parameters, 4, expected); - }); - - it('test getopts mode works with specified version', async function() { - const version = '3.1.4'; - const parameters_with_version = `${getopts_parameters} -v ${version}`; - const expected = get_expected_output(id, short_name, url, directory, tile_image, version); - await test_install_iframe_has_expected_rc_stdout_stderr(parameters_with_version, 4, expected); - }); - - function missing_parameters_message(missing_parms) { - const missing_parameters = missing_parms.map(function (flag) { - return `-${flag}`; - }).join(' '); - - return `Some required parameters were not supplied: ${missing_parameters} -Usage: ${install_iframe_path} -i -s -u -d -t [-v ] - eg. ${install_iframe_path} -i "org.zowe.plugin.example" -s "Example plugin" -u "https://zowe.org:443/about-us/" -d "/zowe/component/plugin" -t "/zowe_plugin/artifacts/tile_image.png" -v "1.0.0"`; - } - - function get_expected_output(id, short_name, url, directory, tile_image, version = '1.0.0') { - return `i:${id} s:"${short_name}" u:${url} d:${directory} t:${tile_image} v:[${version}]`; - } - }); - - async function test_install_iframe_has_expected_rc_stdout_stderr(parameters, expected_rc, expected_stdout) { - await sshHelper.testCommand(`${install_iframe_path} -z ${parameters}`, {}, { - rc: expected_rc, - stdout: expected_stdout, - stderr: '', - }, true); - } - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-java-utils.js b/tests/sanity/test/utils-scripts/test-java-utils.js deleted file mode 100644 index a49c06239d..0000000000 --- a/tests/sanity/test/utils-scripts/test-java-utils.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -const sshHelper = require('../ssh-helper'); - - -describe('verify java-utils', function() { - - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - }); - - let start_path, start_java_home; - before('get required parameters', async function() { - start_path = await sshHelper.executeCommandWithNoError('echo $PATH'); - start_java_home = await sshHelper.executeCommandWithNoError('echo $JAVA_HOME'); - }); - - const ensure_java_is_on_path = 'ensure_java_is_on_path'; - describe(`verify ${ensure_java_is_on_path}`, function() { - - it('test java added to path if required', async function() { - const java_home = '/junk_path1/java'; - await test_java_added_to_path(java_home, true); - }); - - it('test java added to path if bin missing', async function() { - const path_pre_addition = '/junk_path2/java'; - const java_home = '/junk_path2/java'; - await test_java_added_to_path(java_home, true, path_pre_addition); - }); - - it('test java not added to path if already there', async function() { - const path_pre_addition = '/junk_path3/java/bin'; - const java_home = '/junk_path3/java'; - await test_java_added_to_path(java_home, false, path_pre_addition); - }); - - async function test_java_added_to_path(java_home, expected_addition, path_pre_addition = '') { - let command = path_pre_addition === '' ? '' : `export PATH=$PATH:${path_pre_addition} && `; - command += `export JAVA_HOME=${java_home} && ${ensure_java_is_on_path}`; - const expected_out = expected_addition ? 'Prepending JAVA_HOME/bin to the PATH...' : ''; - await test_java_utils_function_has_expected_rc_stdout_stderr(command, 0, expected_out, ''); - } - }); - - const validate_java_home = 'validate_java_home'; - describe(`verify ${validate_java_home}`, function() { - - it('test empty java home throws error', async function() { - const java_home = ''; - await test_validate_java_home(java_home, 1, '', 'JAVA_HOME is empty'); - }); - - it('test junk java home throws error', async function() { - const java_home = '/junk/'; - await test_validate_java_home(java_home, 1, '', `JAVA_HOME: ${java_home}/bin does not point to a valid install of Java`); - }); - - describe('java -version error caught with dummy java', async function() { - const rc = 13; - const error = 'This is not a real java version'; - let temp_dir, java_home; - before('create dummy java', async function() { - temp_dir = '~/delete_1234'; - java_home = `${temp_dir}/java`; - await sshHelper.executeCommandWithNoError(`mkdir -p ${java_home}/bin && echo "echo ${error} 1>&2\nexit ${rc}" > ${java_home}/bin/java && chmod u+x ${java_home}/bin/java`); - }); - - after('dispose dummy java', async function() { - await sshHelper.executeCommandWithNoError(`rm -rf ${temp_dir}`); - }); - - it('test java home with incorrect bin/java throws error', async function() { - const expected_err = `Java version check failed with return code: ${rc}, error: ${error}`; - await test_validate_java_home(java_home, 1, expected_err, expected_err); - }); - }); - - async function test_validate_java_home(java_home, expected_rc, expected_stdout, expected_stderr) { - const command = `export JAVA_HOME=${java_home} && ${validate_java_home}`; - await test_java_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr); - } - }); - - const check_java_version = 'check_java_version'; - describe(`verify ${check_java_version}`, function() { - - it('test 6.0 fails', async function() { - const java_version_string = 'java version "1.6.0"'; - await test_java_version(java_version_string, '1.6.0', false); - }); - - it('test 7.0 fails', async function() { - const java_version_string = 'java version "1.7.0"'; - await test_java_version(java_version_string, '1.7.0', false); - }); - - it('test Java 8.0 passes', async function() { - const java_version_string = 'java version "1.8.0_231"'; - await test_java_version(java_version_string, '1.8.0_231', true); - }); - - async function test_java_version(version_output, expected_version, expected_valid) { - const command = `${check_java_version} "${version_output}"`; - const expected_rc = expected_valid ? 0 : 1; - const expected_out = expected_valid ? `Java version ${expected_version} is supported` : ''; - const expected_err = expected_valid ? '' : `Java Version ${expected_version} is less than the minimum level required of Java 8 (1.8.0)`; - await test_java_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_out, expected_err); - } - }); - - async function test_java_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr) { - await sshHelper.testCommand(command, { - envs: { - 'ZOWE_ROOT_DIR': process.env.ZOWE_ROOT_DIR, - }, - sources: [ - process.env.ZOWE_ROOT_DIR + '/bin/utils/java-utils.sh', - ] - }, { - rc: expected_rc, - // Whilst printErrorMessage outputs to STDERR and STDOUT we need to expect the err in both - stdout: expected_stderr || expected_stdout, - stderr: expected_stderr, - }); - } - - after('restore env', async function() { - await sshHelper.executeCommandWithNoError(`export PATH=${start_path}`); - await sshHelper.executeCommandWithNoError(`export JAVA_HOME=${start_java_home}`); - }); - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-network-utils.js b/tests/sanity/test/utils-scripts/test-network-utils.js deleted file mode 100644 index f7920249ba..0000000000 --- a/tests/sanity/test/utils-scripts/test-network-utils.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -const expect = require('chai').expect; -const sshHelper = require('../ssh-helper'); - - -describe('verify network-utils', function() { - - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - }); - - before('verify environment variables', function() { - expect(process.env.ZOSMF_PORT, 'ZOSMF_PORT is not defined').to.not.be.empty; - }); - - let unbound_port = 1; - before('find unbound port', async function() { - let found_unbound = false; - while (! found_unbound && unbound_port <= 65535) { - const report = await sshHelper.executeCommandWithNoError(`netstat -P ${unbound_port}`); - if (report.split(/\r?\n/).length <= 3) { - // netstat report of format: - // MVS TCP/IP NETSTAT CS V2R3 TCPIP Name: TCPIP 11:49:59 - // User Id Conn State - // ------- ---- ----- - found_unbound = true; - } else { - unbound_port++; - } - } - }); - - const is_port_available = 'is_port_available'; - describe(`verify ${is_port_available}`, function() { - - it('test zosmf port is not available', async function() { - await test_port_available(process.env.ZOSMF_PORT, 'IZUSVR1'); - }); - - it('test unbound port is available', async function() { - await test_port_available(unbound_port); - }); - - async function test_port_available(port, expected_process = undefined) { - let command = `${is_port_available} ${port}`; - const expected_rc = expected_process ? 1 : 0; - const expected_err = expected_process ? `Port ${port} is already in use by process (${expected_process}` : ''; - await test_network_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, '', expected_err); - } - }); - - const validate_host_is_resolvable = 'validate_host_is_resolvable'; - describe(`verify ${validate_host_is_resolvable}`, function() { - - it('test ssh host is resolvable', async function() { - const variable_name = 'ssh_host'; - const command = `export ${variable_name}="${process.env.SSH_HOST}" && ${validate_host_is_resolvable} "${variable_name}"`; - await test_network_utils_function_has_expected_rc_stdout_stderr(command, 0, '', ''); - }); - - it('test unset host port is not resolvable', async function() { - const variable_name = 'test_unset_variable'; - const command = `${validate_host_is_resolvable} "${variable_name}"`; - const expected_err = `${variable_name} is empty`; - await test_network_utils_function_has_expected_rc_stdout_stderr(command, 1, '', expected_err); - }); - - it('test junk host port is not resolvable', async function() { - const variable_name = 'a_host'; - const variable_value = 'http://www.rubbish.junk'; - const command = `export ${variable_name}="${variable_value}" && ${validate_host_is_resolvable} "${variable_name}"`; - const expected_err = `${variable_name} '${variable_value}' does not resolve`; - await test_network_utils_function_has_expected_rc_stdout_stderr(command, 1, '', expected_err); - }); - - }); - - async function test_network_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr) { - await sshHelper.testCommand(command, { - envs: { - 'ZOWE_ROOT_DIR': process.env.ZOWE_ROOT_DIR, - }, - sources: [ - process.env.ZOWE_ROOT_DIR + '/bin/utils/network-utils.sh', - ] - }, { - rc: expected_rc, - // Whilst printErrorMessage outputs to STDERR and STDOUT we need to expect the err in both - stdout: expected_stderr || expected_stdout, - stderr: expected_stderr, - }); - } - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-node-utils.js b/tests/sanity/test/utils-scripts/test-node-utils.js deleted file mode 100644 index 3f30b19894..0000000000 --- a/tests/sanity/test/utils-scripts/test-node-utils.js +++ /dev/null @@ -1,202 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -const sshHelper = require('../ssh-helper'); - - -describe('verify node-utils', function () { - - before('prepare SSH connection', async function () { - await sshHelper.prepareConnection(); - }); - - let start_path, start_node_home; - before('get required parameters', async function () { - start_path = await sshHelper.executeCommandWithNoError('echo $PATH'); - start_node_home = await sshHelper.executeCommandWithNoError('echo $NODE_HOME'); - }); - - const ensure_node_is_on_path = 'ensure_node_is_on_path'; - describe(`verify ${ensure_node_is_on_path}`, function () { - - it('test node added to path if required', async function () { - const node_home = '/junk_path1/node'; - await test_node_added_to_path(node_home, true); - }); - - it('test node added to path if bin missing', async function () { - const path_pre_addition = '/junk_path2/node'; - const node_home = '/junk_path2/node'; - await test_node_added_to_path(node_home, true, path_pre_addition); - }); - - it('test node not added to path if already there', async function () { - const path_pre_addition = '/junk_path3/node/bin'; - const node_home = '/junk_path3/node'; - await test_node_added_to_path(node_home, false, path_pre_addition); - }); - - async function test_node_added_to_path(node_home, expected_addition, path_pre_addition = '') { - let command = path_pre_addition === '' ? '' : `export PATH=$PATH:${path_pre_addition} && `; - command += `export NODE_HOME=${node_home} && ${ensure_node_is_on_path}`; - const expected_out = expected_addition ? 'Prepending NODE_HOME/bin to the PATH...' : ''; - await test_node_utils_function_has_expected_rc_stdout_stderr(command, 0, expected_out, ''); - } - }); - - const validate_node_home = 'validate_node_home'; - describe(`verify ${validate_node_home}`, function () { - - it('test empty node home throws error', async function () { - const node_home = ''; - await test_validate_node_home(node_home, 1, '', 'NODE_HOME is empty'); - }); - - it('test junk node home throws error', async function () { - const node_home = '/junk/'; - await test_validate_node_home(node_home, 1, '', `NODE_HOME: ${node_home}/bin does not point to a valid install of Node`); - }); - - describe('node --version error caught with dummy node', async function () { - const rc = 13; - const error = 'This is not a real node version'; - let temp_dir, node_home; - before('create dummy node', async function () { - temp_dir = '~/delete_1234'; - node_home = `${temp_dir}/node`; - await sshHelper.executeCommandWithNoError(`mkdir -p ${node_home}/bin && echo "echo ${error} 1>&2\nexit ${rc}" > ${node_home}/bin/node && chmod u+x ${node_home}/bin/node`); - }); - - after('dispose dummy node', async function () { - await sshHelper.executeCommandWithNoError(`rm -rf ${temp_dir}`); - }); - - it('test node home with incorrect bin/node throws error', async function () { - const expected_err = `Node version check failed with return code: ${rc}, error: ${error}`; - await test_validate_node_home(node_home, 1, expected_err, expected_err); - }); - }); - - // I don't think we can rely on a system to have a valid node home of the right version, so skip for now - it.skip('test real node home okay', async function () { - await test_validate_node_home(start_node_home, 0, 'OK: Node is working\nOK: Node is at a supported version', ''); - }); - - async function test_validate_node_home(node_home, expected_rc, expected_stdout, expected_stderr) { - const command = `export NODE_HOME=${node_home} && ${validate_node_home}`; - await test_node_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr); - } - }); - - const check_node_version = 'check_node_version'; - describe(`verify ${check_node_version}`, function () { - - it('test pre-v8 (v4.0.0) fails', async function () { - await test_node_version('v4.0.0', false); - }); - - it('test pre-v8 (v6.13.1) fails', async function () { - await test_node_version('v6.13.1', false); - }); - - it('test pre-v8 (v6.14.3) fails', async function () { - await test_node_version('v6.14.3', false); - }); - - it('test pre-v8 (v6.17.0) fails', async function () { - await test_node_version('v6.17.0', false); - }); - - it('test v8.16.1 fails with special message', async function () { - const command = `${check_node_version} "v8.16.1"`; - const expected_err = 'Node v8.16.1 specifically is not compatible with Zowe. Please use a different version. See https://docs.zowe.org/stable/troubleshoot/app-framework/app-known-issues.html#desktop-apps-fail-to-load for more details.'; - await test_node_utils_function_has_expected_rc_stdout_stderr(command, 1, expected_err, expected_err); - }); - - it('test v8.17.0 issues warning', async function () { - const command = `${check_node_version} "v8.17.0"`; - const expected_rc = 0; - let expected_out = 'Deprecation Warning: Zowe will be ending support for Node v8 by the end of December 2021.'; - await test_node_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_out, ''); - }); - - it('test v12.13.0 passes', async function () { - await test_node_version('v12.13.0', true); - }); - - it('test v12.16.1 passes', async function () { - await test_node_version('v12.16.1', true); - }); - - it('test v14.17.2 fails with special message', async function () { - const command = `${check_node_version} "v14.17.2"`; - const expected_err = 'Node v14.17.2 specifically is not compatible with Zowe. Please use a different version. See https://docs.zowe.org/stable/troubleshoot/app-framework/app-known-issues.html#desktop-apps-fail-to-load for more details.'; - await test_node_utils_function_has_expected_rc_stdout_stderr(command, 1, expected_err, expected_err); - }); - - async function test_node_version(version, expected_valid) { - const command = `${check_node_version} "${version}"`; - const expected_rc = expected_valid ? 0 : 1; - const expected_out = expected_valid ? `Node ${version} is supported.` : ''; - const expected_err = expected_valid ? '' : `Node ${version} is less than the minimum level required of v8+`; - await test_node_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_out, expected_err); - } - }); - - const check_node_functional = 'check_node_functional'; - describe(`verify ${check_node_functional}`, function () { - - let home_dir, temp_dir, node_home; - before('create dummy node', async function () { - home_dir = await sshHelper.executeCommandWithNoError('echo $HOME'); - temp_dir = `${home_dir}/delete_1234`; - node_home = `${temp_dir}/node`; - await sshHelper.executeCommandWithNoError(`mkdir -p ${node_home}/bin && touch ${node_home}/bin/node && chmod u+x ${node_home}/bin/node`); - }); - - after('dispose dummy node', async function () { - await sshHelper.executeCommandWithNoError(`rm -rf ${temp_dir}`); - }); - - it('test node home with incorrect bin/node throws error', async function () { - await test_check_node_functional(node_home, 1, `NODE_HOME: ${node_home}/bin/node is not functioning correctly:`); - }); - - async function test_check_node_functional(node_home, expected_rc, expected_stderr) { - const command = `export NODE_HOME=${node_home} && ${check_node_functional}`; - await test_node_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stderr, expected_stderr); - } - }); - - async function test_node_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr) { - await sshHelper.testCommand(command, { - envs: { - 'ZOWE_ROOT_DIR': process.env.ZOWE_ROOT_DIR, - }, - sources: [ - process.env.ZOWE_ROOT_DIR + '/bin/utils/node-utils.sh', - ] - }, { - rc: expected_rc, - // Whilst printErrorMessage outputs to STDERR and STDOUT we need to expect the err in both - stdout: expected_stderr || expected_stdout, - stderr: expected_stderr, - }); - } - - after('restore env', async function () { - await sshHelper.executeCommandWithNoError(`export PATH=${start_path}`); - await sshHelper.executeCommandWithNoError(`export NODE_HOME=${start_node_home}`); - }); - - after('dispose SSH connection', function () { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-utils.js b/tests/sanity/test/utils-scripts/test-utils.js deleted file mode 100644 index d55b038316..0000000000 --- a/tests/sanity/test/utils-scripts/test-utils.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -const expect = require('chai').expect; -const sshHelper = require('../ssh-helper'); - -describe('verify utils', function() { - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - }); - - before('verify environment variables', function() { - expect(process.env.ZOSMF_PORT, 'ZOSMF_PORT is not defined').to.not.be.empty; - }); - - let home_dir; - before('get required parameters', async function() { - home_dir = await sshHelper.executeCommandWithNoError('echo $HOME'); - }); - - it('test we can access function from zowe-variable-utils', async function() { - const variable_name = 'test_unset_variable'; - const command = `is_variable_set "${variable_name}" "\${${variable_name}}"`; - await test_utils_function_has_expected_rc_stdout_stderr(command, 1, '', `${variable_name} is empty`); - }); - - it('test we can access function from file-utils', async function() { - const input = '~/test'; - const expected_out = home_dir + '/test'; - const command = `get_full_path "${input}"`; - await test_utils_function_has_expected_rc_stdout_stderr(command, 0, expected_out, ''); - }); - - it('test we can access function from network-utils', async function() { - let command = `is_port_available ${process.env.ZOSMF_PORT}`; - const expected_err = `Port ${process.env.ZOSMF_PORT} is already in use by process (IZUSVR1`; - await test_utils_function_has_expected_rc_stdout_stderr(command, 1, '', expected_err); - }); - - async function test_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr) { - await sshHelper.testCommand(command, { - envs: { - 'ZOWE_ROOT_DIR': process.env.ZOWE_ROOT_DIR, - }, - sources: [ - process.env.ZOWE_ROOT_DIR + '/bin/utils/utils.sh', - ] - }, { - rc: expected_rc, - // Whilst printErrorMessage outputs to STDERR and STDOUT we need to expect the err in both - stdout: expected_stderr || expected_stdout, - stderr: expected_stderr, - }); - } - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-zosmf-utils.js b/tests/sanity/test/utils-scripts/test-zosmf-utils.js deleted file mode 100644 index 589def49ed..0000000000 --- a/tests/sanity/test/utils-scripts/test-zosmf-utils.js +++ /dev/null @@ -1,143 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -const expect = require('chai').expect; -const sshHelper = require('../ssh-helper'); - - -describe('verify zosmf-utils', function() { - - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - }); - - before('verify environment variables', function() { - expect(process.env.ZOSMF_PORT, 'ZOSMF_PORT is not defined').to.not.be.empty; - }); - - const get_zosmf_port = 'get_zosmf_port'; - describe(`verify ${get_zosmf_port}`, function() { - - it('test that we get the correct port', async function() { - const command = `${get_zosmf_port} && echo "\${ZOWE_ZOSMF_PORT}"`; - await test_zosmf_utils_function_has_expected_rc_stdout_stderr(command, 0, process.env.ZOSMF_PORT, ''); - }); - }); - - const extract_zosmf_port = 'extract_zosmf_port'; - describe(`verify ${extract_zosmf_port}`, function() { - - it('test that we get the correct port given a list of 1', async function() { - const port_list = process.env.ZOSMF_PORT; - await test_extract_zosmf_port(port_list, 0, process.env.ZOSMF_PORT, ''); - }); - - // a good NODE_HOME isn't available to the test at this point, so we can't get this to go into the correct if block. Tested manually - it.skip('test that we get the correct port given a list of 3 and a host', async function() { - const port_list = `2020 -${process.env.ZOSMF_PORT} -80`; - await test_extract_zosmf_port(port_list, 0, process.env.ZOSMF_PORT, '', process.env.SSH_HOST); - }); - - it('test that we return non-zero given a list of 2 and no host', async function() { - const port_list = `2020 -${process.env.ZOSMF_PORT}`; - await test_extract_zosmf_port(port_list, 1, '', ''); - }); - - it('test that we return non-zero given a list of 0', async function() { - const port_list = ''; - await test_extract_zosmf_port(port_list, 1, '', ''); - }); - - async function test_extract_zosmf_port(port_list, expected_rc, expected_stdout, expected_stderr, zosmf_host = '') { - const command = `export ZOSMF_HOST=${zosmf_host} && ${extract_zosmf_port} "${port_list}" && echo "\${ZOWE_ZOSMF_PORT}"`; - await test_zosmf_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr, true); - } - }); - - const validate_zosmf_host_and_port = 'validate_zosmf_host_and_port'; - describe(`verify ${validate_zosmf_host_and_port}`, function() { - - let start_node_home; - before('get required parameters', async function() { - start_node_home = await sshHelper.executeCommandWithNoError('echo $NODE_HOME'); - }); - - after('restore env', async function() { - await sshHelper.executeCommandWithNoError(`export NODE_HOME=${start_node_home}`); - }); - - it('test empty zosmf_host throws error', async function() { - await test_validate_zosmf_host_and_port('', process.env.ZOSMF_PORT, 1, '', 'The z/OSMF host was not set'); - }); - - it('test empty zosmf_port throws error', async function() { - await test_validate_zosmf_host_and_port(process.env.SSH_HOST, '', 1, '', 'The z/OSMF port was not set'); - }); - - it('test empty node home logs a warning', async function() { - const pre_command = 'export NODE_HOME= &&'; - const expected_std_out = `Warning: Could not validate if z/OS MF is available on 'https://${process.env.SSH_HOST}:${process.env.ZOSMF_PORT}/zosmf/info'`; - await test_validate_zosmf_host_and_port(process.env.SSH_HOST, process.env.ZOSMF_PORT, 0, expected_std_out, '', pre_command); - }); - - async function test_validate_zosmf_host_and_port(zosmf_host, zosmf_port, expected_rc, expected_stdout, expected_stderr, pre_command = '') { - const command = `${pre_command} ${validate_zosmf_host_and_port} "${zosmf_host}" "${zosmf_port}"`; - await test_zosmf_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr); - } - }); - - const check_zosmf_info_response_code = 'check_zosmf_info_response_code'; - describe(`verify ${check_zosmf_info_response_code}`, function() { - - it('test empty https_response_code logs a warning', async function() { - const expected_std_out = `Warning: Could not validate if z/OS MF is available on 'https://${process.env.SSH_HOST}:${process.env.ZOSMF_PORT}/zosmf/info'`; - await test_validate_zosmf_host_and_port('', 0, expected_std_out, ''); - }); - - it('test https_response_code 200 succeeds', async function() { - const expected_stdout = `Successfully checked z/OS MF is available on 'https://${process.env.SSH_HOST}:${process.env.ZOSMF_PORT}/zosmf/info'`; - await test_validate_zosmf_host_and_port('200', 0, expected_stdout, ''); - }); - - it('test https_response_code 500 prints error', async function() { - const http_response_code = 500; - const expected_stderr = `Could not contact z/OS MF on 'https://${process.env.SSH_HOST}:${process.env.ZOSMF_PORT}/zosmf/info' - ${http_response_code}`; - await test_validate_zosmf_host_and_port(http_response_code, 1, '', expected_stderr); - }); - - async function test_validate_zosmf_host_and_port(http_response_code, expected_rc, expected_stdout, expected_stderr) { - const command = `${check_zosmf_info_response_code} ${process.env.SSH_HOST} ${process.env.ZOSMF_PORT} ${http_response_code}`; - await test_zosmf_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr); - } - }); - - async function test_zosmf_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr, exact_match = false) { - await sshHelper.testCommand(command, { - envs: { - 'ZOWE_ROOT_DIR': process.env.ZOWE_ROOT_DIR, - }, - sources: [ - process.env.ZOWE_ROOT_DIR + '/bin/utils/zosmf-utils.sh', - ] - }, { - rc: expected_rc, - // Whilst printErrorMessage outputs to STDERR and STDOUT we need to expect the err in both - stdout: expected_stderr || expected_stdout, - stderr: expected_stderr, - }, exact_match); - } - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/tests/sanity/test/utils-scripts/test-zowe-variable-utils.js b/tests/sanity/test/utils-scripts/test-zowe-variable-utils.js deleted file mode 100644 index 8bb1057f2f..0000000000 --- a/tests/sanity/test/utils-scripts/test-zowe-variable-utils.js +++ /dev/null @@ -1,180 +0,0 @@ -/** - * 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 IBM Corporation 2020 - */ - -const sshHelper = require('../ssh-helper'); - - -describe('verify zowe-variable-utils', function() { - - before('prepare SSH connection', async function() { - await sshHelper.prepareConnection(); - }); - - const is_variable_set = 'is_variable_set'; - describe(`verify ${is_variable_set}`, function() { - - it('test home env_var is set', async function() { - const input = 'HOME'; - await test_validate_variable_set(input, true); - }); - - it('test new variable is not set', async function() { - const variable_name = 'test_unset_variable'; - await test_validate_variable_set(variable_name, false); - }); - - it('test set variable is set', async function() { - const variable_name = 'test_set_variable'; - const command = `export ${variable_name}="true" && ${is_variable_set} "${variable_name}"`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, '', '', true); - }); - - async function test_validate_variable_set(variable_name, expected_valid) { - const command = `${is_variable_set} "${variable_name}"`; - const expected_rc = expected_valid ? 0 : 1; - const expected_err = expected_valid ? '' : `${variable_name} is empty`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, '', expected_err); - } - }); - - const are_variables_set = 'are_variables_set'; - describe(`verify ${are_variables_set}`, function() { - - it('test single set variable works', async function() { - const input = ['HOME']; - await test_validate_variables_set(input, []); - }); - - it('test one set and one unset variable gives a single error', async function() { - const variable_list = ['HOME', 'test_unset_variable']; - await test_validate_variables_set(variable_list, ['test_unset_variable']); - }); - - it('test two unset variable gives two errors', async function() { - const variable_list = ['test_unset_variable1', 'test_unset_variable2']; - await test_validate_variables_set(variable_list, variable_list); - }); - - async function test_validate_variables_set(variables_list, invalid_variables) { - const command = `${are_variables_set} "${variables_list.join()}"`; - const expected_rc = invalid_variables.length; - const error_list = invalid_variables.map((variable, index) => { - return `Error ${index}: ${variable} is empty`; - }); - const expected_err = error_list.join('\n'); - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, '', expected_err, true); - } - }); - - const validate_zowe_prefix = 'validate_zowe_prefix'; - describe(`verify ${validate_zowe_prefix}`, function() { - - it('test empty prefix validated false', async function() { - const command = `export ZOWE_PREFIX="" && ${validate_zowe_prefix}`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 1, '', 'ZOWE_PREFIX is empty'); - }); - - it('test variable length 2 is valid', async function() { - await test_validate_zowe_prefix('Z1', true); - }); - - it('test default variable is valid', async function() { - await test_validate_zowe_prefix('ZWE1', true); - }); - - it('test variable length 6 is valid', async function() { - await test_validate_zowe_prefix('ZWESJH', true); - }); - - it('test variable length 7 is not valid', async function() { - await test_validate_zowe_prefix('ZWE1234', false); - }); - - async function test_validate_zowe_prefix(prefix, expected_valid) { - const command = `export ZOWE_PREFIX=${prefix} && ${validate_zowe_prefix}`; - const expected_rc = expected_valid ? 0 : 1; - const expected_err = expected_valid ? '' : `ZOWE_PREFIX '${prefix}' should be less than 7 characters`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, '', expected_err); - } - }); - - const read_zowe_instance_variable = 'read_zowe_instance_variable'; - const update_zowe_instance_variable = 'update_zowe_instance_variable'; - describe(`verify ${update_zowe_instance_variable}`, function() { - - it('test append new zowe instance environment variable', async function() { - const command = `${update_zowe_instance_variable} TEST_INSTANCE_VAR test_value`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, '', '', true); - }); - - it('test validate new zowe instance environment variable appended', async function() { - const command = `${read_zowe_instance_variable} TEST_INSTANCE_VAR`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, 'test_value', '', true); - }); - - it('test append value into existing zowe instance environment variable', async function() { - const command = `${update_zowe_instance_variable} TEST_INSTANCE_VAR secondtest123 true`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, '', '', true); - }); - - it('test value appended into existing zowe instance environment variable', async function() { - const command = `${read_zowe_instance_variable} TEST_INSTANCE_VAR`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, 'test_value,secondtest123', '', true); - }); - - it('test append existing value', async function() { - const command = `${update_zowe_instance_variable} TEST_INSTANCE_VAR test_value true`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, '', '', true); - }); - - it('test validate no change in zowe instance environment variable', async function() { - const command = `${read_zowe_instance_variable} TEST_INSTANCE_VAR`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, 'test_value,secondtest123', '', true); - }); - - it('test replace value of a instance environment variable', async function() { - const command = `${update_zowe_instance_variable} TEST_INSTANCE_VAR replaced_value`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, '', '', true); - }); - - it('test validate value of environment variable has been replaced', async function() { - const command = `${read_zowe_instance_variable} TEST_INSTANCE_VAR`; - await test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, 0, 'replaced_value', '', true); - }); - - after('Clean up temporary instance variable', async function() { - await sshHelper.executeCommandWithNoError(`sed '$d' ${process.env.ZOWE_INSTANCE_DIR}/instance.env > ${process.env.ZOWE_INSTANCE_DIR}/instance.env.tmp`); - await sshHelper.executeCommandWithNoError(`mv ${process.env.ZOWE_INSTANCE_DIR}/instance.env.tmp ${process.env.ZOWE_INSTANCE_DIR}/instance.env`); - }); - }); - - - async function test_zowe_variable_utils_function_has_expected_rc_stdout_stderr(command, expected_rc, expected_stdout, expected_stderr, exact_match = false) { - await sshHelper.testCommand(command, { - envs: { - 'ZOWE_ROOT_DIR': process.env.ZOWE_ROOT_DIR, - 'INSTANCE_DIR': process.env.ZOWE_INSTANCE_DIR, - }, - sources: [ - process.env.ZOWE_ROOT_DIR + '/bin/utils/zowe-variable-utils.sh', - ] - }, { - rc: expected_rc, - // Whilst printErrorMessage outputs to STDERR and STDOUT we need to expect the err in both - stdout: expected_stderr || expected_stdout, - stderr: expected_stderr, - }, - exact_match); - } - - after('dispose SSH connection', function() { - sshHelper.cleanUpConnection(); - }); -}); diff --git a/workflows/files/ZWEWRF03.xml b/workflows/files/ZWEWRF03.xml index 081561a0eb..509349c733 100644 --- a/workflows/files/ZWEWRF03.xml +++ b/workflows/files/ZWEWRF03.xml @@ -80,13 +80,16 @@ Keep this variable empty if you do not want to copy the STC task. Comma separated list of components should start - Comma separated list of components should start + GATEWAY will start the API mediation layer which includes the API catalog, the API gateway, and the API discovery service. + DESKTOP will start the Zowe desktop which includes the browser GUI for hosting Zowe applications. It will also start ZSS. + ZSS will start the ZSS server without including the Desktop and Application Framework server. This can be used with Docker. Global Config - + GATEWAY DESKTOP GATEWAY,DESKTOP + ZSS GATEWAY,DESKTOP diff --git a/workflows/files/ZWEWRF05.xml b/workflows/files/ZWEWRF05.xml index 1a0903a74e..beb661e785 100644 --- a/workflows/files/ZWEWRF05.xml +++ b/workflows/files/ZWEWRF05.xml @@ -174,12 +174,12 @@ and that will be also used to secure newly generated keystores for API Mediation Run this step to initialize variable values 1 - false + true false New Custom zowe-setup-certificates.env - Creates new zowe-setup-certificates.env in user specified location adn substitutes values + Creates new zowe-setup-certificates.env in user specified location and substitutes values This step creates zowe-setup-certificates.env and substitutes variables 1