Skip to content

Commit 479f7bd

Browse files
Merge branch 'master' of github.com:IBM/zowe-cli-cics-deploy-plugin into subtask-progress
2 parents b753059 + 6d76f1a commit 479f7bd

File tree

8 files changed

+180
-77
lines changed

8 files changed

+180
-77
lines changed

Jenkinsfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def UNIT_RESULTS = "${TEST_RESULTS_FOLDER}/unit"
6262
/**
6363
* The location of the system test results
6464
*/
65-
def SYSTEM_RESULTS = "${TEST_RESULTS_FOLDER}/system"
65+
def SYSTEM_RESULTS = "${TEST_RESULTS_FOLDER}/system"
6666

6767
/**
6868
* The name of the master branch
@@ -92,6 +92,10 @@ def ARTIFACTORY_CREDENTIALS_ID = "c8e3aa62-5eef-4e6b-8a3f-aa1006a7ef01"
9292
// much impossible to have conditional options based on the branch :/
9393
def opts = []
9494

95+
// Setup a schedule to run build periodically
96+
// Run a build at 2.00AM everyday
97+
def CRON_STRING = BRANCH_NAME == MASTER_BRANCH ? "H 2 * * *" : ""
98+
9599
if (RELEASE_BRANCHES.contains(BRANCH_NAME)) {
96100
// Only keep 20 builds
97101
opts.push(buildDiscarder(logRotator(numToKeepStr: '20')))
@@ -115,6 +119,10 @@ pipeline {
115119
skipDefaultCheckout true
116120
}
117121

122+
triggers {
123+
cron(CRON_STRING)
124+
}
125+
118126
environment {
119127
// Environment variable for flow control. Indicates if the git source was updated by the pipeline.
120128
GIT_SOURCE_UPDATED = "false"

__tests__/api/BundleDeploy/BundleDeployer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe("BundleDeployer01", () => {
127127
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementationOnce((session: any, jcl: string, parms: any) => {
128128
parms.task.statusMessage = "Waiting for JOB12345 to enter OUTPUT";
129129
parms.task.stageName = TaskStage.IN_PROGRESS;
130-
const expectedMsg = "Running DFHDPLOY (DEPLOY), job JOB12345";
130+
const expectedMsg = "Running DFHDPLOY (DEPLOY), jobid JOB12345";
131131
// wait 1.5 seconds
132132
return new Promise((resolve, reject) => {
133133
setTimeout(() => {

__tests__/api/BundleDeploy/__snapshots__/BundleDeployer.test.ts.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
exports[`BundleDeployer01 should complain if DFHDPLOY ends with an error 1`] = `"DFHRL2055I"`;
44

5-
exports[`BundleDeployer01 should complain if DFHDPLOY ends with an error 2`] = `"DFHDPLOY stopped processing for JOBID UNKNOWN due to an error."`;
5+
exports[`BundleDeployer01 should complain if DFHDPLOY ends with an error 2`] = `"DFHDPLOY stopped processing for jobid UNKNOWN due to an error."`;
66

7-
exports[`BundleDeployer01 should complain if SYSTSPRT not found 1`] = `"SYSTSPRT and JESMSGLG output from DFHDPLOY not found for JOBID UNKNOWN. Most recent status update: 'Submitting DFHDPLOY JCL for the DEPLOY action'."`;
7+
exports[`BundleDeployer01 should complain if SYSTSPRT not found 1`] = `"SYSTSPRT and JESMSGLG output from DFHDPLOY not found for jobid UNKNOWN. Most recent status update: 'Submitting DFHDPLOY JCL for the DEPLOY action'."`;
88

99
exports[`BundleDeployer01 should complain if cicshlq not found 1`] = `"Validation of --cicshlq dataset failed: Injected CICSHLQ error"`;
1010

@@ -16,7 +16,7 @@ exports[`BundleDeployer01 should complain if cpsmhlq not found2 1`] = `"EYU9ABSI
1616

1717
exports[`BundleDeployer01 should complain if status can't be determined 1`] = `" "`;
1818

19-
exports[`BundleDeployer01 should complain if status can't be determined 2`] = `"DFHDPLOY command completed for JOBID UNKNOWN, but status cannot be determined."`;
19+
exports[`BundleDeployer01 should complain if status can't be determined 2`] = `"DFHDPLOY command completed for jobid UNKNOWN, but status cannot be determined."`;
2020

2121
exports[`BundleDeployer01 should complain with missing zOSMF profile for deploy 1`] = `"Injected Create error"`;
2222

@@ -32,7 +32,7 @@ exports[`BundleDeployer01 should fail with overlong jobcard 1`] = `"--jobcard pa
3232

3333
exports[`BundleDeployer01 should failover to JESMSGLG if SYSTSPRT not found 1`] = `"undefined"`;
3434

35-
exports[`BundleDeployer01 should failover to JESMSGLG if SYSTSPRT not found 2`] = `"DFHDPLOY command completed in error for JOBID UNKNOWN without generating SYSTSPRT output."`;
35+
exports[`BundleDeployer01 should failover to JESMSGLG if SYSTSPRT not found 2`] = `"DFHDPLOY command completed in error for jobid UNKNOWN without generating SYSTSPRT output."`;
3636

3737
exports[`BundleDeployer01 should generate deploy JCL for AVAILABLE 1`] = `
3838
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
@@ -369,9 +369,9 @@ UNDEPLOY BUNDLE(12345678)
369369
"
370370
`;
371371

372-
exports[`BundleDeployer01 should handle failure during submitjobs processing 1`] = `"Failure occurred submitting DFHDPLOY JCL for JOBID UNKNOWN: 'Injected Submit error'. Most recent status update: 'Submitting DFHDPLOY JCL for the DEPLOY action'."`;
372+
exports[`BundleDeployer01 should handle failure during submitjobs processing 1`] = `"Failure occurred submitting DFHDPLOY JCL for jobid UNKNOWN: 'Injected Submit error'. Most recent status update: 'Submitting DFHDPLOY JCL for the DEPLOY action'."`;
373373

374-
exports[`BundleDeployer01 should include the JOBID in an error 1`] = `"Failure occurred submitting DFHDPLOY JCL for JOBID JOB12345: 'Injected submit error'. Most recent status update: 'Running DFHDPLOY (DEPLOY), job JOB12345'."`;
374+
exports[`BundleDeployer01 should include the JOBID in an error 1`] = `"Failure occurred submitting DFHDPLOY JCL for jobid JOB12345: 'Injected submit error'. Most recent status update: 'Running DFHDPLOY (DEPLOY), jobid JOB12345'."`;
375375

376376
exports[`BundleDeployer01 should support long bundledir 1`] = `
377377
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
@@ -594,7 +594,7 @@ DEPLOY BUNDLE(12345678)
594594
"
595595
`;
596596

597-
exports[`BundleDeployer01 should tolerate empty output from DFHDPLOY 1`] = `"DFHDPLOY did not generate any output for JOBID UNKNOWN. Most recent status update: 'Submitting DFHDPLOY JCL for the DEPLOY action'."`;
597+
exports[`BundleDeployer01 should tolerate empty output from DFHDPLOY 1`] = `"DFHDPLOY did not generate any output for jobid UNKNOWN. Most recent status update: 'Submitting DFHDPLOY JCL for the DEPLOY action'."`;
598598

599599
exports[`BundleDeployer01 should undeploy successfully 1`] = `"Bundle undeployment successful."`;
600600

__tests__/api/BundlePush/BundlePusher.test.ts

Lines changed: 74 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ describe("BundlePusher01", () => {
114114
lstatSpy = jest.spyOn(fs, "lstatSync").mockImplementation(() => ( IS_NOT_DIRECTORY ));
115115
cmciSpy = jest.spyOn(cmci, "getResource").mockImplementation(() => ({ response: { records: {} } }));
116116
consoleText = "";
117-
zosmfProfile = {};
118-
sshProfile = {};
117+
zosmfProfile = { host: "testhost", user: "testuser" };
118+
sshProfile = { host: "testhost", user: "testuser" };
119119
cicsProfile = undefined;
120120
});
121121
afterEach(() => {
@@ -210,29 +210,27 @@ describe("BundlePusher01", () => {
210210
expect(sshSpy).toHaveBeenCalledTimes(1);
211211
});
212212
it("should complain with mismatching zOSMF and SSH profile host names", async () => {
213-
zosmfProfile = { host: "wibble" };
214-
sshProfile = { host: "wobble" };
213+
zosmfProfile = { host: "wibble", user: "user" };
214+
sshProfile = { host: "wobble", user: "user" };
215215

216216
await runPushTest("__tests__/__resources__/ExampleBundle01", true,
217217
"PUSH operation completed.");
218218
expect(consoleText).toContain("WARNING: ssh profile --host value 'wobble' does not match zosmf value 'wibble'.");
219219
});
220220
it("should not complain with matching zOSMF and SSH profile host names", async () => {
221-
zosmfProfile = { host: "wibble" };
222-
sshProfile = { host: "wibble" };
221+
zosmfProfile = { host: "wibble", user: "user" };
222+
sshProfile = { host: "wibble", user: "user" };
223223

224224
await runPushTest("__tests__/__resources__/ExampleBundle01", true,
225225
"PUSH operation completed.");
226226
expect(consoleText).not.toContain("WARNING: ssh profile");
227227
});
228228
it("should complain with mismatching zOSMF and CICS profile host names", async () => {
229-
zosmfProfile = { host: "wibble" };
230-
sshProfile = { host: "wibble" };
231-
cicsProfile = { host: "wobble", user: "user", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
229+
cicsProfile = { host: "wibble", user: "testuser", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
232230

233231
await runPushTest("__tests__/__resources__/ExampleBundle01", true,
234232
"PUSH operation completed.");
235-
expect(consoleText).toContain("WARNING: cics profile --host value 'wobble' does not match zosmf value 'wibble'.");
233+
expect(consoleText).toContain("WARNING: cics profile --host value 'wibble' does not match zosmf value 'testhost'.");
236234
});
237235
it("should not complain with matching zOSMF and CICS profile host names", async () => {
238236
zosmfProfile = { host: "wibble", user: "user" };
@@ -259,6 +257,14 @@ describe("BundlePusher01", () => {
259257
"PUSH operation completed.");
260258
expect(consoleText).not.toContain("WARNING: ssh profile");
261259
});
260+
it("should not complain with matching zOSMF and SSH profile user names - case", async () => {
261+
zosmfProfile = { host: "wibble", user: "fred" };
262+
sshProfile = { host: "wibble", user: "FRED" };
263+
264+
await runPushTest("__tests__/__resources__/ExampleBundle01", true,
265+
"PUSH operation completed.");
266+
expect(consoleText).not.toContain("WARNING: ssh profile");
267+
});
262268
it("should complain with mismatching zOSMF and CICS profile user names", async () => {
263269
zosmfProfile = { host: "wibble", user: "fred" };
264270
sshProfile = { host: "wibble", user: "fred" };
@@ -819,7 +825,7 @@ describe("BundlePusher01", () => {
819825
submitSpy.mockImplementationOnce(() => { throw new Error("Injected deploy error"); });
820826

821827
await runPushTestWithError("__tests__/__resources__/ExampleBundle01", false,
822-
"Failure occurred submitting DFHDPLOY JCL for JOBID UNKNOWN: 'Injected deploy error'. " +
828+
"Failure occurred submitting DFHDPLOY JCL for jobid UNKNOWN: 'Injected deploy error'. " +
823829
"Most recent status update: 'Submitting DFHDPLOY JCL for the DEPLOY action'.");
824830

825831
expect(zosMFSpy).toHaveBeenCalledTimes(1);
@@ -1043,6 +1049,13 @@ describe("BundlePusher01", () => {
10431049
zosmfProfile = { host: "wibble", user: "user" };
10441050
sshProfile = { host: "wibble", user: "user" };
10451051
cicsProfile = { host: "wibble", user: "user", password: "thisIsntReal", cicsPlex: "12345678" };
1052+
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
1053+
if (data.indexOf("cics.xml") > -1) {
1054+
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
1055+
"<define name=\"test\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/WIBBLE\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1056+
"</manifest>";
1057+
}
1058+
});
10461059
cmciSpy.mockImplementation((cicsSession: any, regionData: cmci.IResourceParms) => {
10471060
if (regionData.name === "CICSRegion") {
10481061
return { response: {
@@ -1112,7 +1125,14 @@ describe("BundlePusher01", () => {
11121125
sshProfile = { host: "wibble", user: "user" };
11131126
cicsProfile = { host: "wibble", user: "user", password: "thisIsntReal" };
11141127
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementation(() =>
1115-
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2055I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP"}] );
1128+
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2055I"}] );
1129+
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
1130+
if (data.indexOf("cics.xml") > -1) {
1131+
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
1132+
"<define name=\"test\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1133+
"</manifest>";
1134+
}
1135+
});
11161136
cmciSpy.mockImplementation((cicsSession: any, regionData: cmci.IResourceParms) => {
11171137
if (regionData.name === "CICSRegion") {
11181138
return { response: {
@@ -1133,7 +1153,7 @@ describe("BundlePusher01", () => {
11331153
parms.arguments.verbose = true;
11341154

11351155
await runPushTestWithError("__tests__/__resources__/ExampleBundle01", false,
1136-
"DFHDPLOY stopped processing for JOBID UNKNOWN due to an error.", parms);
1156+
"DFHDPLOY stopped processing for jobid UNKNOWN due to an error.", parms);
11371157

11381158
expect(consoleText).toContain("Making remote bundle directory '/u/ThisDoesNotExist/12345678'");
11391159
expect(consoleText).toContain("Accessing contents of remote bundle directory");
@@ -1186,7 +1206,14 @@ describe("BundlePusher01", () => {
11861206
sshProfile = { host: "wibble", user: "user" };
11871207
cicsProfile = { host: "wibble", user: "user", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
11881208
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementation(() =>
1189-
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP"}] );
1209+
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I"}] );
1210+
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
1211+
if (data.indexOf("cics.xml") > -1) {
1212+
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
1213+
"<define name=\"test\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1214+
"</manifest>";
1215+
}
1216+
});
11901217
cmciSpy.mockImplementation((cicsSession: any, nodejsData: cmci.IResourceParms) => {
11911218
if (nodejsData.name === "CICSNodejsapp") {
11921219
throw new Error("Injected CMCI GET error");
@@ -1226,7 +1253,14 @@ describe("BundlePusher01", () => {
12261253
sshProfile = { host: "wibble", user: "user" };
12271254
cicsProfile = { host: "wibble", user: "user", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
12281255
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementation(() =>
1229-
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP"}] );
1256+
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I"}] );
1257+
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
1258+
if (data.indexOf("cics.xml") > -1) {
1259+
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
1260+
"<define name=\"test\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1261+
"</manifest>";
1262+
}
1263+
});
12301264
cmciSpy.mockImplementation((cicsSession: any, nodejsData: cmci.IResourceParms) => {
12311265
if (nodejsData.name === "CICSNodejsapp") {
12321266
return {};
@@ -1266,7 +1300,14 @@ describe("BundlePusher01", () => {
12661300
sshProfile = { host: "wibble", user: "user" };
12671301
cicsProfile = { host: "wibble", user: "user", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
12681302
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementation(() =>
1269-
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP"}] );
1303+
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I"}] );
1304+
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
1305+
if (data.indexOf("cics.xml") > -1) {
1306+
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
1307+
"<define name=\"name\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1308+
"</manifest>";
1309+
}
1310+
});
12701311
cmciSpy.mockImplementation((cicsSession: any, nodejsData: cmci.IResourceParms) => {
12711312
if (nodejsData.name === "CICSNodejsapp") {
12721313
return { response: {
@@ -1318,7 +1359,14 @@ describe("BundlePusher01", () => {
13181359
sshProfile = { host: "wibble", user: "user" };
13191360
cicsProfile = { host: "wibble", user: "user", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
13201361
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementation(() =>
1321-
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP"}] );
1362+
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I"}] );
1363+
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
1364+
if (data.indexOf("cics.xml") > -1) {
1365+
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
1366+
"<define name=\"name\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1367+
"</manifest>";
1368+
}
1369+
});
13221370
cmciSpy.mockImplementation((cicsSession: any, nodejsData: cmci.IResourceParms) => {
13231371
if (nodejsData.name === "CICSNodejsapp") {
13241372
return { response: {
@@ -1370,7 +1418,15 @@ describe("BundlePusher01", () => {
13701418
sshProfile = { host: "wibble", user: "user" };
13711419
cicsProfile = { host: "wibble", user: "user", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
13721420
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementation(() =>
1373-
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP"}] );
1421+
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2012I"}] );
1422+
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
1423+
if (data.indexOf("cics.xml") > -1) {
1424+
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
1425+
"<define name=\"name\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1426+
"<define name=\"name2\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1427+
"</manifest>";
1428+
}
1429+
});
13741430
cmciSpy.mockImplementation((cicsSession: any, nodejsData: cmci.IResourceParms) => {
13751431
if (nodejsData.name === "CICSNodejsapp") {
13761432
return { response: {

src/api/BundleContent/Bundle.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ node_modules -
126126
return true;
127127
}
128128

129+
/**
130+
* Determines whether the Bundle contains any resources of the specified type
131+
* @param {string} resource - The resource to query
132+
* @returns {boolean}
133+
* @throws ImperativeError
134+
* @memberof Bundle
135+
*/
136+
public containsDefinitionsOfType(resourceType: string): boolean {
137+
return this.manifest.containsDefinitionsOfType(resourceType);
138+
}
139+
129140
/**
130141
* Returns the Bundle's identity (id) value.
131142
* @returns {string}

0 commit comments

Comments
 (0)