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