Hi
I write this pipeline but i get error, seems when we upload large files and then clone a repo it doesn’t work
pipeline {
agent any
options {
disableConcurrentBuilds()
disableRestartFromStage()
disableResume()
quietPeriod 30
timeout(activity: true, time: 15)
skipDefaultCheckout true
ansiColor('xterm')
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '1', numToKeepStr: '5')
}
parameters {
text defaultValue: 'import os', description: 'Enter your script', name: 'COMMANDS_LIST'
base64File(name: 'uploadedFile', description: 'Upload file')
}
stages {
stage('upload data files') {
when {
expression { return env.uploadedFile_FILENAME != null }
}
steps {
withFileParameter(name:'uploadedFile', allowNoFile: false) {
sh 'mv $uploadedFile /tmp/${uploadedFile_FILENAME}'
sh 'ls -al '
}
}
}
stage('Enter commands') {
steps {
script {
writeFile file: 'file1.py', text: "${COMMANDS_LIST}"
}
}
}
stage('CLONE ansible repo') {
steps {
checkout changelog: false,
poll: false,
scm: scmGit(branches: [[name: '*/**']],
extensions: [lfs(),[$class: 'RelativeTargetDirectory', relativeTargetDir: 'ansible'], cleanBeforeCheckout(deleteUntrackedNestedRepositories: true), localBranch('main')],
userRemoteConfigs: [[credentialsId: 'GITHUB_TOKEN', url: 'https://github.com/ansible.git']])
}
}
stage('run ansible') {
steps {
sh 'mv /tmp/${uploadedFile_FILENAME} ${WORKSPACE}/${uploadedFile_FILENAME}'
sh 'mkdir archive'
ansiblePlaybook colorized: true,
extras: '-e "jenkins_pipeline_path=${workspace} data_file=${uploadedFile_FILENAME}"',
inventory: '${workspace}/ansible/inventory/capex_uat.ini',
playbook: '${workspace}/ansible/django_shell/main.yml',
vaultCredentialsId: 'vault_pass', vaultTmpPath: ''
}
}
}
post {
always {
archiveArtifacts artifacts: 'archive/*.log'
}
cleanup {
cleanWs()
}
}
}
error:
The recommended git tool is: NONE
using credential GITHUB_TOKEN
Cloning the remote Git repository
Cloning repository https://github.com/ansible.git
/usr/bin/git init /var/jenkins/workspace/test_django/ansible # timeout=10
ERROR: Error cloning remote repo ‘origin’
hudson.plugins.git.GitException: Could not init /var/jenkins/workspace/test_django/ansible
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1073)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:819)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:170)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:377)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to remote-host
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:1003)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:153)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:138)
at jdk.proxy61/jdk.proxy61.$Proxy146.execute(Unknown Source)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1222)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: hudson.plugins.git.GitException: Error performing git command: /usr/bin/git init /var/jenkins/workspace/test_django/ansible
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2862)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2766)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2761)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2051)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1071)
… 11 more
Caused by: java.io.IOException: Cannot run program “/usr/bin/git” (in directory “/var/jenkins/workspace/test_django/ansible”): error=7, Argument list too long
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at hudson.Proc$LocalProc.(Proc.java:252)
at hudson.Proc$LocalProc.(Proc.java:221)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:994)
at hudson.Launcher$ProcStarter.start(Launcher.java:506)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2839)
… 15 more
Caused by: java.io.IOException: error=7, Argument list too long
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
… 21 more
ERROR: Error cloning remote repo ‘origin’
ERROR: Maximum checkout retry attempts reached, aborting
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (run ansible)
Stage “run ansible” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] archiveArtifacts