Answer the question
In order to leave comments, you need to log in
What is the right way to run pipeline update sub modules?
I want to reuse the template pipeline in the pipeline of the project in a smaller way, which, like bricks, lie in the sub module
in git, there is a repo with the project and tried it with jenkins-ci-examples
in the project first like this
pipeline {
agent any
stages {
stage ('Checkout') {
steps {
deleteDir()
checkout scm
sh 'git submodule update --init --recursive jenkins-ci-examples'
}
}
stage('test import template') {
steps {
script{
sh "cd jenkins-ci-examples; ls -las";
jenkins_ci_examples.test_module = load "first_template.groovy"
}
}
}
stage('test run template') {
steps {
script{
jenkins_ci_examples.test_module.ansible_sskkeys("vars")
}
}
}
}
}
node{
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: false,
extensions: ,
submoduleCfg: [],
userRemoteConfigs: scm.userRemoteConfigs
])
}
Answer the question
In order to leave comments, you need to log in
the issue was resolved in this way
sh "git submodule foreach --recursive git pull origin master";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question