Skip to content

Commit 49a904e

Browse files
Merge pull request #272 from zowe/v3-staging
Make Server Install wizard download with Zowe V3 and V2
2 parents 97577d3 + a08729d commit 49a904e

25 files changed

+209
-105
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Please delete options that are not relevant.
1919
## PR Checklist
2020
Please delete options that are not relevant.
2121
- [ ] If the changes in this PR are meant for the next release / mainline, this PR targets a "staging" branch.
22-
- [ ] My code follows the style guidelines of this project (see: [Contributing guideline](https://github.com/zowe/zen/blob/v2.x/staging/CONTRIBUTING.md))
22+
- [ ] My code follows the style guidelines of this project (see: [Contributing guideline](https://github.com/zowe/zen/blob/v3.x/staging/CONTRIBUTING.md))
2323
- [ ] I have commented my code, particularly in hard-to-understand areas
2424
- [ ] I have made corresponding changes to the documentation
2525
- [ ] New and existing unit tests pass locally with my changes

.github/workflows/build_test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ name: Build zen
22
on:
33
push:
44
branches:
5-
- v2.x/main
6-
- v2.x/staging
5+
- v3.x/staging
76

87
pull_request:
98
types: [opened, reopened, synchronize]

.github/workflows/test-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Lint TypeScript
33
on:
44
push:
55
branches:
6-
- v2.x/staging
6+
- v3.x/staging
77
pull_request:
88
types: [opened, reopened, synchronize]
99

playwright_test/README.MD

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ Example command:
4141
JOB_PREFIX=ZWE \
4242
JAVA_HOME=/path/to/java \
4343
NODE_HOME=/path/to/node \
44-
DATASET_PREFIX=IBMUSER.ZWEV2 \
44+
DATASET_PREFIX=IBMUSER.ZWEV3 \
4545
PROC_LIB=USER.PROCLIB \
46-
PARM_LIB=IBMUSER.ZWEV2.CUST.PARMLIB \
47-
JCL_LIB=IBMUSER.ZWEV2.CUST.PARMLIB \
48-
LOAD_LIB=IBMUSER.ZWEV2.SZWELOAD \
49-
AUTH_LOAD_LIB=IBMUSER.ZWEV2.SZWEAUTH \
50-
AUTH_PLUGIN_LIB=IBMUSER.ZWEV2.CUST.ZWESAPL \
46+
PARM_LIB=IBMUSER.ZWEV3.CUST.PARMLIB \
47+
JCL_LIB=IBMUSER.ZWEV3.CUST.PARMLIB \
48+
LOAD_LIB=IBMUSER.ZWEV3.SZWELOAD \
49+
AUTH_LOAD_LIB=IBMUSER.ZWEV3.SZWEAUTH \
50+
AUTH_PLUGIN_LIB=IBMUSER.ZWEV3.CUST.ZWESAPL \
5151
SECURITY_ADMIN=ZWEADMIN \
5252
SECURITY_SYSPROG=ZWEADMIN \
5353
SECURITY_STC=ZWEADMIN \

src/actions/InstallationHandler.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { ConfigurationStore } from '../storage/ConfigurationStore';
2020
import { InstallationArgs } from '../types/stateInterfaces';
2121
import { FALLBACK_SCHEMA, deepMerge } from '../renderer/components/common/Utils';
2222
import { updateSchemaReferences } from '../services/ResolveRef';
23+
import { PlanningActions } from './PlanningActions';
2324

2425
class Installation {
2526

@@ -219,8 +220,14 @@ class Installation {
219220
}
220221

221222
let download, upload, unpax;
222-
if(installationArgs.installationType === "download"){
223-
console.log("downloading...", version);
223+
if(installationArgs.installationType === "downloadV2" || installationArgs.installationType === "downloadV3"){
224+
if (installationArgs.installationType === "downloadV2") {
225+
await PlanningActions.getZoweFullVersion(2).then(async (res: IResponse) => { // Retrieve full Zowe version from user selection
226+
version = res.details;
227+
});
228+
await PlanningActions.setZoweMajorVersion(2); // Update as Wizard's UI will begin relying on this
229+
} // else: Zowe Version 3, which was set as default already
230+
console.log("Starting " + installationArgs.installationType.toString() + "...", version);
224231
download = await this.downloadPax(version);
225232
ProgressStore.set('downloadUnpax.download', download.status);
226233
} else {
@@ -238,8 +245,8 @@ class Installation {
238245
//upload the PAX the user selected in the "Install Type" stage to the installation dir (from the planning stage)
239246
console.log('Uploading user selected pax from ', installationArgs.userUploadedPaxPath)
240247
upload = await new FileTransfer().upload(connectionArgs, installationArgs.userUploadedPaxPath, path.join(installationArgs.installationDir, "zowe.pax"), DataType.BINARY)
241-
} else if (installationArgs.installationType === "download"){
242-
console.log('Uploading pax downloaded from jfrog')
248+
} else if (installationArgs.installationType === "downloadV2" || installationArgs.installationType === "downloadV3"){
249+
console.log('Uploading pax downloaded from jfrog');
243250
upload = await this.uploadPax(connectionArgs, installationArgs.installationDir);
244251
}
245252
ProgressStore.set('downloadUnpax.upload', upload.status);

src/actions/PlanningActions.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import { ConfigurationStore } from "../storage/ConfigurationStore";
1717
import { parse } from 'yaml';
1818
import * as https from 'https';
1919
import { checkDirExists, makeDir } from '../services/ServiceUtils'
20+
import { DEF_ZOWE_MAJOR_VERS } from "../renderer/components/common/Utils";
21+
import { ProgressStore } from "../storage/ProgressStore";
2022

2123
export class PlanningActions {
2224

@@ -51,9 +53,10 @@ export class PlanningActions {
5153
}
5254
}
5355

54-
public static getExampleZowe(): Promise<IResponse> {
56+
// majorVers optional or def to DEF_ZOWE_MAJOR_VERS
57+
public static getExampleZowe(majorVersion?: number): Promise<IResponse> {
5558
return new Promise((resolve, reject) => {
56-
https.get('https://raw.githubusercontent.com/zowe/zowe-install-packaging/v3.x/master/example-zowe.yaml', (res) => {
59+
https.get(`https://raw.githubusercontent.com/zowe/zowe-install-packaging/v${majorVersion || DEF_ZOWE_MAJOR_VERS}.x/master/example-zowe.yaml`, (res) => {
5760
let data = '';
5861

5962
res.on('data', (chunk) => {
@@ -75,9 +78,10 @@ export class PlanningActions {
7578
});
7679
}
7780

78-
public static getZoweSchema(): Promise<IResponse> {
81+
// majorVers optional or def to DEF_ZOWE_MAJOR_VERS
82+
public static getZoweSchema(majorVersion?: number): Promise<IResponse> {
7983
return new Promise((resolve, reject) => {
80-
https.get('https://raw.githubusercontent.com/zowe/zowe-install-packaging/v3.x/master/schemas/zowe-yaml-schema.json', (res) => {
84+
https.get(`https://raw.githubusercontent.com/zowe/zowe-install-packaging/v${majorVersion || DEF_ZOWE_MAJOR_VERS}.x/master/schemas/zowe-yaml-schema.json`, (res) => {
8185
let data = '';
8286

8387
res.on('data', (chunk) => {
@@ -108,9 +112,10 @@ export class PlanningActions {
108112
}
109113
}
110114

111-
public static async getZoweVersion(): Promise<IResponse> {
115+
// majorVers optional or def to DEF_ZOWE_MAJOR_VERS
116+
public static async getZoweFullVersion(majorVersion?: number): Promise<IResponse> {
112117
return new Promise<IResponse>((resolve, reject) => {
113-
https.get('https://raw.githubusercontent.com/zowe/zowe-install-packaging/v3.x/master/manifest.json.template', (res) => {
118+
https.get(`https://raw.githubusercontent.com/zowe/zowe-install-packaging/v${majorVersion || DEF_ZOWE_MAJOR_VERS}.x/master/manifest.json.template`, (res) => {
114119
let data = '';
115120

116121
res.on('data', (chunk) => {
@@ -132,6 +137,15 @@ export class PlanningActions {
132137
});
133138
}
134139

140+
public static setZoweMajorVersion = (majorVersion: number): void => {
141+
ProgressStore.setZoweMajorVersion(majorVersion);
142+
}
143+
144+
public static getZoweMajorVersion = () : number => {
145+
const version = ProgressStore.getZoweMajorVersion();
146+
return version ? Number(version) : NaN;
147+
}
148+
135149
public static async setConfigByKeyAndValidate(key: string, value: string | Array<string>): Promise<IResponse> {
136150
const status = ConfigurationStore.setConfigByKeyAndValidate(key, value);
137151
return {status, details: ''};

src/main/index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,18 @@ const createWindow = (): void => {
159159
return res;
160160
});
161161

162-
ipcMain.handle('get-zowe-version', async () => {
163-
const res = await PlanningActions.getZoweVersion();
162+
ipcMain.handle('get-zowe-full-version', async (event, value?: number) => {
163+
const res = await PlanningActions.getZoweFullVersion(value);
164+
return res;
165+
});
166+
167+
ipcMain.handle('get-zowe-major-version', async () => {
168+
const res = await PlanningActions.getZoweMajorVersion();
169+
return res;
170+
});
171+
172+
ipcMain.handle('set-zowe-major-version', async (event, value: number) => {
173+
const res = await PlanningActions.setZoweMajorVersion(value);
164174
return res;
165175
});
166176

src/renderer/components/common/Utils.tsx

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const TYPE_OUTPUT = "output";
1818

1919
export const DEF_NO_OUTPUT = "No output to display."
2020
export const DEF_JOB_STATEMENT = `//ZWEJOB01 JOB IZUACCT,'SYSPROG',CLASS=A,\n// MSGLEVEL=(1,1),MSGCLASS=A`;
21+
export const DEF_ZOWE_MAJOR_VERS = "3";
2122

2223
export const CONNECTION_STAGE_LABEL = "Connection";
2324
export const PLANNING_STAGE_LABEL = "Planning";
@@ -57,9 +58,21 @@ export function isValidUSSPath(path: string): boolean {
5758
return validUSSRegex.test(path);
5859
}
5960

61+
export function doesUSSPathContain(parentLocation: string, compareLocation: string): boolean {
62+
if (!parentLocation || !compareLocation) return false;
63+
64+
// Remove trailing slashes
65+
const normalParent = parentLocation.replace(/\/+$/, '');
66+
const normalCompare = compareLocation.replace(/\/+$/, '');
67+
68+
// Ensure compareLocation is truly (not false positive) a subdirectory of parentLocation via "/"
69+
return normalCompare.startsWith(`${normalParent}/`);
70+
};
71+
72+
6073
export const SERVER_COMMON = {
6174
"$schema": "https://json-schema.org/draft/2019-09/schema",
62-
"$id": "https://zowe.org/schemas/v2/server-common",
75+
"$id": "https://zowe.org/schemas/v3/server-common",
6376
"title": "Common types",
6477
"description": "Configuration types that are common in Zowe and may be referenced by multiple components",
6578
"$defs": {
@@ -155,7 +168,7 @@ export const SERVER_COMMON = {
155168

156169
export const BASE_SCHEMA = {
157170
"$schema": "https://json-schema.org/draft/2019-09/schema",
158-
"$id": "https://zowe.org/schemas/v2/server-base",
171+
"$id": "https://zowe.org/schemas/v3/server-base",
159172
"title": "Zowe configuration file",
160173
"description": "Configuration file for Zowe (zowe.org) version 2.",
161174
"type": "object",
@@ -193,7 +206,7 @@ export const BASE_SCHEMA = {
193206
"description": "Holds Zowe PARMLIB members for plugins",
194207
"properties": {
195208
"zis": {
196-
"$ref": "/schemas/v2/server-common#zoweDatasetMember",
209+
"$ref": "/schemas/v3/server-common#zoweDatasetMember",
197210
"description": "PARMLIB member used by ZIS"
198211
}
199212
}
@@ -345,7 +358,7 @@ export const BASE_SCHEMA = {
345358
"description": "PKCS#12 keystore settings",
346359
"properties": {
347360
"directory": {
348-
"$ref": "/schemas/v2/server-common#zowePath",
361+
"$ref": "/schemas/v3/server-common#zowePath",
349362
"description": "Keystore directory"
350363
},
351364
"name": {
@@ -543,19 +556,19 @@ export const BASE_SCHEMA = {
543556
}
544557
},
545558
"runtimeDirectory": {
546-
"$ref": "/schemas/v2/server-common#zowePath",
559+
"$ref": "/schemas/v3/server-common#zowePath",
547560
"description": "Path to where you installed Zowe."
548561
},
549562
"logDirectory": {
550-
"$ref": "/schemas/v2/server-common#zowePath",
563+
"$ref": "/schemas/v3/server-common#zowePath",
551564
"description": "Path to where you want to store Zowe log files."
552565
},
553566
"workspaceDirectory": {
554-
"$ref": "/schemas/v2/server-common#zowePath",
567+
"$ref": "/schemas/v3/server-common#zowePath",
555568
"description": "Path to where you want to store Zowe workspace files. Zowe workspace are used by Zowe component runtime to store temporary files."
556569
},
557570
"extensionDirectory": {
558-
"$ref": "/schemas/v2/server-common#zowePath",
571+
"$ref": "/schemas/v3/server-common#zowePath",
559572
"description": "Path to where you want to store Zowe extensions. \"zwe components install\" will install new extensions into this directory."
560573
},
561574
"job": {
@@ -707,7 +720,7 @@ export const BASE_SCHEMA = {
707720
"type": "object",
708721
"properties": {
709722
"home": {
710-
"$ref": "/schemas/v2/server-common#zowePath",
723+
"$ref": "/schemas/v3/server-common#zowePath",
711724
"description": "Path to Java home directory."
712725
}
713726
}
@@ -716,7 +729,7 @@ export const BASE_SCHEMA = {
716729
"type": "object",
717730
"properties": {
718731
"home": {
719-
"$ref": "/schemas/v2/server-common#zowePath",
732+
"$ref": "/schemas/v3/server-common#zowePath",
720733
"description": "Path to node.js home directory."
721734
}
722735
}
@@ -817,7 +830,7 @@ export const BASE_SCHEMA = {
817830
"const": "PKCS12"
818831
},
819832
"file": {
820-
"$ref": "/schemas/v2/server-common#zowePath",
833+
"$ref": "/schemas/v3/server-common#zowePath",
821834
"description": "Path to your PKCS#12 keystore."
822835
},
823836
"password": {
@@ -842,7 +855,7 @@ export const BASE_SCHEMA = {
842855
"const": "PKCS12"
843856
},
844857
"file": {
845-
"$ref": "/schemas/v2/server-common#zowePath",
858+
"$ref": "/schemas/v3/server-common#zowePath",
846859
"description": "Path to your PKCS#12 keystore."
847860
},
848861
"password": {
@@ -858,24 +871,24 @@ export const BASE_SCHEMA = {
858871
"required": ["key", "certificate"],
859872
"properties": {
860873
"key": {
861-
"$ref": "/schemas/v2/server-common#zowePath",
874+
"$ref": "/schemas/v3/server-common#zowePath",
862875
"description": "Path to the certificate private key stored in PEM format."
863876
},
864877
"certificate": {
865-
"$ref": "/schemas/v2/server-common#zowePath",
878+
"$ref": "/schemas/v3/server-common#zowePath",
866879
"description": "Path to the certificate stored in PEM format."
867880
},
868881
"certificateAuthorities": {
869882
"description": "List of paths to the certificate authorities stored in PEM format.",
870883
"oneOf": [{
871-
"$ref": "/schemas/v2/server-common#zowePath",
884+
"$ref": "/schemas/v3/server-common#zowePath",
872885
"description": "Paths to the certificate authorities stored in PEM format. You can separate multiple certificate authorities by comma."
873886
},
874887
{
875888
"type": "array",
876889
"description": "Path to the certificate authority stored in PEM format.",
877890
"items": {
878-
"$ref": "/schemas/v2/server-common#zowePath"
891+
"$ref": "/schemas/v3/server-common#zowePath"
879892
}
880893
}
881894
]
@@ -1085,7 +1098,7 @@ export const BASE_SCHEMA = {
10851098
"type": "array",
10861099
"description": "The IP addresses which all of the Zowe servers will be binding on and listening to. Some servers may only support listening on the first element.",
10871100
"items": {
1088-
"$ref": "/schemas/v2/server-common#zoweIpv4"
1101+
"$ref": "/schemas/v3/server-common#zoweIpv4"
10891102
}
10901103
},
10911104
"vipaIp": {
@@ -1121,7 +1134,7 @@ export const BASE_SCHEMA = {
11211134
"description": "The location of the default registry for this handler. It could be a URL, path, dataset, whatever this handler supports"
11221135
},
11231136
"path": {
1124-
"$ref": "/schemas/v2/server-common#zowePath",
1137+
"$ref": "/schemas/v3/server-common#zowePath",
11251138
"description": "Unix file path to the configmgr-compatible JS file which implements the handler API"
11261139
}
11271140
}
@@ -1133,7 +1146,7 @@ export const BASE_SCHEMA = {
11331146
//this schema fixes ajv not resolving references properly
11341147
export const FALLBACK_SCHEMA = {
11351148
"$schema": "https://json-schema.org/draft/2019-09/schema",
1136-
"$id": "https://zowe.org/schemas/v2/server-base",
1149+
"$id": "https://zowe.org/schemas/v3/server-base",
11371150
"title": "Zowe configuration file",
11381151
"description": "Configuration file for Zowe (zowe.org) version 2.",
11391152
"type": "object",
@@ -2124,7 +2137,7 @@ export const FALLBACK_SCHEMA = {
21242137

21252138
//these two consts allow the whole schema to be validated
21262139
export const ajv2019 = new Ajv2019({schemas: [BASE_SCHEMA, SERVER_COMMON]}).addKeyword("$anchor")
2127-
export const schemaValidate = ajv2019.getSchema("https://zowe.org/schemas/v2/server-base")
2140+
export const schemaValidate = ajv2019.getSchema("https://zowe.org/schemas/v3/server-base")
21282141

21292142

21302143
export const ajv = new Ajv2019().addKeyword("$anchor").addSchema(SERVER_COMMON);
@@ -2187,17 +2200,17 @@ export const FALLBACK_YAML = {
21872200
"cookieIdentifier": "1",
21882201
"verifyCertificates": "STRICT",
21892202
"setup": {
2190-
"dataset": {
2191-
"authLoadlib": "IBMUSER.ZWEV2.SZWEAUTH",
2203+
"dataset": { // TODO: Dynamically switch `ZWE` with ZWEV2/ZWEV3 and re-run fallback<-->Wizard yaml obj init code during Downloading & .pax upload step
2204+
"authLoadlib": "IBMUSER.ZWE.SZWEAUTH",
21922205
"proclib": "USER.PROCLIB",
2193-
"authPluginLib": "IBMUSER.ZWEV2.CUST.ZWESAPL",
2194-
"prefix": "IBMUSER.ZWEV2",
2195-
"parmlib": "IBMUSER.ZWEV2.CUST.PARMLIB",
2196-
"loadlib": "IBMUSER.ZWEV2.SZWELOAD",
2206+
"authPluginLib": "IBMUSER.ZWE.CUST.ZWESAPL",
2207+
"prefix": "IBMUSER.ZWE",
2208+
"parmlib": "IBMUSER.ZWE.CUST.PARMLIB",
2209+
"loadlib": "IBMUSER.ZWE.SZWELOAD",
21972210
"parmlibMembers": {
21982211
"zis": "ZWESIP00"
21992212
},
2200-
"jcllib": "IBMUSER.ZWEV2.CUST.JCLLIB"
2213+
"jcllib": "IBMUSER.ZWE.CUST.JCLLIB"
22012214
},
22022215
"certificate": {
22032216
"type": "PKCS12",

0 commit comments

Comments
 (0)