Unstash a file from a slave node to another slave node
up vote
0
down vote
favorite
Using a declarative Jenkinsfile with a script embedded in it, I am trying to unstash a file from a slave node to another slave node. However, this code:
stage('Unstash key generation script and assign a cron to is if they dont exist'){
agent{
label 'generate'
}
steps {
script{
def cronExists = fileExists 'myCron'
if(!cronExists){
node('generate'){
node('build'){
stash includes: '/var/jenkins/workspace/q-go-pipeline/generateSigningKey.sh', name: 'generate-key'
}
unstash 'generate-key'
}
sh 'echo "*/5 * * * * /var/jenkins/workspace/q-go-pipeline/generateSigningKey.sh" >> myCron'
sh 'crontab myCron'
}
}
}
}
Is generating a stash error ERROR: No files included in stash
. But when I go on the build
node and cat the file, it exists.
The general gist is that if a file cronExists
does not exist on the slave, then grab a stashed file from the build node, put it onto the generate node, then run that script every 5 minutes. If the file does exist, it will skil this step and just sign a file with a another script.
jenkins jenkins-pipeline
add a comment |
up vote
0
down vote
favorite
Using a declarative Jenkinsfile with a script embedded in it, I am trying to unstash a file from a slave node to another slave node. However, this code:
stage('Unstash key generation script and assign a cron to is if they dont exist'){
agent{
label 'generate'
}
steps {
script{
def cronExists = fileExists 'myCron'
if(!cronExists){
node('generate'){
node('build'){
stash includes: '/var/jenkins/workspace/q-go-pipeline/generateSigningKey.sh', name: 'generate-key'
}
unstash 'generate-key'
}
sh 'echo "*/5 * * * * /var/jenkins/workspace/q-go-pipeline/generateSigningKey.sh" >> myCron'
sh 'crontab myCron'
}
}
}
}
Is generating a stash error ERROR: No files included in stash
. But when I go on the build
node and cat the file, it exists.
The general gist is that if a file cronExists
does not exist on the slave, then grab a stashed file from the build node, put it onto the generate node, then run that script every 5 minutes. If the file does exist, it will skil this step and just sign a file with a another script.
jenkins jenkins-pipeline
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Using a declarative Jenkinsfile with a script embedded in it, I am trying to unstash a file from a slave node to another slave node. However, this code:
stage('Unstash key generation script and assign a cron to is if they dont exist'){
agent{
label 'generate'
}
steps {
script{
def cronExists = fileExists 'myCron'
if(!cronExists){
node('generate'){
node('build'){
stash includes: '/var/jenkins/workspace/q-go-pipeline/generateSigningKey.sh', name: 'generate-key'
}
unstash 'generate-key'
}
sh 'echo "*/5 * * * * /var/jenkins/workspace/q-go-pipeline/generateSigningKey.sh" >> myCron'
sh 'crontab myCron'
}
}
}
}
Is generating a stash error ERROR: No files included in stash
. But when I go on the build
node and cat the file, it exists.
The general gist is that if a file cronExists
does not exist on the slave, then grab a stashed file from the build node, put it onto the generate node, then run that script every 5 minutes. If the file does exist, it will skil this step and just sign a file with a another script.
jenkins jenkins-pipeline
Using a declarative Jenkinsfile with a script embedded in it, I am trying to unstash a file from a slave node to another slave node. However, this code:
stage('Unstash key generation script and assign a cron to is if they dont exist'){
agent{
label 'generate'
}
steps {
script{
def cronExists = fileExists 'myCron'
if(!cronExists){
node('generate'){
node('build'){
stash includes: '/var/jenkins/workspace/q-go-pipeline/generateSigningKey.sh', name: 'generate-key'
}
unstash 'generate-key'
}
sh 'echo "*/5 * * * * /var/jenkins/workspace/q-go-pipeline/generateSigningKey.sh" >> myCron'
sh 'crontab myCron'
}
}
}
}
Is generating a stash error ERROR: No files included in stash
. But when I go on the build
node and cat the file, it exists.
The general gist is that if a file cronExists
does not exist on the slave, then grab a stashed file from the build node, put it onto the generate node, then run that script every 5 minutes. If the file does exist, it will skil this step and just sign a file with a another script.
jenkins jenkins-pipeline
jenkins jenkins-pipeline
asked Nov 13 at 22:29
intRG
13
13
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290482%2funstash-a-file-from-a-slave-node-to-another-slave-node%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown