Skip to content

Commit 743e677

Browse files
authored
Merge branch 'release/v1.2.0' into feature/IJMP-1929-enhance-delete-ds
Signed-off-by: Anatoli Kalbasin <37359814+callbacksin@users.noreply.github.com>
2 parents 9cdd9fb + ae8477b commit 743e677

File tree

16 files changed

+157
-75
lines changed

16 files changed

+157
-75
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2-
---
1+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
33
version: 2
44
updates:
5-
- package-ecosystem: "maven"
6-
directory: "/"
5+
- package-ecosystem: github-actions
6+
directory: /
77
schedule:
8-
interval: "weekly"
9-
- package-ecosystem: "github-actions"
10-
directory: "/"
11-
schedule:
12-
interval: "weekly"
8+
interval: monthly

.github/release-drafter.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
2-
_extends: .github
3-
tag-template: zdevops-$NEXT_MINOR_VERSION
2+
_extends: .github

.github/workflows/cd.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins
2+
3+
name: cd
4+
on:
5+
workflow_dispatch:
6+
check_run:
7+
types:
8+
- completed
9+
10+
jobs:
11+
maven-cd:
12+
uses: jenkins-infra/github-reusable-workflows/.github/workflows/maven-cd.yml@v1
13+
secrets:
14+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
15+
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Jenkins Security Scan
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [ opened, synchronize, reopened ]
9+
workflow_dispatch:
10+
11+
permissions:
12+
security-events: write
13+
contents: read
14+
actions: read
15+
16+
jobs:
17+
security-scan:
18+
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
19+
with:
20+
java-cache: 'maven' # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
21+
# java-version: 21 # Optionally specify what version of Java to set up for the build, or remove to use a recent default.

.github/workflows/release-drafter.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.mvn/extensions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<extension>
33
<groupId>io.jenkins.tools.incrementals</groupId>
44
<artifactId>git-changelist-maven-extension</artifactId>
5-
<version>1.6</version>
5+
<version>1.8</version>
66
</extension>
77
</extensions>

.mvn/maven.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-Pconsume-incrementals
22
-Pmight-produce-incrementals
3-
-DaltDeploymentRepository=maven.jenkins-ci.org::default::https://repo.jenkins-ci.org/releases/
3+
-Dchangelist.format=%d.v%s

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ All notable changes to the Zowe zDevOps Jenkins Plugin will be documented in thi
2121
* Feature: Added Jenkins Freestyle UI method - "Write text to member" ([4e4d73cc](https://github.com/zowe/zowe-zdevops-jenkins-plugin/commit/4e4d73cc))
2222
* Feature: Added dataset member name validation ([b05c7436](https://github.com/zowe/zowe-zdevops-jenkins-plugin/commit/b05c7436))
2323
* Feature: Added hpi-builder.yml GitHub workflow for automated .hpi builds ([c0fd9f27](https://github.com/zowe/zowe-zdevops-jenkins-plugin/commit/c0fd9f27))
24+
* Feature: Added failOnExist parameter for allocateDS, deleteDataset and deleteDatasetsByMask declarative/Freestyle UI methods (checks the presence/absence of a dataset on the system) ([db232f49](https://github.com/zowe/zowe-zdevops-jenkins-plugin/commit/db232f49))
2425

2526
### Bugfixes
2627

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
* Copyright IBA Group 2022
99
*/
1010

11-
buildPlugin(useContainerAgent: true, tests: [[skip: 'true']], configurations: [[ platform: 'linux', jdk: '17' ]])
11+
buildPlugin(useContainerAgent: true, configurations: [[ platform: 'linux', jdk: '17' ]])

README.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Thank you for considering IBA Group for your mainframe needs.
2727

2828
## Before use - Plugin configuration
2929
After successfully installing the plugin, you need to configure it for further work - this will require a minimum of actions.
30-
1. Move to Manage Jenkins -> Configure System / System -> scroll to the very bottom of the list of installed plugins and find the panel with the name - <b>z/OS Connection List</b>
30+
1. Move to 'Manage Jenkins' -> 'Configure System / System' -> scroll to the very bottom of the list of installed plugins and find the panel with the name - <b>'z/OS Connection List'</b>
3131
2. This setting allows you to add all necessary z/OS systems and configure access to them.
3232
It is necessary to set the connection name (it is also the ID for declarative methods in the code). For the example: ```z/os-connection-name```
3333
3. The URL address and port of the required mainframe to connect via z/OSMF. Example: ```https://<ip-addres>:<port number>```
@@ -45,7 +45,7 @@ stage ("stage-name") {
4545
submitJobSync "//'EXAMPLE.DATASET(MEMBER)'"
4646
downloadDS "EXAMPLE.DATASET(MEMBER)"
4747
downloadDS dsn:"EXAMPLE.DATASET(MEMBER)", vol:"VOL001"
48-
allocateDS dsn:"EXAMPLE.DATASET", alcUnit:"TRK", dsOrg:"PS", primary:1, secondary:1, recFm:"FB"
48+
allocateDS dsn:"EXAMPLE.DATASET", alcUnit:"TRK", dsOrg:"PS", primary:1, secondary:1, recFm:"FB", failOnExist:"False"
4949
writeFileToDS dsn:"EXAMPLE.DATASET", file:"workspaceFile"
5050
writeFileToDS dsn:"EXAMPLE.DATASET", file:"D:\\files\\localFile"
5151
writeToDS dsn:"EXAMPLE.DATASET", text:"Write this string to dataset"
@@ -57,9 +57,9 @@ stage ("stage-name") {
5757
writeFileToFile destFile: "u/USER/myfile", sourceFile: "myfile.txt"
5858
writeFileToFile destFile: "u/USER/myfile", sourceFile: "myfile.txt", binary: "true"
5959
60-
deleteDataset dsn:"EXAMPLE.DATASET"
61-
deleteDataset dsn:"EXAMPLE.DATASET(MEMBER)"
62-
deleteDatasetsByMask mask:"EXAMPLE.DATASET.*"
60+
deleteDataset dsn:"EXAMPLE.DATASET", failOnNotExist:"False"
61+
deleteDataset dsn:"EXAMPLE.DATASET(MEMBER)", failOnNotExist:"True"
62+
deleteDatasetsByMask mask:"EXAMPLE.DATASET.*", failOnNotExist:"False"
6363
}
6464
// ...
6565
}
@@ -70,14 +70,38 @@ stage ("stage-name") {
7070

7171
### allocateDS - Represents an action for allocating a dataset in a declarative style
7272
```groovy
73-
allocateDS dsn:"EXAMPLE.DATASET", dsOrg:"PS", primary:1, secondary:1, recFm:"FB"
73+
zosmf ("z/os-connection-name") {
74+
allocateDS(
75+
// Mandatory Parameters below:
76+
dsn: "EXAMPLE.DATASET",
77+
dsOrg: "PS",
78+
primary: 1,
79+
secondary: 1,
80+
recFm: "FB",
81+
failOnExist:"False",
82+
// Optional Parameters below:
83+
volser:"YOURVOL",
84+
unit:"SYSDA",
85+
alcUnit:"TRK",
86+
dirBlk:"5",
87+
blkSize:"800",
88+
lrecl:"80",
89+
storClass:"STORAGECLASS",
90+
mgntClass:"MGMTCLASS",
91+
dataClass:"DATACLASS",
92+
avgBlk:"10",
93+
dsnType:"LIBRARY",
94+
dsModel:"MODEL.DATASET.NAME"
95+
)
96+
}
7497
```
7598
**Mandatory Parameters:**
7699
* ```dsn:"EXAMPLE.DATASET"``` - The name of the dataset to be allocated
77100
* ```dsOrg:"PS"``` - The dataset organization (could be only PO, POE, PS, VS)
78101
* ```primary:"1"``` - The primary allocation size in cylinders or tracks
79102
* ```secondary:"1"``` - The secondary allocation size in cylinders or tracks
80103
* ```recFm:"FB"``` - The record format (could be only F, FB, V, VB, U, VSAM, VA)
104+
* ```failOnExist:"False"``` - If the dataset already exists and the option is enabled, execution will halt. (Boolean parameter, is set to 'False' by default)
81105

82106
**Optional parms:**
83107
* ```volser:"YOURVOL"``` - Volume serial number where the dataset will be allocated.
@@ -96,19 +120,20 @@ allocateDS dsn:"EXAMPLE.DATASET", dsOrg:"PS", primary:1, secondary:1, recFm:"FB"
96120

97121
### deleteDataset - Represents an action for deleting datasets and members in a declarative style
98122
```groovy
99-
deleteDataset dsn:"EXAMPLE.DATASET", failOnNotExist: true
123+
zosmf ("z/os-connection-name") {
124+
deleteDataset dsn: "EXAMPLE.DATASET(MEMBER)", failOnNotExist: false
125+
}
100126
```
101127
**Mandatory Parameters:**
102128
* ```dsn:"EXAMPLE.DATASET"``` - Sequential or library dataset name in the form `HLQ.DSNAME` or `HLQ.DSNAME(MEMNAME)`
103129
**Optional Parameters:**
104-
* `failOnNotExist: false` - Fail the execution if the entity does not exist
105-
130+
* `failOnNotExist: false` - Fail the execution if the entity does not exist. Boolean parameter, is set to 'false' by default.
106131

107132
**Expected behavior under various deletion scenarios:**
108133

109134
* To delete a member from the library, provide dataset member name in the form `HLQ.DSNAME(MEMNAME)`:
110135
```
111-
deleteDataset dsn:"EXAMPLE.DATASET(MEMBER1)"
136+
deleteDataset dsn:"EXAMPLE.DATASET(MEMBER1)", failOnNotExist: false
112137
```
113138
114139
* You cannot delete a VSAM dataset this way. Otherwise, you will get output similar to:
@@ -178,7 +203,7 @@ Pipeline can be used either directly inside the ```Pipeline``` code block in the
178203
This pipeline example uses all currently available methods and functionality of the Zowe zDevOps plugin.
179204
180205
**Steps to Execute the Pipeline:**
181-
1. Add a zosmf connection in settings (<b>Manage Jenkins -> Configure System / System -> z/OS Connection List</b>). Enter a connection name, zosmf url, username and password.
206+
1. Add a zosmf connection in settings (<b>'Manage Jenkins' -> 'Configure System / System' -> z/OS Connection List</b>). Enter a connection name, zosmf url, username and password.
182207
2. Create a new Jenkins item -> ```Pipeline``` and open its configuration.
183208
3. In the ```Pipeline``` section, paste the code from the example below and replace all the necessary variables with your data
184209
4. Done, enjoy the minimal ready-made pipeline template!
@@ -219,9 +244,9 @@ pipeline {
219244
stage('Allocate DSs') {
220245
steps {
221246
zosmf("${ZOS_CONN_ID}") {
222-
allocateDS dsn:"${PS_DATASET_1}", dsOrg:"PS", primary:1, secondary:1, recFm:"FB"
223-
allocateDS dsn:"${PS_DATASET_2}", dsOrg:"PS", primary:1, secondary:1, recFm:"FB", alcUnit:"TRK"
224-
allocateDS dsn:"${PO_DATASET}(${PO_MEMBER})", dsOrg:"PO", primary:1, secondary:1, recFm:"FB"
247+
allocateDS dsn:"${PS_DATASET_1}", dsOrg:"PS", primary:1, secondary:1, recFm:"FB", failOnExist:"False"
248+
allocateDS dsn:"${PS_DATASET_2}", dsOrg:"PS", primary:1, secondary:1, recFm:"FB", alcUnit:"TRK", failOnExist:"False"
249+
allocateDS dsn:"${PO_DATASET}(${PO_MEMBER})", dsOrg:"PO", primary:1, secondary:1, recFm:"FB", failOnExist:"False"
225250
}
226251
}
227252
}
@@ -272,8 +297,8 @@ pipeline {
272297
stage('Clean up') {
273298
steps {
274299
zosmf("${ZOS_CONN_ID}") {
275-
deleteDataset dsn:"${PS_DATASET_1}"
276-
deleteDatasetsByMask mask:"${HLQ}.NEW.*"
300+
deleteDataset dsn:"${PS_DATASET_1}", failOnNotExist:"False"
301+
deleteDatasetsByMask mask:"${HLQ}.NEW.*", failOnNotExist:"True"
277302
}
278303
}
279304
}
@@ -323,7 +348,7 @@ The plugin are packaged as self-contained <b>.hpi</b> files, which have all the
323348
### <b>[Zowe zDevOps plugin installation .hpi file](https://github.com/IBA-mainframe-dev/Global-Repository-for-Mainframe-Developers/blob/master/Jenkins%20zOS%20DevOps%20plugin%20installable%20hpi/zos-devops.hpi)</b>
324349

325350
Assuming a <b>.hpi</b> file has been downloaded, a logged-in Jenkins administrator may upload the file from within the web UI:
326-
1. Navigate to the <b>Manage Jenkins > Manage Plugins</b> page in the web UI.
351+
1. Navigate to the <b>Manage Jenkins > Plugins</b> page in the web UI.
327352
2. Click on the <b>Advanced</b> tab.
328353
3. Choose the <b>.hpi</b> file from your system or enter a URL to the archive file under the <b>Deploy Plugin</b> section.
329354
4. <b>Deploy</b> the plugin file.
@@ -334,8 +359,8 @@ Assuming a <b>.hpi</b> file has been downloaded, a logged-in Jenkins administrat
334359
3. To generate the ```target``` dir with generated-sources - you have to run the Maven command: ```mvn localizer:generate```
335360
4. Next, you need to generate an installation file: .hpi or .jpi file (both are installation files for the Jenkins plugin). This can be done by executing Maven command ```mvn install``` or by ```mvn hpi:hpi```.
336361
5. After building the .hpi/.jpi file, it should appear in a <b><Plugin-project-name>/build/libs/<hpi_file_name>.hpi</b> directory
337-
6. Next you need to login into the Jenkins, move to the <b>Manage Jenkins -> “Manage Plugins -> Advanced (tab) -> Deploy Plugin</b> (You can select a plugin file from your local system or provide a URL to install a plugin from outside the central plugin repository) <b>-> Specify the path to the generated .hpi/.jpi file</b> (or by dragging the file from Intellij IDEA project to the file upload field in the Jenkins).
338-
7. Click <b>Deploy</b>, reboot Jenkins after installation. The Plugin is ready to go!
362+
6. Next you need to login into the Jenkins, move to the <b>'Manage Jenkins' -> 'Plugins' -> 'Advanced settings (tab)' -> 'Deploy Plugin'</b> (You can select a plugin file from your local system or provide a URL to install a plugin from outside the central plugin repository) <b>-> Specify the path to the generated .hpi/.jpi file</b> (or by dragging the file from Intellij IDEA project to the file upload field in the Jenkins).
363+
7. Click <b>'Deploy'</b>, reboot Jenkins after installation. The Plugin is ready to go!
339364

340365
## How to run Jenkins plugin in Debug mode in a local Jenkins sandbox
341366

pom.xml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,25 @@
88
<relativePath />
99
</parent>
1010

11-
<groupId>org.zowe</groupId>
11+
<groupId>io.jenkins.plugins</groupId>
1212
<artifactId>zdevops</artifactId>
13-
<version>${revision}${changelist}</version>
13+
<version>${revision}.${changelist}</version>
1414
<name>Zowe zDevOps</name>
1515
<packaging>hpi</packaging>
1616
<description>Zowe mainframe z/OS automation plugin, working through z/OSMF REST API and using Zowe Kotlin SDK</description>
1717

1818
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
1919

20-
2120
<properties>
22-
<revision>0.3.0</revision>
23-
<changelist>-SNAPSHOT</changelist>
21+
<revision>1.2.0</revision>
22+
<changelist>999999-SNAPSHOT</changelist>
2423
<jenkins.version>2.414.3</jenkins.version>
2524
<java.version>17</java.version>
2625
<kotlin.version>1.9.20</kotlin.version>
2726
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
2827
<sezpoz.version>1.13</sezpoz.version>
2928
<okhttp3.version>4.10.0</okhttp3.version>
30-
<zowekotlinsdk.version>0.5.0-rc.11</zowekotlinsdk.version>
29+
<zowekotlinsdk.version>0.5.0</zowekotlinsdk.version>
3130
<kotest.version>5.6.1</kotest.version>
3231
<kotlin.code.style>official</kotlin.code.style>
3332
<kotlin.compiler.jvmTarget>17</kotlin.compiler.jvmTarget>
@@ -62,8 +61,8 @@
6261
</developers>
6362

6463
<scm>
65-
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
66-
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>
64+
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
65+
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
6766
<url>https://github.com/${gitHubRepo}</url>
6867
<tag>${scmTag}</tag>
6968
</scm>
@@ -336,7 +335,7 @@
336335
<dependency>
337336
<groupId>org.yaml</groupId>
338337
<artifactId>snakeyaml</artifactId>
339-
<version>2.2</version>
338+
<version>2.3</version>
340339
</dependency>
341340

342341
<dependency>
@@ -372,7 +371,13 @@
372371
<dependency>
373372
<groupId>com.google.code.gson</groupId>
374373
<artifactId>gson</artifactId>
375-
<version>2.10.1</version>
374+
<version>2.11.0</version>
375+
</dependency>
376+
377+
<dependency>
378+
<groupId>com.google.errorprone</groupId>
379+
<artifactId>error_prone_annotations</artifactId>
380+
<version>2.27.0</version>
376381
</dependency>
377382

378383
<dependency>
@@ -460,7 +465,8 @@
460465
</repository>
461466

462467
<repository>
463-
<id>zowe.jfrog.io</id>
468+
<!-- Do not change the ID - ref. https://github.com/jenkins-infra/helpdesk/issues/3501 -->
469+
<id>org.zowe.sdk</id>
464470
<url>https://zowe.jfrog.io/artifactory/libs-release</url>
465471
</repository>
466472
</repositories>

src/main/kotlin/org/zowe/zdevops/classic/steps/DownloadDatasetStep.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
/*
2+
* Copyright (c) 2023-2024 IBA Group.
3+
*
24
* This program and the accompanying materials are made available under the terms of the
35
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
46
* https://www.eclipse.org/legal/epl-v20.html
57
*
68
* SPDX-License-Identifier: EPL-2.0
79
*
8-
* Copyright IBA Group 2023
10+
* Contributors:
11+
* IBA Group
12+
* Zowe Community
913
*/
1014

1115
package org.zowe.zdevops.classic.steps
@@ -70,7 +74,8 @@ constructor(
7074
zosConnection: ZOSConnection
7175
) {
7276
val workspace = build.executor?.currentWorkspace!!
73-
downloadDSOrDSMemberByType(dsn, vol, returnEtag, listener, zosConnection, workspace)
77+
val jenkinsJobUrl = build.getEnvironment(listener)["JOB_URL"]
78+
downloadDSOrDSMemberByType(dsn, vol, returnEtag, listener, zosConnection, workspace, jenkinsJobUrl)
7479
}
7580

7681

0 commit comments

Comments
 (0)