diff --git a/platform/Jenkinsfile b/platform/Jenkinsfile index a5558cc..ccb8ec6 100644 --- a/platform/Jenkinsfile +++ b/platform/Jenkinsfile @@ -14,19 +14,24 @@ pipeline { stages { stage('Checkout') { steps { - retry(5) { - checkout([ - $class: 'GitSCM', - branches: scm.branches, - userRemoteConfigs: scm.userRemoteConfigs, - extensions: [[ - $class: 'CloneOption', - shallow: true, - depth: 1, - noTags: true, - timeout: 30 - ]] - ]) + withCredentials([usernamePassword( + credentialsId: 'dd13f593-06b1-4a5a-9477-2df0d186b490', + usernameVariable: 'GIT_USER', + passwordVariable: 'GIT_TOKEN' + )]) { + sh ''' + rm -rf repo + for i in 1 2 3 4 5 6 7 8; do + echo "Clone attempt $i..." + git -c http.postBuffer=524288000 -c http.version=HTTP/1.1 \ + clone --depth 1 \ + "https://$GIT_USER:$GIT_TOKEN@gitea.nav.ovh/ameniboukattaya/CloudOps.git" repo \ + && break + rm -rf repo + sleep 3 + done + test -d repo/.git + ''' } } } @@ -34,7 +39,7 @@ pipeline { stage('Build Docker Image') { steps { sh ''' - docker build -t management-platform:${BUILD_NUMBER} -t management-platform:latest ./platform/ + docker build -t management-platform:${BUILD_NUMBER} -t management-platform:latest ./repo/platform/ echo "✅ Docker image built" docker images management-platform:${BUILD_NUMBER} --format "Size: {{.Size}}" ''' @@ -50,7 +55,7 @@ pipeline { sh """ ${scannerHome}/bin/sonar-scanner \ -Dsonar.projectKey=management-platform \ - -Dsonar.sources=platform \ + -Dsonar.sources=repo/platform \ -Dsonar.python.version=3 """ }