Required to copy/clone/fetch files from GIT and place them to NASPATH(Unix server) using Jenkins Job. Does any has done this earlier ?
Required to copy/clone/fetch files from GIT and place them to NASPATH(Unix server) using Jenkins Job. Does any has done this earlier ?
With a plugin like Custom workspace path, you could define the path where the Jenkins pipeline does checkout your repository, using the path you need.
For instance, a file mount on a remote NAS device, as mentioned in JENKINS-48435
Using pipelines, you can do any git action and file copying to any location accessible by jenkins. A declarative pipeline to do this could look like this:
pipeline {
agent any
environment {
source_repo = 'https://your.repo/sitory.git'
source_path = 'path/of/file/in/repo'
target_path = '/location/to/nas'
}
stages {
// checkout
stage ("checkout") {
steps {
git url: source_repo
}
}
stage ("copy") {
steps {
sh 'cp $source_path $target_path'
}
}
}
}
This is obviously simplyified and onyl a proof of concept, as you did only provide a basic idea of what you want to achieve with some details missing. More below.
Notes:
sh step ist only availabe on linux servers, and so is, obviously cp. On windows, use a bat step with copy instead.