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