]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add Jenkins continuous integration to FreeRADIUS
authorMatt Rose <mattrose@folkwolf.net>
Thu, 18 Apr 2019 19:20:29 +0000 (15:20 -0400)
committerMatt Rose <mattrose@folkwolf.net>
Thu, 18 Apr 2019 19:53:17 +0000 (15:53 -0400)
scripts/jenkins/Jenkinsfile [new file with mode: 0644]
scripts/jenkins/README.md [new file with mode: 0644]

diff --git a/scripts/jenkins/Jenkinsfile b/scripts/jenkins/Jenkinsfile
new file mode 100644 (file)
index 0000000..c8acf42
--- /dev/null
@@ -0,0 +1,41 @@
+platforms = ["centos7", "debian9", "ubuntu16", "ubuntu18"]
+
+def buildClosures(arg) {
+    println arg.inspect()
+    def platforms = arg
+    def closures = [:]
+    for (value in platforms) {
+        //final valueCopy = value
+
+        closures[value] = {platform ->
+                stage("build-${platform}") {
+                    docker.build("${platform}-master-test","-f ./scripts/docker/build-${platform}/Dockerfile.deps ./scripts/docker/build-${platform}").inside {
+                        checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout'],[$class: 'RelativeTargetDirectory', relativeTargetDir: "${platform}/build"]], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/mattrose/freeradius-server']]])
+                        sh "cat /etc/os-release || cat /etc/redhat-release"
+                        dir("${platform}/build") {
+                            if (platform.contains("centos")) {
+                                sh 'QA_RPATHS=0x0003 RADIUSD_VERSION_STRING=$(cat VERSION) make rpm'
+                                sh "mv rpmbuild/RPMS/x86_64/*.rpm .."
+                            } else {
+                                sh "apt-get install -y unixodbc-dev"
+                                sh label: '', script: '''version=$(dpkg-parsechangelog | grep "^Version: " | awk \'{print $2}\')
+                                commit_msg="$(git log --oneline -1 $GIT_COMMIT)"
+                                dch -b -v ${version}-${BUILD_NUMBER} "$commit_msg"'''
+                                sh "make deb"
+                            }
+                        }
+                    }
+                }
+                echo platform.toString()
+            }.curry(value)
+    }
+    closures
+}
+
+node {
+    checkout scm
+    sh "echo $BUILD_NUMBER > build-number"
+    parallel buildClosures(platforms)
+    archiveArtifacts artifacts: 'build-number , **/*.deb , **/*.changes , **/*.rpm', onlyIfSuccessful: true
+    cleanWs()
+}
diff --git a/scripts/jenkins/README.md b/scripts/jenkins/README.md
new file mode 100644 (file)
index 0000000..ac2cf3c
--- /dev/null
@@ -0,0 +1,8 @@
+### Jenkins scripted build pipeline for FreeRADIUS
+
+The files in this directory are meant to be run by
+[Jenkins](https://jenkins.io/) and make use of [the docker
+plugin](https://plugins.jenkins.io/docker-workflow)  to build freeradius
+packages for multiple different linux distributions in parallel.  To run this
+file in Jenkins you can just add a new pipeline job and point it at 
+`scripts/jenkins/Jenkinsfile`