diff --git a/Jenkinsfile b/Jenkinsfile index 0971e08..facc0da 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,6 +29,11 @@ spec: volumeMounts: - name: docker-sock mountPath: /var/run + - name: b2 + image: backblazeit/b2:latest + command: + - cat + tty: true volumes: - name: docker-sock emptyDir: {} @@ -42,6 +47,11 @@ spec: defaultValue: '8.10 9.6 10.0', description: 'Rocky Linux versions to build (space-separated)' ) + string( + name: 'B2_BUCKET_NAME', + defaultValue: 'rockyman', + description: 'B2 bucket name for uploads' + ) } options { @@ -86,16 +96,36 @@ spec: } } - stage('Archive Artifacts') { + #stage('Archive Artifacts') { + # steps { + # archiveArtifacts artifacts: 'html/**/*', fingerprint: true + # } + #} + + stage('Upload to B2') { steps { - archiveArtifacts artifacts: 'html/**/*', fingerprint: true + container('b2') { + withCredentials([ + string(credentialsId: 'b2-app-id', variable: 'B2_APPLICATION_ID'), + string(credentialsId: 'b2-app-key', variable: 'B2_APPLICATION_KEY') + ]) { + sh ''' + b2 authorize-account ${B2_APPLICATION_ID} ${B2_APPLICATION_KEY} + b2 sync \ + --allowEmptySource \ + --compareVersions size \ + ./html/ \ + b2://${B2_BUCKET_NAME}/builds/${BUILD_NUMBER}/ + ''' + } + } } } } post { success { - echo 'Build completed successfully!' + echo 'Build completed successfully and uploaded to B2!' } failure { echo 'Build failed!' @@ -110,4 +140,4 @@ spec: } } } -} +} \ No newline at end of file