From 8c7755f4b6f969e2c806ee8ebff2a6bccf653d95 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 5 Oct 2023 23:29:19 +0200 Subject: [PATCH] Added repo upload to Jenkins file Jenkinsfile can now upload packages to repo on Gitea Fixed missing archive key in Chroot setup example (since it resulted in buiild failure) --- ExampleSetupJenkinsChroot.sh | 1 + Jenkinsfile | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ExampleSetupJenkinsChroot.sh b/ExampleSetupJenkinsChroot.sh index a257ee1..2514af7 100644 --- a/ExampleSetupJenkinsChroot.sh +++ b/ExampleSetupJenkinsChroot.sh @@ -20,6 +20,7 @@ cp -L /etc/resolv.conf ${chrootDir}/etc/ #Setup Repo mkdir -p ${chrootDir}/etc/apk cp -L /etc/apk/repositories ${chrootDir}/etc/apk/repositories +cp -L /home/jenkins/.abuild/*.pub ${chrootDir}/etc/apk/keys/ #Install config files echo "PS1='(Chroot-$Name)Test:\w\$ '" >> ${chrootDir}/etc/profile diff --git a/Jenkinsfile b/Jenkinsfile index 9194c20..d7b2e4f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -106,7 +106,20 @@ pipeline { stage("Collecting packages form ${NativeArchNormalized}") { archiveArtifacts allowEmptyArchive: true, artifacts: 'out/**/*.apk', onlyIfSuccessful: true } - + + stage('Uploading packages to repo form ${NativeArchNormalized}') { + steps { + withCredentials([usernamePassword(credentialsId: 'GiteaPKGPUploadAuth', usernameVariable: 'UploadUsername', passwordVariable: 'UploadPassword')]) { + sh ''' + for apkFile in $(find -L ~/packages -name '*.apk'); + do + echo "Uploading $apkFile" + curl --user $UploadUsername:$UploadPassword --upload-file $apkFile https://git.bprieshof.nl/api/packages/brammp/alpine/v3.18/pkgs + done; + ''' + } + } + } } } }