Skip to content

Commit 5db666e

Browse files
committed
dev pipeline update
1 parent a9bb71a commit 5db666e

5 files changed

Lines changed: 70 additions & 58 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ composer.phar
1616
/debian/php-vitexsoftware-ease-html-widgets.debhelper.log
1717
/debian/php-vitexsoftware-ease-html-widgets-doc.substvars
1818
/debian/php-vitexsoftware-ease-html-widgets-doc.debhelper.log
19+
/debian/tmp/

debian/Jenkinsfile

Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#!groovy
22

3-
String[] distributions = ['debian:bookworm', 'debian:trixie', 'debian:forky', 'ubuntu:focal', 'ubuntu:jammy', 'ubuntu:noble']
43

5-
String vendor = 'vitexsoftware'
4+
String repoUrl = 'https://github.com/raspberrypi/rpi-imager.git'
5+
String repoBranch = 'qml' // scm.userRemoteConfigs[0].branch
6+
7+
String[] architectures = ['amd64', 'aarch64', 'armhf']
8+
String[] distributions = ['debian:bullseye', 'debian:bookworm', 'ubuntu:focal', 'ubuntu:jammy'] // 'debian:buster'
9+
10+
String imageVendor = 'vitexsoftware'
611
String distribution = ''
7-
//String distroFamily = ''
12+
String architecture = ''
813
String distroCodename = ''
914
String ver = ''
1015

@@ -14,74 +19,81 @@ properties([
1419
node() {
1520
ansiColor('xterm') {
1621
stage('SCM Checkout') {
17-
checkout scm
22+
checkout([$class: 'GitSCM', branches: [[name: '*/' + repoBranch ]], extensions: [], userRemoteConfigs: [[url: repoUrl]]])
23+
def control = readFile(file: env.WORKSPACE + '/debian/control')
24+
def lines = control.readLines()
25+
for (line in lines) {
26+
if (line.trim()) {
27+
def (key,value) = line.split(': ').collect { it.trim() }
28+
if (key == 'Architecture') {
29+
if (value == 'any') {
30+
architectures = ['amd64', 'armhf', 'aarch64']
31+
} else {
32+
architectures = [value]
33+
}
34+
}
35+
}
36+
}
1837
}
1938
}
2039
}
2140

22-
distributions.each {
23-
distribution = it
41+
architectures.each {
42+
architecture = it
2443

25-
println "Dist:" + distribution
44+
println 'Arch: ' + architecture
2645

27-
def dist = distribution.split(':')
28-
distroCodename = dist[1]
46+
distributions.each {
47+
distribution = it
2948

30-
def buildImage = ''
49+
println 'Dist:' + distribution
3150

32-
def artifacts = []
51+
def String dist = distribution.split(':')
52+
// distroFamily = dist[0]
53+
distroCodename = dist[1]
3354

34-
node {
35-
ansiColor('xterm') {
36-
stage('Checkout ' + distribution) {
37-
checkout scm
38-
buildImage = docker.image(vendor + '/' + distribution)
39-
sh 'git checkout debian/changelog'
40-
def version = sh (
41-
script: 'dpkg-parsechangelog --show-field Version',
42-
returnStdout: true
43-
).trim()
44-
ver = version + '.' + env.BUILD_NUMBER + '~' + distroCodename
45-
}
46-
stage('Build ' + distribution) {
47-
buildImage.inside {
48-
sh 'dch -b -v ' + ver + ' "' + env.BUILD_TAG + '"'
49-
sh 'sudo apt-get update --allow-releaseinfo-change'
50-
sh 'sudo chown jenkins:jenkins ..'
51-
sh 'debuild-pbuilder -i -us -uc -b'
52-
sh 'mkdir -p $WORKSPACE/dist/debian/ ; rm -rf $WORKSPACE/dist/debian/* ; for deb in $(cat debian/files | awk \'{print $1}\'); do mv "../$deb" $WORKSPACE/dist/debian/; done'
53-
artifacts = sh (
54-
script: "cat debian/files | awk '{print \$1}'",
55+
def String buildImage = ''
56+
57+
node(architecture) {
58+
ansiColor('xterm') {
59+
stage('Checkout ' + architecture + ' ' + distribution) {
60+
buildImage = docker.image(imageVendor + '/' + distribution)
61+
sh 'cd ' + env.WORKSPACE + '; ls -la; pwd'
62+
sh 'git checkout debian/changelog'
63+
def String pkgVer = sh(
64+
script: 'dpkg-parsechangelog --show-field Version',
5565
returnStdout: true
56-
).trim().split('\n')
66+
).trim()
67+
ver = pkgVer + '~' + distroCodename + '~' + env.BUILD_NUMBER
68+
}
69+
stage('Build ' + architecture + ' ' + distribution) {
70+
buildImage.inside {
71+
sh 'dch -b -v ' + ver + ' "' + env.BUILD_TAG + '"'
72+
sh 'sudo apt-get update --allow-releaseinfo-change'
73+
// sh 'sudo apt install -y libgnutls28-dev'
74+
sh 'sudo chown jenkins:jenkins ..'
75+
sh 'debuild-pbuilder -i -us -uc -b'
76+
sh 'mkdir -p $WORKSPACE/dist/debian/ ; rm -rf $WORKSPACE/dist/debian/* ; for deb in $(cat debian/files | awk \'{print $1}\'); do mv "../$deb" $WORKSPACE/dist/debian/; done'
77+
}
5778
}
58-
}
5979

60-
stage('Test ' + distribution) {
61-
buildImage.inside {
62-
def debconf_debug = 0 //Set to "5" or "developer" to debug debconf
63-
sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE'
64-
sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list'
65-
sh 'sudo apt-get update --allow-releaseinfo-change'
66-
sh 'echo "INSTALATION"'
67-
artifacts.each { deb_file ->
68-
if (deb_file.endsWith('.deb')) {
69-
sh 'echo -e "${GREEN} installing ' + deb_file + ' on `lsb_release -sc` ${ENDCOLOR} "'
70-
sh 'sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $WORKSPACE/dist/debian/' + deb_file
71-
}
80+
stage('Test ' + architecture + ' ' + distribution) {
81+
buildImage.inside {
82+
def debconf_debug = 0 //Set to "5" or "developer" to debug debconf
83+
sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE'
84+
sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list'
85+
sh 'sudo apt-get update --allow-releaseinfo-change'
86+
sh 'echo "INSTALATION"'
87+
sh 'IFS="\n\b"; for package in `cat debian/files | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $WORKSPACE/dist/debian/$package ; done;'
88+
stash includes: 'dist/**', name: 'dist-' + distroCodename
7289
}
7390
}
74-
}
75-
stage('Copy artifacts ' + distribution ) {
76-
buildImage.inside {
77-
artifacts.each { deb_file ->
78-
println "Copying artifact: " + deb_file
79-
archiveArtifacts artifacts: 'dist/debian/' + deb_file
80-
sh 'cp $WORKSPACE/dist/debian/' + deb_file + ' $WORKSPACE'
91+
stage('Copy artifacts ' + architecture + ' ' + distribution ) {
92+
buildImage.inside {
93+
sh 'mv $WORKSPACE/dist/debian/*.deb $WORKSPACE'
8194
}
8295
}
8396
}
8497
}
8598
}
8699
}
87-

debian/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "deb/ease-html-widgets",
33
"description": "Addons for PHP Framework (debianized)",
4-
"version": "1.1.0",
54
"authors": [
65
{
76
"name": "Vítězslav Dvořák",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
src/Ease/Html/Widgets/*.php /usr/share/php/EaseHtmlWidgets/Widgets
2-
debian/composer.json /usr/share/php/EaseHtmlWidgets
2+
debian/tmp/composer.json /usr/share/php/EaseHtmlWidgets

debian/rules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
# dh_auto_install -- prefix=/usr
1313

1414
override_dh_install:
15-
jq '.version = "'`dpkg-parsechangelog | sed -n 's/^Version: //p'| sed 's/~.*//'`'"' debian/composer.json |sponge debian/composer.json
15+
mkdir -p debian/tmp
16+
jq '.version = "'`dpkg-parsechangelog | sed -n 's/^Version: //p'| sed 's/~.*//'`'"' debian/composer.json |sponge debian/tmp/composer.json
1617
dh_install
17-

0 commit comments

Comments
 (0)