Skip to content

Commit

Permalink
Merge branch 'release/v1.1.1' into release/v1.2.0
Browse files Browse the repository at this point in the history
Signed-off-by: Uladzislau <[email protected]>
  • Loading branch information
KUGDev committed Nov 12, 2024
2 parents 95f7d6c + 090bfac commit 693e161
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 59 deletions.
14 changes: 5 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
---
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
- package-ecosystem: github-actions
directory: /
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: monthly
3 changes: 1 addition & 2 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
_extends: .github
tag-template: zdevops-$NEXT_MINOR_VERSION
_extends: .github
15 changes: 15 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins

name: cd
on:
workflow_dispatch:
check_run:
types:
- completed

jobs:
maven-cd:
uses: jenkins-infra/github-reusable-workflows/.github/workflows/maven-cd.yml@v1
secrets:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/jenkins-security-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Jenkins Security Scan

on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:

permissions:
security-events: write
contents: read
actions: read

jobs:
security-scan:
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
with:
java-cache: 'maven' # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
# java-version: 21 # Optionally specify what version of Java to set up for the build, or remove to use a recent default.
17 changes: 0 additions & 17 deletions .github/workflows/release-drafter.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.6</version>
<version>1.8</version>
</extension>
</extensions>
2 changes: 1 addition & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
-DaltDeploymentRepository=maven.jenkins-ci.org::default::https://repo.jenkins-ci.org/releases/
-Dchangelist.format=%d.v%s
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All notable changes to the Zowe zDevOps Jenkins Plugin will be documented in thi
* Feature: Added Jenkins Freestyle UI method - "Write text to member" ([4e4d73cc](https://github.com/zowe/zowe-zdevops-jenkins-plugin/commit/4e4d73cc))
* Feature: Added dataset member name validation ([b05c7436](https://github.com/zowe/zowe-zdevops-jenkins-plugin/commit/b05c7436))
* Feature: Added hpi-builder.yml GitHub workflow for automated .hpi builds ([c0fd9f27](https://github.com/zowe/zowe-zdevops-jenkins-plugin/commit/c0fd9f27))
* 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))

### Bugfixes

Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
* Copyright IBA Group 2022
*/

buildPlugin(useContainerAgent: true, tests: [[skip: 'true']], configurations: [[ platform: 'linux', jdk: '17' ]])
buildPlugin(useContainerAgent: true, configurations: [[ platform: 'linux', jdk: '17' ]])
61 changes: 44 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Thank you for considering IBA Group for your mainframe needs.

## Before use - Plugin configuration
After successfully installing the plugin, you need to configure it for further work - this will require a minimum of actions.
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>
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>
2. This setting allows you to add all necessary z/OS systems and configure access to them.
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```
3. The URL address and port of the required mainframe to connect via z/OSMF. Example: ```https://<ip-addres>:<port number>```
Expand All @@ -45,7 +45,7 @@ stage ("stage-name") {
submitJobSync "//'EXAMPLE.DATASET(MEMBER)'"
downloadDS "EXAMPLE.DATASET(MEMBER)"
downloadDS dsn:"EXAMPLE.DATASET(MEMBER)", vol:"VOL001"
allocateDS dsn:"EXAMPLE.DATASET", alcUnit:"TRK", dsOrg:"PS", primary:1, secondary:1, recFm:"FB"
allocateDS dsn:"EXAMPLE.DATASET", alcUnit:"TRK", dsOrg:"PS", primary:1, secondary:1, recFm:"FB", failOnExist:"False"
writeFileToDS dsn:"EXAMPLE.DATASET", file:"workspaceFile"
writeFileToDS dsn:"EXAMPLE.DATASET", file:"D:\\files\\localFile"
writeToDS dsn:"EXAMPLE.DATASET", text:"Write this string to dataset"
Expand All @@ -57,9 +57,9 @@ stage ("stage-name") {
writeFileToFile destFile: "u/USER/myfile", sourceFile: "myfile.txt"
writeFileToFile destFile: "u/USER/myfile", sourceFile: "myfile.txt", binary: "true"
deleteDataset dsn:"EXAMPLE.DATASET"
deleteDataset dsn:"EXAMPLE.DATASET", member:"MEMBER"
deleteDatasetsByMask mask:"EXAMPLE.DATASET.*"
deleteDataset dsn:"EXAMPLE.DATASET", failOnNotExist:"False"
deleteDataset dsn:"EXAMPLE.DATASET", member:"MEMBER", failOnNotExist:"True"
deleteDatasetsByMask mask:"EXAMPLE.DATASET.*", failOnNotExist:"False"
}
// ...
}
Expand All @@ -70,14 +70,38 @@ stage ("stage-name") {

### allocateDS - Represents an action for allocating a dataset in a declarative style
```groovy
allocateDS dsn:"EXAMPLE.DATASET", dsOrg:"PS", primary:1, secondary:1, recFm:"FB"
zosmf ("z/os-connection-name") {
allocateDS(
// Mandatory Parameters below:
dsn: "EXAMPLE.DATASET",
dsOrg: "PS",
primary: 1,
secondary: 1,
recFm: "FB",
failOnExist:"False",
// Optional Parameters below:
volser:"YOURVOL",
unit:"SYSDA",
alcUnit:"TRK",
dirBlk:"5",
blkSize:"800",
lrecl:"80",
storClass:"STORAGECLASS",
mgntClass:"MGMTCLASS",
dataClass:"DATACLASS",
avgBlk:"10",
dsnType:"LIBRARY",
dsModel:"MODEL.DATASET.NAME"
)
}
```
**Mandatory Parameters:**
* ```dsn:"EXAMPLE.DATASET"``` - The name of the dataset to be allocated
* ```dsOrg:"PS"``` - The dataset organization (could be only PO, POE, PS, VS)
* ```primary:"1"``` - The primary allocation size in cylinders or tracks
* ```secondary:"1"``` - The secondary allocation size in cylinders or tracks
* ```recFm:"FB"``` - The record format (could be only F, FB, V, VB, U, VSAM, VA)
* ```failOnExist:"False"``` - If the dataset already exists and the option is enabled, execution will halt. (Boolean parameter, is set to 'False' by default)

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

### deleteDataset - Represents an action for deleting datasets and members in a declarative style
```groovy
deleteDataset dsn:"EXAMPLE.DATASET"
zosmf ("z/os-connection-name") {
deleteDataset dsn: "EXAMPLE.DATASET", member:"MEMBER", failOnNotExist:"False"
}
```
**Mandatory Parameters:**
* ```dsn:"EXAMPLE.DATASET"``` - Sequential or library dataset name for deletion
* ```member:"MEMBER"``` - Dataset member name for deletion
* ```failOnNotExist:"False"``` - If the dataset has been deleted and the option is enabled, execution will halt. (Boolean parameter, is set to 'False' by default)

**Expected behavior under various deletion scenarios:**

* To delete a member from the library, the dsn and member parameters must be specified:
```
deleteDataset dsn:"EXAMPLE.DATASET", member:"MEMBER"
deleteDataset dsn:"EXAMPLE.DATASET", member:"MEMBER", failOnNotExist:"False"
```
* You cannot delete a VSAM dataset this way. Otherwise, you will get output similar to:
Expand Down Expand Up @@ -176,7 +203,7 @@ Pipeline can be used either directly inside the ```Pipeline``` code block in the
This pipeline example uses all currently available methods and functionality of the Zowe zDevOps plugin.
**Steps to Execute the Pipeline:**
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.
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.
2. Create a new Jenkins item -> ```Pipeline``` and open its configuration.
3. In the ```Pipeline``` section, paste the code from the example below and replace all the necessary variables with your data
4. Done, enjoy the minimal ready-made pipeline template!
Expand Down Expand Up @@ -217,9 +244,9 @@ pipeline {
stage('Allocate DSs') {
steps {
zosmf("${ZOS_CONN_ID}") {
allocateDS dsn:"${PS_DATASET_1}", dsOrg:"PS", primary:1, secondary:1, recFm:"FB"
allocateDS dsn:"${PS_DATASET_2}", dsOrg:"PS", primary:1, secondary:1, recFm:"FB", alcUnit:"TRK"
allocateDS dsn:"${PO_DATASET}(${PO_MEMBER})", dsOrg:"PO", primary:1, secondary:1, recFm:"FB"
allocateDS dsn:"${PS_DATASET_1}", dsOrg:"PS", primary:1, secondary:1, recFm:"FB", failOnExist:"False"
allocateDS dsn:"${PS_DATASET_2}", dsOrg:"PS", primary:1, secondary:1, recFm:"FB", alcUnit:"TRK", failOnExist:"False"
allocateDS dsn:"${PO_DATASET}(${PO_MEMBER})", dsOrg:"PO", primary:1, secondary:1, recFm:"FB", failOnExist:"False"
}
}
}
Expand Down Expand Up @@ -270,8 +297,8 @@ pipeline {
stage('Clean up') {
steps {
zosmf("${ZOS_CONN_ID}") {
deleteDataset dsn:"${PS_DATASET_1}"
deleteDatasetsByMask mask:"${HLQ}.NEW.*"
deleteDataset dsn:"${PS_DATASET_1}", failOnNotExist:"False"
deleteDatasetsByMask mask:"${HLQ}.NEW.*", failOnNotExist:"True"
}
}
}
Expand Down Expand Up @@ -321,7 +348,7 @@ The plugin are packaged as self-contained <b>.hpi</b> files, which have all the
### <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>

Assuming a <b>.hpi</b> file has been downloaded, a logged-in Jenkins administrator may upload the file from within the web UI:
1. Navigate to the <b>Manage Jenkins > Manage Plugins</b> page in the web UI.
1. Navigate to the <b>Manage Jenkins > Plugins</b> page in the web UI.
2. Click on the <b>Advanced</b> tab.
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.
4. <b>Deploy</b> the plugin file.
Expand All @@ -332,8 +359,8 @@ Assuming a <b>.hpi</b> file has been downloaded, a logged-in Jenkins administrat
3. To generate the ```target``` dir with generated-sources - you have to run the Maven command: ```mvn localizer:generate```
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```.
5. After building the .hpi/.jpi file, it should appear in a <b><Plugin-project-name>/build/libs/<hpi_file_name>.hpi</b> directory
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).
7. Click <b>Deploy</b>, reboot Jenkins after installation. The Plugin is ready to go!
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).
7. Click <b>'Deploy'</b>, reboot Jenkins after installation. The Plugin is ready to go!

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

Expand Down
28 changes: 17 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@
<relativePath />
</parent>

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

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


<properties>
<revision>0.3.0</revision>
<changelist>-SNAPSHOT</changelist>
<revision>1.2.0</revision>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.414.3</jenkins.version>
<java.version>17</java.version>
<kotlin.version>1.9.20</kotlin.version>
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<sezpoz.version>1.13</sezpoz.version>
<okhttp3.version>4.10.0</okhttp3.version>
<zowekotlinsdk.version>0.5.0-rc.11</zowekotlinsdk.version>
<zowekotlinsdk.version>0.5.0</zowekotlinsdk.version>
<kotest.version>5.6.1</kotest.version>
<kotlin.code.style>official</kotlin.code.style>
<kotlin.compiler.jvmTarget>17</kotlin.compiler.jvmTarget>
Expand Down Expand Up @@ -62,8 +61,8 @@
</developers>

<scm>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>
<connection>scm:git:https://github.com/${gitHubRepo}</connection>
<developerConnection>scm:git:https://github.com/${gitHubRepo}</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>
Expand Down Expand Up @@ -336,7 +335,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
<version>2.3</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -372,7 +371,13 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.11.0</version>
</dependency>

<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.27.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -460,7 +465,8 @@
</repository>

<repository>
<id>zowe.jfrog.io</id>
<!-- Do not change the ID - ref. https://github.com/jenkins-infra/helpdesk/issues/3501 -->
<id>org.zowe.sdk</id>
<url>https://zowe.jfrog.io/artifactory/libs-release</url>
</repository>
</repositories>
Expand Down

0 comments on commit 693e161

Please sign in to comment.