Checkout: hostPath-mount the VPS's own CloudOps checkout instead of cloning
18 straight clone failures today (early EOF / invalid index-pack) even with http.postBuffer/http.version tuning applied — Gitea's HTTP endpoint itself is degraded right now, not something fixable client-side. Sidesteps it entirely: the docker-agent pod template now hostPath-mounts /root/CloudOps (read-only, see k3s-cloud-init.groovy) and Checkout just `cp -r`s from it, no network fetch at all. Build/SonarQube paths revert to ./platform/ (no more repo/ subdirectory, since we're not cloning into one). Real tradeoff, accepted deliberately: builds now reflect whatever's on the VPS's disk at build time, not necessarily what's pushed to Gitea. Depends on /root/CloudOps being kept current via the normal git pull workflow. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
28
platform/Jenkinsfile
vendored
28
platform/Jenkinsfile
vendored
@@ -14,32 +14,18 @@ pipeline {
|
|||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([usernamePassword(
|
sh '''
|
||||||
credentialsId: 'dd13f593-06b1-4a5a-9477-2df0d186b490',
|
echo "Copying CloudOps from the VPS's own checkout (hostPath-mounted, no Gitea fetch)..."
|
||||||
usernameVariable: 'GIT_USER',
|
cp -r /root/CloudOps/. .
|
||||||
passwordVariable: 'GIT_TOKEN'
|
test -f platform/app.py
|
||||||
)]) {
|
'''
|
||||||
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
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build Docker Image') {
|
stage('Build Docker Image') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
docker build -t management-platform:${BUILD_NUMBER} -t management-platform:latest ./repo/platform/
|
docker build -t management-platform:${BUILD_NUMBER} -t management-platform:latest ./platform/
|
||||||
echo "✅ Docker image built"
|
echo "✅ Docker image built"
|
||||||
docker images management-platform:${BUILD_NUMBER} --format "Size: {{.Size}}"
|
docker images management-platform:${BUILD_NUMBER} --format "Size: {{.Size}}"
|
||||||
'''
|
'''
|
||||||
@@ -55,7 +41,7 @@ pipeline {
|
|||||||
sh """
|
sh """
|
||||||
${scannerHome}/bin/sonar-scanner \
|
${scannerHome}/bin/sonar-scanner \
|
||||||
-Dsonar.projectKey=management-platform \
|
-Dsonar.projectKey=management-platform \
|
||||||
-Dsonar.sources=repo/platform \
|
-Dsonar.sources=platform \
|
||||||
-Dsonar.python.version=3
|
-Dsonar.python.version=3
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user