Update Jenkinsfile
This commit is contained in:
78
Jenkinsfile
vendored
78
Jenkinsfile
vendored
@@ -1,6 +1,4 @@
|
||||
// Jenkinsfile for Rocky Man
|
||||
// This pipeline uses Kubernetes agents to build and run the container
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
kubernetes {
|
||||
@@ -70,8 +68,8 @@ spec:
|
||||
steps {
|
||||
container('docker-cli') {
|
||||
sh '''
|
||||
docker build -t rocky-man:${BUILD_NUMBER} .
|
||||
docker tag rocky-man:${BUILD_NUMBER} rocky-man:latest
|
||||
docker build -t rocky-man:${BUILD_NUMBER} .
|
||||
docker tag rocky-man:${BUILD_NUMBER} rocky-man:latest
|
||||
'''
|
||||
}
|
||||
}
|
||||
@@ -81,28 +79,31 @@ spec:
|
||||
steps {
|
||||
container('docker-cli') {
|
||||
sh """
|
||||
# Create output directories
|
||||
mkdir -p ./html ./tmp
|
||||
# Create output directories
|
||||
mkdir -p ./html ./tmp
|
||||
|
||||
# Run the container to build man pages
|
||||
docker run --rm \
|
||||
-v "\$(pwd)/html:/app/html" \
|
||||
-v "\$(pwd)/tmp:/data/tmp" \
|
||||
rocky-man:${BUILD_NUMBER} \
|
||||
--versions ${params.VERSIONS} \
|
||||
--verbose
|
||||
# Run the container to build man pages - FIXED ESCAPING
|
||||
docker run --rm \\
|
||||
-v \"\$(pwd)/html:/app/html\" \\
|
||||
-v \"\$(pwd)/tmp:/data/tmp\" \\
|
||||
rocky-man:${BUILD_NUMBER} \\
|
||||
--versions ${params.VERSIONS} \\
|
||||
--verbose
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//stage('Archive Artifacts') {
|
||||
// steps {
|
||||
// archiveArtifacts artifacts: 'html/**/*', fingerprint: true
|
||||
// }
|
||||
//}
|
||||
stage('Archive Artifacts') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'html/**/*', fingerprint: true, allowEmptyArchive: true
|
||||
}
|
||||
}
|
||||
|
||||
stage('Upload to B2') {
|
||||
stage('Upload to B2') {
|
||||
when {
|
||||
expression { return params.B2_BUCKET_NAME != "" }
|
||||
}
|
||||
steps {
|
||||
container('b2') {
|
||||
withCredentials([
|
||||
@@ -110,31 +111,35 @@ spec:
|
||||
string(credentialsId: 'b2-app-key', variable: 'B2_APPLICATION_KEY')
|
||||
]) {
|
||||
sh '''
|
||||
# Modern B2 command (replaces deprecated authorize-account)
|
||||
b2 account authorize-account-key \\
|
||||
--applicationKeyId ${B2_APPLICATION_ID} \\
|
||||
--key ${B2_APPLICATION_KEY}
|
||||
# Modern B2 auth command
|
||||
b2 account authorize-account-key \\
|
||||
--applicationKeyId ${B2_APPLICATION_ID} \\
|
||||
--key ${B2_APPLICATION_KEY}
|
||||
|
||||
# Sync HTML contents (not the directory)
|
||||
b2 sync \\
|
||||
--allowEmptySource \\
|
||||
--compareVersions size \\
|
||||
--skip-perms \\
|
||||
--threads 10 \\
|
||||
./html/ \\
|
||||
b2://${B2_BUCKET_NAME}/builds/${BUILD_NUMBER}/
|
||||
# Verify auth (should succeed)
|
||||
b2 account get-account-info
|
||||
|
||||
# Optional: List the uploaded files to verify
|
||||
b2 ls b2://${B2_BUCKET_NAME}/builds/${BUILD_NUMBER}
|
||||
# Sync HTML contents
|
||||
b2 sync \\
|
||||
--allowEmptySource \\
|
||||
--compareVersions size \\
|
||||
--skip-perms \\
|
||||
--threads 10 \\
|
||||
./html/ \\
|
||||
b2://${B2_BUCKET_NAME}/builds/${BUILD_NUMBER}/
|
||||
|
||||
# Verify upload
|
||||
b2 ls b2://${B2_BUCKET_NAME}/builds/${BUILD_NUMBER}
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'Build completed successfully and uploaded to B2!'
|
||||
echo 'Build completed and uploaded to B2!'
|
||||
}
|
||||
failure {
|
||||
echo 'Build failed!'
|
||||
@@ -142,9 +147,8 @@ spec:
|
||||
cleanup {
|
||||
container('docker-cli') {
|
||||
sh '''
|
||||
# Clean up Docker images to save space
|
||||
docker rmi rocky-man:${BUILD_NUMBER} || true
|
||||
docker rmi rocky-man:latest || true
|
||||
docker rmi rocky-man:${BUILD_NUMBER} || true
|
||||
docker rmi rocky-man:latest || true
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user