From a4af79a4f38c3808a01b41e544181c7ae4139c27 Mon Sep 17 00:00:00 2001 From: IBA-mainframe-dev Date: Tue, 23 Jul 2024 13:35:07 +0300 Subject: [PATCH 1/5] Added Use case pipeline example with some description in README.md --- README.md | 299 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 252 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 16aa3b4..146bef8 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,13 @@ ## About the plugin The Zowe zDevOps Jenkins Plugin by [IBA Group](https://ibagroupit.com/?utm_campaign=IBA_W-Mainframe&utm_source=jenkins&utm_medium=referral&utm_content=description_zdevops) is an open-source, secure , and reliable agent-less Jenkins plugin that makes it possible to perform most of the actual tasks on the mainframe, managing it with a modern native mainframe zOSMF REST API and the capabilities of available zOSMF SDKs. -## Advantages +## Main features - Secure and modern connection of Jenkins to the mainframes through the use of zOSMF REST API. - The functionality is based on the Kotlin SDK methods, such as JCL jobs submission, download, allocate, write to the dataset, etc., with a log collected upon completion. -- Multiple connections to various mainframes—z/OS Connections List where you can save all the necessary systems and credentials; all data is safely stored under the protection of Jenkins Credentials manager. -- Agent-less. +- Multiple connections to various mainframes — z/OS Connections List where you can save all the necessary systems and credentials (all data is safely stored under the protection of Jenkins Credentials manager). +- Agent-less solution. - z/OSMF connection validation. +- Convenient user interface panels for working with the mainframe - Fast execution and functional extensibility. ## About us @@ -24,6 +25,254 @@ Please feel free to contact us or schedule a call with our Mainframe DevOps expe 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 - “z/OS Connection List” +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://:``` +4. Add credentials (Mainframe User ID + Password) under which you can connect to the system. + +You can save as many connections as you like, the system will keep the corresponding user IDs/passwords. + +## Declarative methods brief list +```groovy +stage ("stage-name") { + steps { + // ... + zosmf("z/os-connection-name") { + submitJob "//'EXAMPLE.DATASET(MEMBER)'" + 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" + writeFileToDS dsn:"EXAMPLE.DATASET", file:"workspaceFile" + writeFileToDS dsn:"EXAMPLE.DATASET", file:"D:\\files\\localFile" + writeToDS dsn:"EXAMPLE.DATASET", text:"Write this string to dataset" + writeFileToMember dsn:"EXAMPLE.DATASET", member:"MEMBER", file:"workspaceFile" + writeFileToMember dsn:"EXAMPLE.DATASET", member:"MEMBER", file:"D:\\files\\localFile" + writeToMember dsn:"EXAMPLE.DATASET", member:"MEMBER", text:"Write this string to member" + + writeToFile destFile: "u/USER/myfile", text: "Write this string to file" + 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.*" + } + // ... + } +} +``` + +## Declarative Methods Detail Description + +### 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" +``` +**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) + +**Optional parms:** + * ```volser:"YOURVOL"``` - Volume serial number where the dataset will be allocated. + * ```unit:"SYSDA"``` - Specifies the type of storage device. SYSDA is a common direct access storage device. + * ```alcUnit:"TRK"``` - Allocation units (CYL for cylinders, TRK for tracks). + * ```dirBlk:"5"``` - Directory block records. + * ```blkSize:"800"``` - BLKSIZE=800: Block size of 800 bytes. + * ```lrecl:"80"``` - Logical record length. + * ```storClass:"STORAGECLASS"``` - Storage class for SMS-managed datasets. + * ```mgntClass:"MGMTCLASS"``` - Management class for SMS-managed datasets. + * ```dataClass:"DATACLASS"``` - Data class for SMS-managed datasets. + * ```avgBlk:"10"``` - Average block length. + * ```dsnType:"LIBRARY"``` - Specifies the type of dataset, LIBRARY for a PDS or PDSE. + * ```dsModel:"MODEL.DATASET.NAME"``` - Data set model is a predefined set of attributes that can be used to allocate new data sets with the same characteristics ("LIKE" parameter). + + +### deleteDataset - Represents an action for deleting datasets and members in a declarative style +```groovy +deleteDataset dsn:"EXAMPLE.DATASET" +``` +**Mandatory Parameters:** + * ```dsn:"EXAMPLE.DATASET"``` - Sequential or library dataset name for deletion + * ```member:"MEMBER"``` - Dataset member name for deletion + +**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" + ``` + +* You cannot delete a VSAM dataset this way. Otherwise, you will get output similar to: + ``` + Deleting dataset EXAMPLE.VSAM.DATASET with connection :10443 + ISRZ002 Deallocation failed - Deallocation failed for data set 'EXAMPLE.VSAM.DATASET' + ``` + +* What do you get if a dataset does not exist? + + ``` + Deleting dataset EXAMPLE.DS.DOES.NOT.EXIST with connection :10443 + ISRZ002 Data set not cataloged - 'EXAMPLE.DS.DOES.NOT.EXIST' was not found in catalog. + ``` + +* What do you get if a dataset is busy by a user or a program? + + ``` + Deleting dataset EXAMPLE.DS.ISUSED.BY.USER with connection :10443 + ISRZ002 Data set in use - Data set 'EXAMPLE.DS.ISUSED.BY.USER' in use by another user, try later or enter HELP for a list of jobs and users allocated to 'EXAMPLE.DS.ISUSED.BY.USER'. + ``` + +## Use case example +Here you can find an example of a minimal declarative Jenkins pipeline for execution, testing and further modification for your personal needs. +Pipeline can be used either directly inside the ```Pipeline``` code block in the Jenkins server, or in a ```Jenkinsfile``` stored in Git +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 (“Manage Jenkins” -> “Configure System / System” -> z/OS Connection List). 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! + +```groovy +pipeline { + agent any + + environment { + // Define environment variables + GIT_REPOSITORY_URL = 'https://github.com/your-username/your-repo.git' // Replace with your GitHub URL + GIT_BRANCH = 'main' // Replace with your GitHub branch name + GIT_USER_CREDENTIAL_ID = 'jenkins-cred-key' // Replace with your Jenkins GitHub credential ID + ZOS_CONN_ID = 'z/os-connection-name' // Replace with your z/OS Connection ID from zDevOps plugin settings + HLQ = 'HLQ' // Replace with your z/OS high-level qualifier (HLQ) + PS_DATASET_1 = "${HLQ}.NEW.TEST1" // OPTIONAL: Replace with the dataset names you need + PS_DATASET_2 = "${HLQ}.NEW.TEST2" // OPTIONAL + PO_DATASET = "${HLQ}.NEW.TEST3" // OPTIONAL + PO_MEMBER = "NEWMEM" // OPTIONAL + JCL_JOB_TEMPLATE = "jcl_job_example" // Replace with the name of your file that contains the JCL job code + JIRA_URL = 'https://your-jira-instance.atlassian.net' // Replace with your Jira URL + JIRA_USER = 'your-jira-email@example.com' // Replace with your Jira user email + JIRA_API_TOKEN = 'your-jira-api-token' // Replace with your Jira API token + JIRA_ISSUE_KEY = 'PROJECT-123' // Replace with your Jira issue key + } + + stages { + stage('Checkout') { + steps { + // Checkout the source code from Git + checkout scmGit( + branches: [[name: "${GIT_BRANCH}"]], + userRemoteConfigs: [[credentialsId: "${GIT_USER_CREDENTIAL_ID}", + url: "${GIT_REPOSITORY_URL}"]]) + } + } + + 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" + } + } + } + + stage('Add JCL content') { + steps { + script { + // Read the content of the JCL job into a variable + env.JCL_CONTENT = readFile("${JCL_JOB_TEMPLATE}").trim() + // Print the content of the file (for debugging purposes) + echo "JCL job content:\n${env.JCL_CONTENT}" + } + zosmf("${ZOS_CONN_ID}") { + writeFileToDS dsn:"${PS_DATASET_2}", file:"${JCL_JOB_TEMPLATE}" + writeFileToMember dsn:"${PO_DATASET}", member:"${PO_MEMBER}", file:"${JCL_JOB_TEMPLATE}" + writeToDS dsn:"${PS_DATASET_1}", text:"${env.JCL_CONTENT}" + } + } + } + + stage('Add USS content') { + steps { + zosmf("${ZOS_CONN_ID}") { + writeToFile destFile: "u/${HLQ}/test_file1", text: "${env.JCL_CONTENT}" + writeFileToFile destFile: "u/${HLQ}/test_file2", sourceFile: "${JCL_JOB_TEMPLATE}", binary: "true" + } + } + } + + stage('Submit JCL jobs') { + steps { + zosmf("${ZOS_CONN_ID}") { + submitJob "//'${PS_DATASET_1}'" + submitJobSync "//'${PO_DATASET}(NEWMEM)'" + } + } + } + + stage('Download datasets') { + steps { + zosmf("${ZOS_CONN_ID}") { + downloadDS "${PS_DATASET_1}" + downloadDS dsn:"${PS_DATASET_2}" + } + } + } + + stage('Clean up') { + steps { + zosmf("${ZOS_CONN_ID}") { + deleteDataset dsn:"${PS_DATASET_1}" + deleteDatasetsByMask mask:"${HLQ}.NEW.*" + } + } + } + } + + post { + always { + script { + def jiraStatus = currentBuild.currentResult == 'SUCCESS' ? 'Build Successful' : 'Build Failed' + def jiraComment = """ + { + "body": "Jenkins build ${jiraStatus} for Job ${env.JOB_NAME} - Build #${env.BUILD_NUMBER}. + [View the build here|${env.BUILD_URL}]" + } + """ + + httpRequest acceptType: 'APPLICATION_JSON', + contentType: 'APPLICATION_JSON', + httpMode: 'POST', + requestBody: jiraComment, + url: "${JIRA_URL}/rest/api/2/issue/${JIRA_ISSUE_KEY}/comment", + authentication: 'jira-credentials-id' + } + } + + success { + // Notify success (example: send email) + mail to: '${JIRA_USER}', + subject: "SUCCESS: Build ${env.BUILD_NUMBER}", + body: "The build ${env.BUILD_NUMBER} was successful." + } + + failure { + // Notify failure (example: send email) + mail to: '${JIRA_USER}', + subject: "FAILURE: Build ${env.BUILD_NUMBER}", + body: "The build ${env.BUILD_NUMBER} failed. Please check the Jenkins logs for more details." + } + } +} +``` + ## Manual plugin installation by the .hpi executable file The plugin are packaged as self-contained .hpi files, which have all the necessary code, images, and other resources which the plugin needs to operate successfully. @@ -45,50 +294,6 @@ Assuming a .hpi file has been downloaded, a logged-in Jenkins administrat 6. Next you need to login into the Jenkins, move to the “Manage Jenkins” -> “Manage Plugins” -> “Advanced (tab)” -> “Deploy Plugin” (You can select a plugin file from your local system or provide a URL to install a plugin from outside the central plugin repository) -> Specify the path to the generated .hpi/.jpi file (or by dragging the file from Intellij IDEA project to the file upload field in the Jenkins). 7. Click “Deploy”, reboot Jenkins after installation. The Plugin is ready to go! -## 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” -> scroll down and find the panel with the name - “z/OS Connection List” -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 the call 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://:``` -4. Add credentials (Mainframe User ID + Password) under which you can connect to the system. - -You can save as many connections as you like, the system will keep the corresponding user IDs/passwords. - -## Use case -- Add a zosmf connection in settings (Manage Jenkins -> Configure System -> z/OS Connection List). Enter a connection name, zosmf url, username and password. -- Create a new item -> ```Pipeline``` and open its configuration. - Create a zosmf section inside the steps of the stage and pass the connection name as a parameter of the section. Inside the zosmf body invoke necessary zosmf functions (they will be automatically done in a specified connection context). Take a look at the example below: -```groovy -stage ("stage-name") { - steps { - // ... - zosmf("z/os-connection-name") { - submitJob "//'EXAMPLE.DATASET(JCLJOB)'" - submitJobSync "//'EXAMPLE.DATASET(JCLJOB)'" - downloadDS "USER.LIB(MEMBER)" - downloadDS dsn:"USER.LIB(MEMBER)", vol:"VOL001" - allocateDS dsn:"STV.TEST5", alcUnit:"TRK", dsOrg:"PS", primary:1, secondary:1, recFm:"FB" - writeFileToDS dsn:"USER.DATASET", file:"workspaceFile" - writeFileToDS dsn:"USER.DATASET", file:"D:\\files\\localFile" - writeToDS dsn:"USER.DATASET", text:"Write this string to dataset" - writeFileToMember dsn:"USER.DATASET", member:"MEMBER", file:"workspaceFile" - writeFileToMember dsn:"USER.DATASET", member:"MEMBER", file:"D:\\files\\localFile" - writeToMember dsn:"USER.DATASET", member:"MEMBER", text:"Write this string to member" - - writeToFile destFile: "u/USER/doc", text: "Hello there" - writeFileToFile destFile: "u/USER/doc", sourceFile: "myfile.txt" - writeFileToFile destFile: "u/USER/doc", sourceFile: "myfile.txt", binary: "true" - - deleteDataset dsn:"USER.DATASET" - deleteDataset dsn:"USER.DATASET", member:"MEMBER1" - deleteDatasetsByMask mask:"USER.DATASET.*" - } - // ... - } -} -``` - ## How to run Jenkins plugin in Debug mode in a local Jenkins sandbox For debugging purposes run following Maven command from plugin project directory: From 9f2e5b42404b89da15e678040e534fdee914248e Mon Sep 17 00:00:00 2001 From: Ilya Abnitski <124044159+abnitski-ilya@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:34:48 +0200 Subject: [PATCH 2/5] Resolved issues in README.md Signed-off-by: Ilya Abnitski <124044159+abnitski-ilya@users.noreply.github.com> --- README.md | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 146bef8..a82adcb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Zowe zDevOps Jenkins plugin -## About the plugin +## About the plugin The Zowe zDevOps Jenkins Plugin by [IBA Group](https://ibagroupit.com/?utm_campaign=IBA_W-Mainframe&utm_source=jenkins&utm_medium=referral&utm_content=description_zdevops) is an open-source, secure , and reliable agent-less Jenkins plugin that makes it possible to perform most of the actual tasks on the mainframe, managing it with a modern native mainframe zOSMF REST API and the capabilities of available zOSMF SDKs. ## Main features @@ -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 - “z/OS Connection List” +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 - 'z/OS Connection List' 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://:``` @@ -70,7 +70,29 @@ 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", + // 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 @@ -96,7 +118,9 @@ 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" +} ``` **Mandatory Parameters:** * ```dsn:"EXAMPLE.DATASET"``` - Sequential or library dataset name for deletion @@ -135,7 +159,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 (“Manage Jenkins” -> “Configure System / System” -> z/OS Connection List). Enter a connection name, zosmf url, username and password. +1. Add a zosmf connection in settings ('Manage Jenkins' -> 'Configure System / System' -> z/OS Connection List). 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! @@ -280,7 +304,7 @@ The plugin are packaged as self-contained .hpi files, which have all the ### [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) Assuming a .hpi file has been downloaded, a logged-in Jenkins administrator may upload the file from within the web UI: -1. Navigate to the Manage Jenkins > Manage Plugins page in the web UI. +1. Navigate to the Manage Jenkins > Plugins page in the web UI. 2. Click on the Advanced tab. 3. Choose the .hpi file from your system or enter a URL to the archive file under the Deploy Plugin section. 4. Deploy the plugin file. @@ -291,8 +315,8 @@ Assuming a .hpi 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 /build/libs/.hpi directory -6. Next you need to login into the Jenkins, move to the “Manage Jenkins” -> “Manage Plugins” -> “Advanced (tab)” -> “Deploy Plugin” (You can select a plugin file from your local system or provide a URL to install a plugin from outside the central plugin repository) -> Specify the path to the generated .hpi/.jpi file (or by dragging the file from Intellij IDEA project to the file upload field in the Jenkins). -7. Click “Deploy”, reboot Jenkins after installation. The Plugin is ready to go! +6. Next you need to login into the Jenkins, move to the 'Manage Jenkins' -> 'Plugins' -> 'Advanced settings (tab)' -> 'Deploy Plugin' (You can select a plugin file from your local system or provide a URL to install a plugin from outside the central plugin repository) -> Specify the path to the generated .hpi/.jpi file (or by dragging the file from Intellij IDEA project to the file upload field in the Jenkins). +7. Click 'Deploy', reboot Jenkins after installation. The Plugin is ready to go! ## How to run Jenkins plugin in Debug mode in a local Jenkins sandbox From 13fef32eeb3b74e0c80fa0a4e5731316ee372527 Mon Sep 17 00:00:00 2001 From: IBA-mainframe-dev Date: Thu, 24 Oct 2024 13:20:44 +0200 Subject: [PATCH 3/5] 0.2.0 Release preparation --- .github/dependabot.yml | 14 +++++--------- .github/release-drafter.yml | 3 +-- .github/workflows/cd.yaml | 15 +++++++++++++++ .github/workflows/release-drafter.yml | 17 ----------------- .mvn/extensions.xml | 2 +- .mvn/maven.config | 2 +- Jenkinsfile | 2 +- pom.xml | 9 ++++----- 8 files changed, 28 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/cd.yaml delete mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5350178..7c29335 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -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" \ No newline at end of file + interval: monthly \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 4ec641f..4ed532e 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,3 +1,2 @@ # https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc -_extends: .github -tag-template: zdevops-$NEXT_MINOR_VERSION \ No newline at end of file +_extends: .github \ No newline at end of file diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 0000000..64a6693 --- /dev/null +++ b/.github/workflows/cd.yaml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 281fade..0000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Note: additional setup is required, see https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc - -name: Release Drafter - -on: - push: - branches: - - "main" - -jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - # Drafts your next Release notes as Pull Requests are merged into the default branch - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 80a2e47..34fc756 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -2,6 +2,6 @@ io.jenkins.tools.incrementals git-changelist-maven-extension - 1.6 + 1.8 \ No newline at end of file diff --git a/.mvn/maven.config b/.mvn/maven.config index 2582cab..61cf4e5 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1,3 +1,3 @@ -Pconsume-incrementals -Pmight-produce-incrementals --DaltDeploymentRepository=maven.jenkins-ci.org::default::https://repo.jenkins-ci.org/releases/ \ No newline at end of file +-Dchangelist.format=%d.v%s \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 12f6a8d..da6f699 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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' ]]) diff --git a/pom.xml b/pom.xml index 2a9f4d9..c65d50f 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ - org.zowe + io.jenkins.plugins zdevops ${revision}${changelist} Zowe zDevOps @@ -17,9 +17,8 @@ https://github.com/jenkinsci/${project.artifactId}-plugin - - 0.2.0 + 1.2.0- -SNAPSHOT 2.414.3 17 @@ -62,8 +61,8 @@ - scm:git:https://github.com/${gitHubRepo}.git - scm:git:git@github.com:${gitHubRepo}.git + scm:git:https://github.com/${gitHubRepo} + scm:git:https://github.com/${gitHubRepo} https://github.com/${gitHubRepo} ${scmTag} From d76d414ee77703aab072ad2ba84eb63189857058 Mon Sep 17 00:00:00 2001 From: IBA-mainframe-dev Date: Thu, 24 Oct 2024 14:05:58 +0200 Subject: [PATCH 4/5] Added failOnExist parameter description in README and CHANGELOG --- CHANGELOG.md | 1 + README.md | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91ab51b..b967071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index a82adcb..370496b 100644 --- a/README.md +++ b/README.md @@ -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" @@ -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" } // ... } @@ -78,6 +78,7 @@ zosmf ("z/os-connection-name") { primary: 1, secondary: 1, recFm: "FB", + failOnExist:"False", // Optional Parameters below: volser:"YOURVOL", unit:"SYSDA", @@ -100,6 +101,7 @@ zosmf ("z/os-connection-name") { * ```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. @@ -119,18 +121,19 @@ zosmf ("z/os-connection-name") { ### deleteDataset - Represents an action for deleting datasets and members in a declarative style ```groovy zosmf ("z/os-connection-name") { - deleteDataset dsn: "EXAMPLE.DATASET", member:"MEMBER" + 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: @@ -200,9 +203,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" } } } @@ -253,8 +256,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" } } } From 090bfacdb89b8321f6433e00387a436505693468 Mon Sep 17 00:00:00 2001 From: IBA-mainframe-dev Date: Fri, 8 Nov 2024 12:32:43 +0100 Subject: [PATCH 5/5] Synchronizing changes with the Jenkins CI repo --- .github/workflows/jenkins-security-scan.yml | 21 +++++++++++++++++++++ pom.xml | 21 ++++++++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/jenkins-security-scan.yml diff --git a/.github/workflows/jenkins-security-scan.yml b/.github/workflows/jenkins-security-scan.yml new file mode 100644 index 0000000..6fc0b2b --- /dev/null +++ b/.github/workflows/jenkins-security-scan.yml @@ -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. diff --git a/pom.xml b/pom.xml index c65d50f..f0917a9 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ io.jenkins.plugins zdevops - ${revision}${changelist} + ${revision}.${changelist} Zowe zDevOps hpi Zowe mainframe z/OS automation plugin, working through z/OSMF REST API and using Zowe Kotlin SDK @@ -18,15 +18,15 @@ https://github.com/jenkinsci/${project.artifactId}-plugin - 1.2.0- - -SNAPSHOT + 1.1.1 + 999999-SNAPSHOT 2.414.3 17 1.9.20 true 1.13 4.10.0 - 0.5.0-rc.11 + 0.5.0 5.6.1 official 17 @@ -335,7 +335,7 @@ org.yaml snakeyaml - 2.2 + 2.3 @@ -371,7 +371,13 @@ com.google.code.gson gson - 2.10.1 + 2.11.0 + + + + com.google.errorprone + error_prone_annotations + 2.27.0 @@ -459,7 +465,8 @@ - zowe.jfrog.io + + org.zowe.sdk https://zowe.jfrog.io/artifactory/libs-release