Skip to content

Commit d116c65

Browse files
Merge branch 'master' of github.com:IBM/zowe-cli-cics-deploy-plugin into subtask-progress
Conflicts: src/api/BundleDeploy/BundleDeployer.ts src/api/BundlePush/BundlePusher.ts
2 parents 896b1d2 + c1fe040 commit d116c65

File tree

203 files changed

+22874
-1016
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+22874
-1016
lines changed

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
<!--
5+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
Changes should be placed under the following headings:
8+
### Added
9+
- for new features
10+
### Changed
11+
- for changes in existing functionality
12+
### Deprecated
13+
- for soon-to-be removed features
14+
### Removed
15+
- for now removed features
16+
### Fixed
17+
- for any bug fixes
18+
### Security
19+
- in case of vulnerabilities
20+
-->
21+
22+
## [Unreleased]
23+
24+
### Added
25+
26+
- Zowe CLI cics-deploy plugin including the commands:
27+
28+
- `zowe cics-deploy generate bundle`
29+
- `zowe cics-deploy push bundle`
30+
- `zowe cics-deploy deploy bundle`
31+
- `zowe cics-deploy undeploy bundle`
32+
33+
- Zowe CLI cics-deploy profile
34+
- Documentation in GitHub pages

Jenkinsfile

Lines changed: 67 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
*/
1919
def RELEASE_BRANCHES = ["master"]
2020

21+
/**
22+
* Branches to send notifcations for
23+
*/
24+
def NOTIFY_BRANCHES = ["master"]
25+
26+
2127
/**
2228
* The following flags are switches to control which stages of the pipeline to be run. This is helpful when
2329
* testing a specific stage of the pipeline.
@@ -63,11 +69,11 @@ def UNIT_RESULTS = "${TEST_RESULTS_FOLDER}/unit"
6369
*/
6470
def MASTER_BRANCH = "master"
6571

66-
6772
/**
68-
* A command to be run that gets the current revision pulled down
73+
* Variables to check any new commit since the previous successful commit
6974
*/
70-
def GIT_REVISION_LOOKUP = 'git log -n 1 --pretty=format:%h'
75+
def GIT_COMMIT = "null"
76+
def GIT_PREVIOUS_SUCCESSFUL_COMMIT = "null"
7177

7278
/**
7379
* This is the product name used by the build machine to store information about
@@ -105,6 +111,10 @@ pipeline {
105111

106112
agent any
107113

114+
options {
115+
skipDefaultCheckout true
116+
}
117+
108118
environment {
109119
// Environment variable for flow control. Indicates if the git source was updated by the pipeline.
110120
GIT_SOURCE_UPDATED = "false"
@@ -117,6 +127,20 @@ pipeline {
117127
}
118128

119129
stages {
130+
stage("Clean workspace and checkout source") {
131+
steps {
132+
timeout(time: 5, unit: 'MINUTES') {
133+
script {
134+
cleanWs()
135+
scmInfo = checkout scm
136+
137+
GIT_COMMIT = scmInfo.GIT_COMMIT
138+
GIT_PREVIOUS_SUCCESSFUL_COMMIT = scmInfo.GIT_PREVIOUS_SUCCESSFUL_COMMIT
139+
}
140+
}
141+
}
142+
}
143+
120144
/************************************************************************
121145
* STAGE
122146
* -----
@@ -145,12 +169,6 @@ pipeline {
145169
steps {
146170
timeout(time: 2, unit: 'MINUTES') {
147171
script {
148-
// We need to keep track of the current commit revision. This is to prevent the condition where
149-
// the build starts on master and another branch gets merged to master prior to version bump
150-
// commit taking place. If left unhandled, the version bump could be done on latest master branch
151-
// code which would already be ahead of this build.
152-
BUILD_REVISION = sh returnStdout: true, script: GIT_REVISION_LOOKUP
153-
154172
// This checks for the [ci skip] text. If found, the status code is 0
155173
def result = sh returnStatus: true, script: 'git log -1 | grep \'.*\\[ci skip\\].*\''
156174
if (result == 0) {
@@ -197,17 +215,16 @@ pipeline {
197215
}
198216
}
199217
steps('Install Zowe CLI') {
200-
withCredentials([usernamePassword(credentialsId: ARTIFACTORY_CREDENTIALS_ID, usernameVariable: 'USERNAME', passwordVariable: 'API_KEY')]) {
201-
timeout(time: 10, unit: 'MINUTES') {
202-
echo "Install Zowe CLI globaly"
203-
sh "rm -f ~/.npmrc"
204-
sh 'curl -u $USERNAME:$API_KEY https://eu.artifactory.swg-devops.com/artifactory/api/npm/auth/ >> ~/.npmrc'
205-
sh "echo registry=$TEST_NPM_REGISTRY >> ~/.npmrc"
206-
sh "echo @brightside:registry=$TEST_NPM_REGISTRY >> ~/.npmrc"
207-
sh "echo @zowe:registry=$TEST_NPM_REGISTRY >> ~/.npmrc"
208-
sh("npm install -g @zowe/cli@cicsdev")
209-
sh("zowe --version")
210-
}
218+
timeout(time: 10, unit: 'MINUTES') {
219+
echo "Install Zowe CLI globaly"
220+
sh "rm -f .npmrc"
221+
sh("npm set registry https://registry.npmjs.org")
222+
//sh("npm set @brightside:registry https://api.bintray.com/npm/ca/brightside/")
223+
//sh("npm set @zowe:registry https://api.bintray.com/npm/ca/brightside/")
224+
sh("npm set @zowe:registry https://registry.npmjs.org")
225+
226+
sh("npm install -g @zowe/cli@daily")
227+
sh("zowe --version")
211228
}
212229
}
213230
}
@@ -248,7 +265,7 @@ pipeline {
248265
steps {
249266
timeout(time: 10, unit: 'MINUTES') {
250267
echo 'Installing Dependencies'
251-
268+
sh 'npm config ls'
252269
sh 'npm install'
253270
}
254271
}
@@ -524,6 +541,9 @@ pipeline {
524541
expression {
525542
return BRANCH_NAME == MASTER_BRANCH
526543
}
544+
expression {
545+
return GIT_COMMIT != GIT_PREVIOUS_SUCCESSFUL_COMMIT
546+
}
527547
}
528548
}
529549
steps {
@@ -573,7 +593,10 @@ pipeline {
573593
return PIPELINE_CONTROL.deploy
574594
}
575595
expression {
576-
return BRANCH_NAME == MASTER_BRANCH
596+
return BRANCH_NAME == MASTER_BRANCH
597+
}
598+
expression {
599+
return GIT_COMMIT != GIT_PREVIOUS_SUCCESSFUL_COMMIT
577600
}
578601
}
579602
}
@@ -586,22 +609,39 @@ pipeline {
586609
sh "rm -f .npmrc"
587610
sh 'curl -u $USERNAME:$API_KEY https://eu.artifactory.swg-devops.com/artifactory/api/npm/auth/ >> .npmrc'
588611
sh "echo registry=$TEST_NPM_REGISTRY >> .npmrc"
589-
sh "echo @brightside:registry=https://api.bintray.com/npm/ca/brightside/ >> .npmrc"
590-
sh "echo @brightside:always-auth=false >> .npmrc"
591-
612+
sh "echo @zowe:registry=https://registry.npmjs.org >> .npmrc"
613+
sh "echo @zowe:always-auth=false >> .npmrc"
614+
592615
script {
593616
if (BRANCH_NAME == MASTER_BRANCH) {
594617
echo "publishing next to $TEST_NPM_REGISTRY"
595618
sh "npm publish --tag next"
596-
}
597-
else {
619+
} else {
598620
echo "publishing latest to $TEST_NPM_REGISTRY"
599621
sh "npm publish --tag latest"
600622
}
601623
}
624+
625+
sh "rm -f .npmrc"
602626
}
603627
}
604628
}
605629
}
606630
}
631+
post {
632+
unsuccessful {
633+
script {
634+
if (NOTIFY_BRANCHES.contains(BRANCH_NAME)) {
635+
slackSend (channel: '#cics-node-dev', message: "${env.JOB_NAME} #${env.BUILD_NUMBER} completed - ${currentBuild.result} (<${env.BUILD_URL}|Open>)", tokenCredentialId: 'slack-cics-node-dev')
636+
}
637+
}
638+
}
639+
fixed {
640+
script {
641+
if (NOTIFY_BRANCHES.contains(BRANCH_NAME)) {
642+
slackSend (channel: '#cics-node-dev', message: "${env.JOB_NAME} #${env.BUILD_NUMBER} completed - Back to normal (<${env.BUILD_URL}|Open>)", tokenCredentialId: 'slack-cics-node-dev')
643+
}
644+
}
645+
}
646+
}
607647
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This project provides a plug-in for [Zowe CLI](https://github.com/zowe/zowe-cli)
44
## Status
55
The project was started in February 2019 and is at an early stage of development. It will initially focus on generating and deploying CICS bundles containing Node.js applications.
66

7-
To try it out, build the plug-in from source as described in [setup](docs/tutorials/Setup.md).
7+
To try it out, build the plug-in from source as described in [setup](docs-internal/tutorials/Setup.md).
88

99
## Contributing
1010
Contributions are welcome - see the [contribution guidelines](CONTRIBUTING.md). If you have a question or encounter a problem please raise an issue in this repo.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<manifest xmlns="http://www.ibm.com/xmlns/prod/cics/bundle">
2-
</manifest>
2+
</manifest>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dummy Content

__tests__/__src__/environment/TestEnvironment.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,14 @@ export class TestEnvironment {
5151
// Get a unique test data area
5252
const testDirectory: string = TestEnvironment.createUniqueTestDataDir(params.testName);
5353

54-
const systemProps = TestEnvironment.loadSystemTestProperties(undefined, testDirectory);
55-
5654
// set the env variables to be used for executing
5755
// scripts in the test environment
5856
const env: { [key: string]: string } = {};
5957
env[this.HOME_ENV_KEY] = testDirectory;
6058

6159
const result: ITestEnvironment = {
6260
workingDir: testDirectory,
63-
systemTestProperties: systemProps,
61+
systemTestProperties: null,
6462
env
6563
};
6664

@@ -149,7 +147,7 @@ export class TestEnvironment {
149147
private static async installPlugin(testEnvironment: ITestEnvironment) {
150148
let installScript: string = TemporaryScripts.SHEBANG;
151149
installScript += TemporaryScripts.ZOWE_BIN + " plugins install ../../../../\n"; // install plugin from root of project
152-
installScript += TemporaryScripts.ZOWE_BIN + " plugins validate @brightside/zowe-cli-cics-deploy-plugin\n";
150+
installScript += TemporaryScripts.ZOWE_BIN + " plugins validate zowe-cli-cics-deploy-plugin\n";
153151
installScript += TemporaryScripts.ZOWE_BIN + " cdep --help\n"; // check that the plugin help is available
154152
const scriptPath = testEnvironment.workingDir + "/install_plugin.sh";
155153
IO.writeFile(scriptPath, Buffer.from(installScript));
@@ -158,7 +156,7 @@ export class TestEnvironment {
158156

159157
if (output.status !== 0) {
160158
throw new ImperativeError({
161-
msg: "Install of '@brightside/zowe-cli-cics-deploy-plugin' plugin failed! You should delete the script: \n'" + scriptPath + "' " +
159+
msg: "Install of 'zowe-cli-cics-deploy-plugin' plugin failed! You should delete the script: \n'" + scriptPath + "' " +
162160
"after reviewing it to check for possible errors.\n Output of the plugin install command:\n" + output.stderr.toString() +
163161
output.stdout.toString()
164162
});

__tests__/api/BundleDeploy/BundleDeployer.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ 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 = "Waiting for JOB12345 to enter OUTPUT (Processing DFHDPLOY DEPLOY action)";
130+
const expectedMsg = "Running DFHDPLOY (DEPLOY), job JOB12345";
131131
// wait 1.5 seconds
132132
return new Promise((resolve, reject) => {
133133
setTimeout(() => {
134134
// Now check that the status message has been updated by the progress bar processing
135135
if (parms.task.statusMessage !== expectedMsg) {
136-
throw new Error("Failed to find the expected message. Got: '" + parms.task.statusMessage + "' expected " +
137-
expectedMsg);
136+
throw new Error("Failed to find the expected message. Got: '" + parms.task.statusMessage + "' expected '" +
137+
expectedMsg + "'");
138138
}
139139
resolve();
140140
}, 1500);
@@ -403,6 +403,13 @@ describe("BundleDeployer01", () => {
403403
parms.arguments.verbose = false;
404404
await testDeployJCL(parms);
405405
});
406+
it("should support long description", async () => {
407+
let parms: IHandlerParameters;
408+
parms = DEFAULT_PARAMTERS;
409+
setCommonParmsForDeployTests(parms);
410+
parms.arguments.description = "1234567890123456789012345678901234567890123456789012345678";
411+
await testDeployJCL(parms);
412+
});
406413

407414
// ** UNDEPLOY TESTS **
408415
it("should generate undeploy JCL with neither csdgroup nor resgroup", async () => {
@@ -597,6 +604,7 @@ function setCommonParmsForUndeployTests(parms: IHandlerParameters) {
597604
parms.arguments.name = "12345678";
598605
parms.arguments.jobcard = "//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT";
599606
parms.arguments.targetstate = "DISCARDED";
607+
parms.arguments.description = undefined;
600608
}
601609

602610
async function testDeployJCL(parms: IHandlerParameters) {

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ UNDEPLOY BUNDLE(12345678)
371371

372372
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: 'Waiting for JOB12345 to enter OUTPUT (Processing DFHDPLOY DEPLOY action)'."`;
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'."`;
375375

376376
exports[`BundleDeployer01 should support long bundledir 1`] = `
377377
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
@@ -396,6 +396,26 @@ DEPLOY BUNDLE(12345678)
396396
"
397397
`;
398398

399+
exports[`BundleDeployer01 should support long description 1`] = `
400+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
401+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
402+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
403+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
404+
//SYSTSPRT DD SYSOUT=*
405+
//SYSIN DD *
406+
*
407+
SET CICSPLEX(12345678);
408+
*
409+
DEPLOY BUNDLE(12345678)
410+
BUNDLEDIR(1234567890)
411+
DESCRIPTION(1234567890123456789012345678901234567890123456789012
412+
345678)
413+
SCOPE(12345678)
414+
STATE(ENABLED)
415+
/*
416+
"
417+
`;
418+
399419
exports[`BundleDeployer01 should support long line jobcard 1`] = `
400420
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT,
401421
// NOEL=ABCDEFGHIJKMNOPQRSTUVWXYZ

0 commit comments

Comments
 (0)