Migrate to cloudflare
This commit is contained in:
33
Jenkinsfile
vendored
33
Jenkinsfile
vendored
@@ -27,11 +27,6 @@ spec:
|
||||
volumeMounts:
|
||||
- name: docker-sock
|
||||
mountPath: /var/run
|
||||
- name: b2
|
||||
image: backblazeit/b2:latest
|
||||
command:
|
||||
- cat
|
||||
tty: true
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
emptyDir: {}
|
||||
@@ -46,9 +41,9 @@ spec:
|
||||
description: 'Rocky Linux versions to build (space-separated)'
|
||||
)
|
||||
string(
|
||||
name: 'B2_BUCKET_NAME',
|
||||
name: 'R2_BUCKET_NAME',
|
||||
defaultValue: 'rockyman',
|
||||
description: 'B2 bucket name for uploads'
|
||||
description: 'R2 bucket name for uploads'
|
||||
)
|
||||
string(
|
||||
name: 'EXISTING_VERSIONS',
|
||||
@@ -94,10 +89,8 @@ docker tag rocky-man:${BUILD_NUMBER} rocky-man:latest
|
||||
steps {
|
||||
container('docker-cli') {
|
||||
sh '''
|
||||
# Create output directories
|
||||
mkdir -p ./html ./tmp
|
||||
|
||||
# Run the container to build man pages
|
||||
docker run --rm \
|
||||
-v "$(pwd)/html:/data/html" \
|
||||
-v "$(pwd)/tmp:/data/tmp" \
|
||||
@@ -111,23 +104,25 @@ docker run --rm \
|
||||
}
|
||||
}
|
||||
|
||||
stage('Upload to B2') {
|
||||
stage('Upload to R2') {
|
||||
when {
|
||||
expression { return params.B2_BUCKET_NAME != "" }
|
||||
expression { return params.R2_BUCKET_NAME != "" }
|
||||
}
|
||||
steps {
|
||||
container('docker-cli') {
|
||||
withCredentials([
|
||||
string(credentialsId: 'b2-app-id', variable: 'B2_APPLICATION_KEY_ID'),
|
||||
string(credentialsId: 'b2-app-key', variable: 'B2_APPLICATION_KEY')
|
||||
string(credentialsId: 'r2-account-id', variable: 'R2_ACCOUNT_ID'),
|
||||
string(credentialsId: 'r2-access-key-id', variable: 'AWS_ACCESS_KEY_ID'),
|
||||
string(credentialsId: 'r2-secret-access-key', variable: 'AWS_SECRET_ACCESS_KEY')
|
||||
]) {
|
||||
sh '''
|
||||
docker run --rm \
|
||||
-v "$(pwd)/html:/workspace/html" \
|
||||
-e B2_APPLICATION_KEY \
|
||||
-e B2_APPLICATION_KEY_ID \
|
||||
backblazeit/b2:latest \
|
||||
b2v4 sync --compare-versions size /workspace/html/ "b2://${B2_BUCKET_NAME}/"
|
||||
-e AWS_ACCESS_KEY_ID \
|
||||
-e AWS_SECRET_ACCESS_KEY \
|
||||
peakcom/s5cmd:latest \
|
||||
--endpoint-url "https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com" \
|
||||
sync --size-only /workspace/html/ "s3://${R2_BUCKET_NAME}/"
|
||||
'''
|
||||
}
|
||||
}
|
||||
@@ -137,7 +132,7 @@ docker run --rm \
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'Build completed and uploaded to B2!'
|
||||
echo 'Build completed and uploaded to R2!'
|
||||
}
|
||||
failure {
|
||||
echo 'Build failed!'
|
||||
@@ -151,4 +146,4 @@ docker rmi rocky-man:latest || true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user