Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
gitlab_to_aptly [2021/05/29 15:07]
okias h3
gitlab_to_aptly [2021/05/29 19:04]
okias [Aptly]
Line 1: Line 1:
 ====== Creating repository from automated Debian Salsa builds ====== ====== Creating repository from automated Debian Salsa builds ======
 +{{ :salsa_to_aptly.png |}}
 ===== Motivation ===== ===== Motivation =====
  
 I'm not an Debian maintainer. Nor I want to be in future. I'm not an Debian maintainer. Nor I want to be in future.
-My reasons to do all this is that:+My reasons to do all this is:
   - I want some specific software to be packaged for Debian   - I want some specific software to be packaged for Debian
-  - when I update packaging on salsa.debian.org I want to have available package for computers and phones +  - when I update packaging on salsa.debian.org I want to have available package for my devices 
-  - I don't want to bother myself downloading packages from Salsa CI manually or compiling them again on the devices+  - I don't want to bother with downloading packages from Salsa CI manually or compiling them again on these devices
   - I want also others to be able use my packages   - I want also others to be able use my packages
  
 These reasons motivated me to look into [[salsa.debian.org/|Salsa]], [[https://docs.gitlab.com/ee/api/|GitLab API]] and [[https://www.aptly.info/tutorial/|Aptly]] deployment. These reasons motivated me to look into [[salsa.debian.org/|Salsa]], [[https://docs.gitlab.com/ee/api/|GitLab API]] and [[https://www.aptly.info/tutorial/|Aptly]] deployment.
 +
 +==== Advantages ====
 +   * package build process is handled by salsa, no need to worry about it
 +   * ecologic - it's build only once
 +
 +==== Disadvantages ====
 +   * no control about build process than offered by salsa-ci.yml configuration file
  
 ===== Predisposition ===== ===== Predisposition =====
-  - You have correctly setup Salsa CI (including debian/salsa-ci.yml and Gitlab settings) +  - You did correctly setup **debian/salsa-ci.yml** and Gitlab settings ([[https://debconf19.debconf.org/talks/148-salsa-ci-debian-pipeline-for-developers/|Debconf19 talk about Salsa CI]]
-  - you didn't disabled build for the architecture you planing to distribute+  - you build for achitectures you'll be distributing with aptly
  
-You can take [[https://salsa.debian.org/okias-guest/]] as an example.+You can look at project configuration of [[https://salsa.debian.org/okias-guest/]] as an example.
  
 ===== Where to start ===== ===== Where to start =====
Line 59: Line 66:
 TOKEN= # watch https://www.youtube.com/watch?v=0LsMC3ZiXkA TOKEN= # watch https://www.youtube.com/watch?v=0LsMC3ZiXkA
  
-ARCHS="arm64 amd64" +ARCHS="amd64" 
-JOBS="build build\ arm64" # jobs must match to build == amd64;+JOBS="build" # jobs must match to build == amd64;
  
 ARTIF_UNPACK=debian/output ARTIF_UNPACK=debian/output
Line 97: Line 104:
 get_artifacts() { get_artifacts() {
         for job in $JOBS; do         for job in $JOBS; do
-        curl -o ${id}_${job}.zip -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" "https://salsa.debian.org/api/v4/projects/${id}/jobs/artifacts/debian/latest/download?job=${job}" && \+                BRANCH="debian/latest"         
 +        curl -o ${id}_${job}.zip -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" "https://salsa.debian.org/api/v4/projects/${id}/jobs/artifacts/${BRANCH}/download?job=${job}" && \
                 unzip ${id}_${job}.zip && \                 unzip ${id}_${job}.zip && \
                 rm ${id}_${job}.zip && \                 rm ${id}_${job}.zip && \
Line 114: Line 122:
         aptly repo add ${REPO_NAME} ${ARTIF_UNPACK} # add files         aptly repo add ${REPO_NAME} ${ARTIF_UNPACK} # add files
  aptly publish drop unstable # first we get rid of previously published repo  aptly publish drop unstable # first we get rid of previously published repo
-        aptly publish repo -batch -architectures ${ARCHS} -distribution unstable ${REPO_NAME}+ APTLY_ARCHS=`echo $ARCHS | tr " " ,` 
 + aptly publish repo -batch -architectures "${APTLY_ARCHS}-distribution unstable ${REPO_NAME}
 } }