33// Current version of this Pipeline https://github.com/VitexSoftware/BuildImages/blob/main/Test/Jenkinsfile
44
55String [] distributions = [
6- ' debian:bookworm' ,
7- ' debian:trixie' ,
6+ ' debian:bookworm' ,
7+ ' debian:trixie' ,
88 // 'debian:forky', // Disabled: Forky is still unstable/research-only.
99 // // The full Debian package ecosystem is not yet available for Forky.
1010 // // Re-enable once the stack builds cleanly for Forky.
11- ' ubuntu:jammy' ,
11+ ' ubuntu:jammy' ,
1212 ' ubuntu:noble' ,
1313 ' ubuntu:resolute' ,
1414]
@@ -28,6 +28,7 @@ properties([
2828node() {
2929 ansiColor(' xterm' ) {
3030 stage(' SCM Checkout' ) {
31+ sh ' sudo chown -R jenkins:jenkins . 2>/dev/null || true'
3132 checkout scm
3233 }
3334 }
@@ -49,6 +50,7 @@ distributions.each { distro ->
4950 node {
5051 ansiColor(' xterm' ) {
5152 stage(' Checkout ' + distroName) {
53+ sh ' sudo chown -R jenkins:jenkins . 2>/dev/null || true'
5254 checkout scm
5355 def imageName = vendor + ' /' + distro
5456 buildImage = docker. image(imageName)
@@ -85,25 +87,48 @@ distributions.each { distro ->
8587 }
8688 }
8789
88- stage(" Test ${ distro} " ) {
89- buildImage. inside(' --ipc=host' ) {
90- def debconf_debug = 0
91- sh """
92- cd \$ WORKSPACE/dist/debian/
93- dpkg-scanpackages . /dev/null > Packages
94- gzip -9c Packages > Packages.gz
95- cd \$ WORKSPACE
96- echo "deb [trusted=yes] file://///\$ WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list
97- sudo apt-get update --allow-releaseinfo-change
98- """
99- artifacts. each { deb_file ->
90+ stage(' Test ' + distroName) {
91+ buildImage. inside {
92+ def debconf_debug = 0 // Set to "5" or "developer" to debug debconf
93+ sh ' cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz; cd $WORKSPACE'
94+ sh ' echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list'
95+ sh ' sudo apt-get update --allow-releaseinfo-change'
96+ sh ' echo "INSTALATION"'
97+
98+ def installOrder = [
99+ // '',
100+ ]
101+
102+ def sorted_artifacts = artifacts. toList()
103+
104+ // If installOrder is empty, install all produced packages
105+ if (installOrder. isEmpty()) {
106+ sorted_artifacts. each { deb_file ->
100107 if (deb_file. endsWith(' .deb' )) {
101108 def pkgName = deb_file. tokenize(' /' )[-1 ]. replaceFirst(/ _.*/ , ' ' )
102109 sh ' echo -e "${GREEN} installing ' + pkgName + ' on `lsb_release -sc` ${ENDCOLOR} "'
103110 sh ' sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install ' + pkgName
104111 }
105112 }
113+ } else {
114+ // Install packages in specified order
115+ installOrder. each { pkgPrefix ->
116+ def debFile = null
117+ for (item in sorted_artifacts) {
118+ def itemStr = item. toString()
119+ if (itemStr. startsWith(pkgPrefix) && itemStr. endsWith(' .deb' )) {
120+ debFile = itemStr
121+ break
122+ }
123+ }
124+ if (debFile) {
125+ def pkgName = debFile. tokenize(' /' )[-1 ]. replaceFirst(/ _.*/ , ' ' )
126+ sh ' echo -e "${GREEN} installing ' + pkgName + ' on `lsb_release -sc` ${ENDCOLOR} "'
127+ sh ' sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install ' + pkgName
128+ }
129+ }
106130 }
131+
107132 }
108133 stage(' Archive artifacts ' + distroName ) {
109134 // Only run if previous stages (Build and Test) succeeded
0 commit comments