Когда я помещаю синтаксис GitSCM, сгенерированный с помощью генератора конвейерного синтаксиса, в сценарий Jenkinsfile, он, кажется, работает нормально.
Jenkinsfile:
node('Maven Agent') {
stage('Checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'Github-Creds', url: 'https://github.com/some-user/some-repo.git']]]);
}
}
Однако, как только я Вытащите сцену и поместите ее в функцию общей библиотеки groovy и вызовите функцию из файла Jenkinsfile, она выдаст мне ошибку переполнения стека после многократного рекурсивного запуска.
Модифицированный файл Jenkinsfile:
node('Maven Agent') {
ci.checkout();
}
Функция совместно используемой библиотеки:
def checkout(Map config=[:], Closure body={}) {
stage('Check Out')
{
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'Github-ims-devops-practice', url: 'https://github.com/ims-devops-practice/spec-files.git']]]);
}
}
Журнал консоли выглядит следующим образом:
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Maven Agent in /home/ec2-user/workspace/springboot-pipeline@5
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Check Out)
[Pipeline] stage
[Pipeline] { (Check Out)
[Pipeline] stage
[Pipeline] { (Check Out)
[Pipeline] stage
[Pipeline] { (Check Out)
[Pipeline] stage
[Pipeline] { (Check Out)
[Pipeline] End of Pipeline
java.lang.StackOverflowError
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:131)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
Finished: FAILURE
PS - для удобства сокращен журнал консоли.