-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Anatoli Kalbasin <[email protected]>
- Loading branch information
1 parent
95f7d6c
commit cd92c44
Showing
3 changed files
with
267 additions
and
2 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
src/main/kotlin/org/zowe/zdevops/declarative/jobs/WriteDirToDatasetDeclarative.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (c) 2025 IBA Group. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* IBA Group | ||
* Zowe Community | ||
*/ | ||
|
||
package org.zowe.zdevops.declarative.jobs | ||
|
||
import hudson.EnvVars | ||
import hudson.Extension | ||
import hudson.FilePath | ||
import hudson.Launcher | ||
import hudson.model.Run | ||
import hudson.model.TaskListener | ||
import org.jenkinsci.Symbol | ||
import org.kohsuke.stapler.DataBoundConstructor | ||
import org.zowe.kotlinsdk.zowe.client.sdk.core.ZOSConnection | ||
import org.zowe.zdevops.declarative.AbstractZosmfAction | ||
import org.zowe.zdevops.logic.writeDirectoryToDataset | ||
|
||
/** | ||
* A declarative class for writing the contents of a directory to a PDS/E dataset. | ||
* | ||
* This class is designed to be used within a Jenkins pipeline as a step that writes files from a directory | ||
* to a specified z/OS dataset. It supports both local and build workspace-relative directory paths. | ||
* | ||
* @param dsn the dataset name (DSN) where the contents of the directory will be written. | ||
* @param dir the path to the directory containing the files to be written. | ||
* @param isLocalPath a flag indicating if the directory path is local (true) or relative to the build workspace (false). | ||
*/ | ||
class WriteDirToDatasetDeclarative | ||
@DataBoundConstructor constructor( | ||
private val dsn: String, | ||
private val dir: String, | ||
private val isLocalPath: Boolean = false, | ||
) : AbstractZosmfAction() { | ||
|
||
fun getDsn(): String { | ||
return dsn | ||
} | ||
|
||
fun getDir(): String { | ||
return dir | ||
} | ||
|
||
fun getIsLocalPath(): Boolean { | ||
return isLocalPath | ||
} | ||
|
||
override val exceptionMessage: String = zMessages.zdevops_declarative_writing_DS_fail(dsn) | ||
|
||
|
||
override fun perform( | ||
run: Run<*, *>, | ||
workspace: FilePath, | ||
env: EnvVars, | ||
launcher: Launcher, | ||
listener: TaskListener, | ||
zosConnection: ZOSConnection | ||
) { | ||
writeDirectoryToDataset(dsn, dir, isLocalPath, workspace, listener, zosConnection) | ||
} | ||
|
||
@Symbol("writeDirToDS") | ||
@Extension | ||
class DescriptorImpl : Companion.DefaultBuildDescriptor("Write directory to PDS Dataset Declarative") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters