diff --git a/flatpak/generic-build.pipeline b/flatpak/generic-build.pipeline index 987fd06..b8dc114 100644 --- a/flatpak/generic-build.pipeline +++ b/flatpak/generic-build.pipeline @@ -1,68 +1,72 @@ // Request a node to be allocated to us node( "Flatpak" ) { // We want Timestamps on everything timestamps { // We want to catch any errors that occur to allow us to send out notifications (ie. emails) if needed catchError { - // Initialize the local repository to ensure we're ready to go - stage('Preparing Flatpak Repository') { - // Make sure the OSTree repository used by Flatpak is ready to go + // Make sure the local environment is cleaned up + stage('Cleaning up') { + // We don't want to use a previously used staging repository, to make sure it doesn't exist sh """ - rm -rf \$HOME/staging-repo/ - ostree init --mode=archive-z2 --repo=\$HOME/staging-repo/ + rm -rf ~/staging-repo/ """ } // Retrieve the build instructions for Flatpak stage('Fetching Sources') { // Actual Application Sources checkout changelog: true, poll: true, scm: [ $class: 'GitSCM', branches: [[name: branchToBuild]], extensions: [[$class: 'CloneOption', timeout: 120]], userRemoteConfigs: [[url: repositoryUrl]] ] // General Flatpak build recipe repository checkout changelog: false, poll: false, scm: [ $class: 'GitSCM', branches: [[name: 'master']], extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'flatpak-kde-applications/']], userRemoteConfigs: [[url: 'https://anongit.kde.org/flatpak-kde-applications']] ] } // Build the application! stage('Building Application') { // Build it! + // We conduct all builds from ~/jenkins to allow for the compiler cache to be shared between builds + // It isn't necessary to create ~/staging-repo in advance as flatpak-builder will do that for us + // We remove the app/ folder afterwards to be clean and tidy as we won't be inspecting it manually - we only want the artifacts in the repository! sh """ - cd "\$HOME/jenkins/" + cd ~/jenkins/ + BUILD_DATE=`date` flatpak-builder --force-clean --delete-build-dirs --arch=x86_64 --ccache --sandbox --user --install-deps-from=flathub --repo=\$HOME/staging-repo/ --subject="Built on \$BUILD_DATE" app "\$WORKSPACE/${manifest}" + rm -rf app/ """ } // Run the repository export preparation process stage('Exporting Repository') { // Do the build! sh """ flatpak build-update-repo --prune --prune-depth=20 --generate-static-deltas \$HOME/staging-repo/ """ } // Finally we can sign the repository stage('Publishing Repository') { // Sign and then upload the repository to the final server sh """ flatpak build-commit-from --src-repo=\$HOME/staging-repo --gpg-sign=61C45BED \$HOME/public-repo --update-appstream flatpak build-update-repo --prune --prune-depth=20 --generate-static-deltas --gpg-sign=61C45BED \$HOME/public-repo rsync -Ha --delete \$HOME/public-repo/ flatpak@racnoss.kde.org:/srv/www/distribute.kde.org/flatpak-nightlies/ """ } } } }