+++ /dev/null
-def platforms = [
- "ubuntu16",
- "ubuntu18",
- "ubuntu20",
- "centos7",
- "centos8",
- "debian9",
- "debian10"]
-
-def server_dir = "freeradius-server"
-
-def artifacts = 'build-number, **/*.changes, **/*.buildinfo, **/*.deb, **/*.rpm'
-
-/*
- * Build FreeRADIUS packages for common Linux distributions.
- * Source is used as defined in the Jenkins job. Function
- * definitions are pulled in from Jenkinsfile.defs so that they
- * can be used in other Jenkinsfiles.
- */
-
-node {
- cleanWs(patterns: [[pattern: '**/*.deb , **/*.changes , **/*.buildinfo , **/*.rpm', type: 'INCLUDE']])
-
- dir(server_dir) {
- checkout scm
- }
-
- def fr = load server_dir + "/scripts/jenkins/Jenkinsfile.defs"
- fr.genBuildNumber(server_dir, "build-number")
-
- def build_opts = [:]
- build_opts.platforms = platforms
- build_opts.source = scm.getUserRemoteConfigs()[0].getUrl()
- build_opts.branch = scm.getBranches()[0].getName();
- build_opts.package_version = ''
- build_opts.package_release = '1'
- build_opts.use_commit = true
- build_opts.server_dir = server_dir
-
- print build_opts.inspect()
-
- parallel fr.buildClosures(build_opts)
-
- archiveArtifacts artifacts
-}
+++ /dev/null
-/*
- * The detectChanges function looks at the last git commit and
- * searches for changes to "redhat/freeradius.spec" or anything
- * in the "debian" directory. If it finds any changes to those
- * files it returns the string " --no-cache " which can be fed to
- * a docker build command to tell docker to rebuild the image
- * from scratch so that it can pick up any new dependencies
- * specified in those package manifest files.
- */
-
-def detectChanges() {
- def string = ""
- def changeLogSets = currentBuild.changeSets
-
- for (int i = 0; i < changeLogSets.size(); i++) {
- def entries = changeLogSets[i].items
-
- for (int j = 0; j < entries.length; j++) {
- def entry = entries[j]
- def files = new ArrayList(entry.affectedFiles)
-
- for (int k = 0; k < files.size(); k++) {
- def file = files[k]
-
- if (file.path =~ /(^debian\/.*)|(redhat\/freeradius.spec)/) {
- echo "changes in file ${file.path}, passing --no-cache flag to docker build"
- string = " --no-cache "
- return string
- }
- }
- }
- }
- return string
-}
-
-
-/*
- * The buildClosures function is the core function of the script
- * and uses function currying to be able to pass multiple
- * dynamically generated jenkins build commands into a jenkins
- * parallel block. This function ensures that the docker image is
- * built and builds FreeRADIUS packages inside the docker image.
- */
-
-def buildClosures(args) {
- println args.inspect()
-
- def platforms = args.platforms
- def source = args.source
- def branch = args.branch
- def package_version = args.package_version
- def package_release = args.package_release
- def use_commit = args.use_commit
- def server_dir = args.server_dir ?: "."
-
- def closures = [:]
- for (value in platforms) {
-
- closures[value] = {platform ->
- stage("build-${platform}") {
- docker.build("${platform}-test", "-f " + server_dir + "/scripts/jenkins/${platform}/Dockerfile " + server_dir + "/scripts/jenkins/${platform}").inside {
-
- checkout([$class: 'GitSCM',
- userRemoteConfigs: [
- [url: source]
- ],
- branches: [
- [name: branch]
- ],
- extensions: [
- [$class: 'CleanBeforeCheckout'],
- [$class: 'RelativeTargetDirectory',
- relativeTargetDir: "${platform}/build"
- ],
- [$class: 'CloneOption',
- depth: 0,
- noTags: false,
- reference: '',
- shallow: false
- ]
- ],
- submoduleCfg: []
- ])
-
- sh "cat /etc/os-release || cat /etc/redhat-release"
-
- def commit_num = "0"
- if (use_commit) {
- commit_num = readFile("./build-number").trim()
- }
-
-
- dir("${platform}/build/") {
-
- /*
- * Build up the package version number:
- * version: [ VERSION [+GITNUM] ]
- * release: -[ RELEASE ]
- */
-
- def version = package_version
- if (version.length() == 0) {
- version = sh (script: "cat VERSION", returnStdout: true).trim()
- }
-
- if (use_commit) {
- version = version + "+" + commit_num
- }
-
- def release = package_release ?: "1"
-
- if (platform.contains("centos")) {
- sh 'mkdir -p rpmbuild/{SOURCES,SPECS,BUILD,BUILDROOT,RPMS,SRPMS}'
- sh 'tar -j -c --transform "s/./freeradius-server-' + version + '/" --exclude ".git" --exclude "rpmbuild" -f rpmbuild/SOURCES/freeradius-server-' + version + '.tar.bz2 .'
- sh 'for file in $(grep "^Source...:" redhat/freeradius.spec | cut -d" " -f2) ; do cp redhat/$file rpmbuild/SOURCES/$file ; done'
-
- sh 'sed -i -e "s/^Version:.*$/Version: ' + version + '/" redhat/freeradius.spec'
- sh 'sed -i -e "s/^Release:.*$/Release: ' + release + '/" redhat/freeradius.spec'
-
- sh 'rpmbuild --define "_topdir $(pwd)/rpmbuild" -bb redhat/freeradius.spec'
- } else {
- def commit_msg = sh (script: "git log --oneline -1 \$GIT_COMMIT", returnStdout: true).trim()
- sh "dch -b -v ${version}-${release} \"${commit_msg}\""
-
- sh 'make deb'
- }
- }
-
- }
- }
- echo platform.toString()
- }.curry(value)
- }
- closures
-}
-
-
-/*
- * Find the number of commits since the previous release and
- * write out to a file, "build-number". This is used in packages
- * so that new commits don't create packages with the same
- * version number.
- */
-
-def genBuildNumber(source, file) {
- sh "(cd \"${source}\" && git describe --tags --long --match 'release_*' --match 'branch_*' | sed -e \'s/^.*-\\([0-9]*\\)-g[0-9a-f]*/\\1/\') > \"${file}\""
-}
-
-return this
+++ /dev/null
-def artifacts = 'build-number, **/*.changes, **/*.buildinfo, **/*.deb, **/*.rpm'
-
-/*
- * Build FreeRADIUS packages for common Linux distributions.
- * Function definitions are pulled in from Jenkinsfile.defs so
- * that they can be used in other Jenkinsfiles.
- */
-
-properties([
- parameters([
- string(
- name: 'source',
- defaultValue: 'https://github.com/FreeRADIUS/freeradius-server',
- description: 'URL of git repository where the source tree can be found',
- trim: true
- ),
- string(
- name: 'branch',
- defaultValue: 'v3.0.x',
- description: 'Name of the git branch the packages are built from',
- trim: true
- ),
- string(
- name: 'jdbranch',
- defaultValue: 'v3.0.x',
- description: 'Branch to use to get Jenkinsfile and Docker files from',
- trim: true
- ),
- text(
- name: 'platforms',
- defaultValue: '''ubuntu16
-ubuntu18
-ubuntu20
-debian9
-debian10
-centos7
-centos8''',
- description: 'List of operating systems to build packages for'
- ),
- string(
- name: 'package_version',
- defaultValue: '',
- description: 'Version number used in the built packages, e.g. "3.0.19"',
- trim: true
- ),
- string(
- name: 'package_release',
- defaultValue: '1',
- description: 'Release suffix used in the built packages, e.g. "2" would create "3.0.19-2". Will use "1" if not set.',
- trim: true
- ),
- booleanParam(
- name: 'use_commit',
- defaultValue: true,
- description: 'If enabled, uses the git commit number in the package version, e.g. 3.0.19+GIT-1 (otherwise 3.0.19-1).'
- )
- ])
-])
-
-
-/*
- * Given the provided parameters, build packages as specified and then archive them.
- */
-
-node {
- def server_dir = "freeradius-server"
-
- sh 'find . -type f \\( -name "*.deb" -o -name "*.changes" -o -name "*.buildinfo" -o -name "*.rpm" \\) -delete'
-
- checkout([
- $class: 'GitSCM',
- userRemoteConfigs: [
- [url: params.source]
- ],
- branches: [
- [name: params.jdbranch]
- ],
- doGenerateSubmoduleConfigurations: false,
- extensions: [
- [$class: 'RelativeTargetDirectory',
- relativeTargetDir: server_dir
- ],
- [$class: 'CloneOption',
- depth: 0,
- noTags: false,
- reference: '',
- shallow: false
- ]
- ],
- submoduleCfg: []
- ])
-
-
- def fr = load server_dir + "/scripts/jenkins/Jenkinsfile.defs"
- fr.genBuildNumber(server_dir, "build-number")
-
- def build_opts = [:]
- build_opts.platforms = params.platforms.trim().split()
- build_opts.source = params.source
- build_opts.branch = params.branch
- build_opts.package_version = params.package_version
- build_opts.package_release = params.package_release
- build_opts.use_commit = params.use_commit
- build_opts.server_dir = server_dir
-
- parallel fr.buildClosures(build_opts)
-
- archiveArtifacts artifacts
-}
+++ /dev/null
-# Jenkins scripted build pipeline for FreeRADIUS
-
-## Summary
-
-The Jenkinsfile in this directory is used to build packages for
-different Linux distributions. They are mostly here for the
-FreeRADIUS development team, and they create the packages available at
-[packages.networkradius.com](https://packages.networkradius.com).
-
-The Jenkinsfile is meant to be run with [Jenkins](https://jenkins.io/)
-and uses [Docker](https://www.docker.com/) and the files in
-`scripts/docker/` directory to build packages for multiple
-distributions on one server.
-
-
-## Usage
-
-To build these packages, you need the following software:
-
-* [Docker](https://www.docker.com/)
-
-* [Jenkins](https://jenkins.io/) with the following plugins:
- * [Pipeline](https://plugins.jenkins.io/workflow-aggregator)
- * [Docker Pipeline](https://plugins.jenkins.io/docker-workflow)
-
-Once the software is installed, you should create a new Pipeline Item
-in Jenkins and [configure the job to run the
-Jenkinsfile](https://jenkins.io/pipeline/getting-started-pipelines/#loading-pipeline-scripts-from-scm)
-
-The Jenkinsfile currently builds packages for the following platforms:
-
-* Ubuntu 14.04 (Trusty Tahir)
-* Ubuntu 16.04 (Xenial Xerus)
-* Ubuntu 18.04 (Bionic Beaver)
-* Debian 9 (Stretch)
-* Debian 10 (Buster)
-* CentOS 7
-* CentOS 8
-
-Once complete, the packages are available as artifacts and accessible
-from the job page by clicking the "Build Artifacts" link or by
-accessing the url:
-
-* https://\<jenkins\_uri\>/job/\<job\_name\>/\<build\_number\>/artifact
-
-The packages can also be access from the last successful build on the
-project page, by clicking the "Last Successful Artifacts" link, or by
-going to the URL:
-
-* https://\<jenkins\_uri\>/job/\<job\_name\>/lastSuccessfulBuild/artifact/
-
-That page contains directories, which in turn contain packages for
-each of the Linux distributions.
+++ /dev/null
-FROM centos:7
-RUN yum groupinstall -y "Development Tools"
-RUN yum install -y rpmdevtools
-RUN yum install -y openssl
-
-#
-# Create build directory
-#
-RUN mkdir -p /usr/local/src/repositories
-WORKDIR /usr/local/src/repositories
-
-#
-# Shallow clone the FreeRADIUS source
-#
-ARG source=https://github.com/FreeRADIUS/freeradius-server.git
-ARG release=v3.0.x
-
-RUN git clone --depth 1 --single-branch --branch ${release} ${source}
-WORKDIR freeradius-server
-#
-# Other requirements
-#
-
-# Use LTB's openldap packages intead of the distribution version to avoid linking against NSS
-RUN echo $'[ltb-project]\n\
-name=LTB project packages\n\
-baseurl=https://ltb-project.org/rpm/$releasever/$basearch\n\
-enabled=1\n\
-gpgcheck=1\n\
-gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project'\
-> /etc/yum.repos.d/ltb-project.repo
-RUN rpm --import https://ltb-project.org/lib/RPM-GPG-KEY-LTB-project
-
-# EPEL repository for freetds and hiredis
-RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-
-#
-# Install build dependencies
-#
-RUN [ -e redhat/freeradius.spec ] && yum-builddep -y redhat/freeradius.spec
-
+++ /dev/null
-#
-# Clean image to test packages in
-#
-FROM centos:7
+++ /dev/null
-FROM centos:8
-
-# Seems to work around https://bugs.centos.org/view.php?id=16655
-RUN rpmkeys --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
-
-RUN yum groupinstall -y "Development Tools"
-RUN yum install -y rpmdevtools openssl yum-utils
-
-#
-# Create build directory
-#
-RUN mkdir -p /usr/local/src/repositories
-WORKDIR /usr/local/src/repositories
-
-#
-# Shallow clone the FreeRADIUS source
-#
-ARG source=https://github.com/FreeRADIUS/freeradius-server.git
-ARG release=v3.0.x
-
-RUN git clone --depth 1 --single-branch --branch ${release} ${source}
-WORKDIR freeradius-server
-#
-# Other requirements
-#
-
-# Use LTB's openldap packages intead of the distribution version to avoid linking against NSS
-RUN echo $'[ltb-project]\n\
-name=LTB project packages\n\
-baseurl=https://ltb-project.org/rpm/$releasever/$basearch\n\
-enabled=1\n\
-gpgcheck=1\n\
-gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project'\
-> /etc/yum.repos.d/ltb-project.repo
-RUN rpm --import https://ltb-project.org/lib/RPM-GPG-KEY-LTB-project
-
-# EPEL repository for freetds and hiredis
-RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
-# Currently needed for hiredis:
-RUN yum config-manager --enable epel-testing
-# For json-c-devel and libpcap-devel ("PowerTools"?!):
-RUN yum config-manager --enable powertools
-
-#
-# Install build dependencies
-#
-RUN [ -e redhat/freeradius.spec ] && yum-builddep -y redhat/freeradius.spec
-
+++ /dev/null
-#
-# Clean image to test packages in
-#
-FROM centos:8
-
-# Seems to work around https://bugs.centos.org/view.php?id=16655
-RUN rpmkeys --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
+++ /dev/null
-FROM debian:buster
-#
-# Install build tools
-#
-RUN apt-get update
-RUN apt-get install -y devscripts equivs git quilt g++-${gccver}
-
-#
-# Create build directory
-#
-RUN mkdir -p /usr/local/src/repositories
-WORKDIR /usr/local/src/repositories
-
-#
-# Shallow clone the FreeRADIUS source
-#
-ARG source=https://github.com/FreeRADIUS/freeradius-server.git
-ARG release=v3.0.x
-
-RUN git clone --depth 1 --single-branch --branch ${release} ${source}
-WORKDIR freeradius-server
-
-#
-# Install build dependencies
-#
-RUN git checkout ${release}; \
- if [ -e ./debian/control.in ]; then \
- debian/rules debian/control; \
- fi; \
- echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control
+++ /dev/null
-#
-# Clean image to test packages in
-#
-FROM debian:buster
-RUN apt-get update && \
- apt-get -y dist-upgrade && \
- apt-get -y install procps
+++ /dev/null
-FROM debian:stretch
-#
-# Install build tools
-#
-RUN apt-get update
-RUN apt-get install -y devscripts equivs git quilt g++-${gccver}
-
-#
-# Create build directory
-#
-RUN mkdir -p /usr/local/src/repositories
-WORKDIR /usr/local/src/repositories
-
-#
-# Shallow clone the FreeRADIUS source
-#
-ARG source=https://github.com/FreeRADIUS/freeradius-server.git
-ARG release=v3.0.x
-
-RUN git clone --depth 1 --single-branch --branch ${release} ${source}
-WORKDIR freeradius-server
-
-#
-# Install build dependencies
-#
-RUN git checkout ${release}; \
- if [ -e ./debian/control.in ]; then \
- debian/rules debian/control; \
- fi; \
- echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control
-
-
+++ /dev/null
-#
-# Clean image to test packages in
-#
-FROM debian:stretch
-RUN apt-get update && \
- apt-get -y dist-upgrade && \
- apt-get -y install procps
+++ /dev/null
-FROM ubuntu:16.04
-#
-# Install build tools
-#
-RUN apt-get update
-RUN apt-get install -y devscripts equivs git quilt gcc
-
-#
-# Create build directory
-#
-RUN mkdir -p /usr/local/src/repositories
-WORKDIR /usr/local/src/repositories
-
-#
-# Shallow clone the FreeRADIUS source
-#
-ARG source=https://github.com/FreeRADIUS/freeradius-server.git
-ARG release=v3.0.x
-
-RUN git clone --depth 1 --single-branch --branch ${release} ${source}
-WORKDIR freeradius-server
-
-#
-# Install build dependencies
-#
-RUN git checkout ${release}; \
- if [ -e ./debian/control.in ]; then \
- debian/rules debian/control; \
- fi; \
- echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control
-
+++ /dev/null
-#
-# Clean image to test packages in
-#
-FROM ubuntu:16.04
-RUN apt-get update && \
- apt-get -y dist-upgrade && \
- apt-get -y install procps
+++ /dev/null
-FROM ubuntu:18.04
-#
-# Install build tools
-#
-RUN apt-get update
-RUN apt-get install -y devscripts equivs git quilt gcc
-
-#
-# Create build directory
-#
-RUN mkdir -p /usr/local/src/repositories
-WORKDIR /usr/local/src/repositories
-
-#
-# Shallow clone the FreeRADIUS source
-#
-ARG source=https://github.com/FreeRADIUS/freeradius-server.git
-ARG release=v3.0.x
-
-RUN git clone --depth 1 --single-branch --branch ${release} ${source}
-WORKDIR freeradius-server
-
-#
-# Install build dependencies
-#
-RUN git checkout ${release}; \
- if [ -e ./debian/control.in ]; then \
- debian/rules debian/control; \
- fi; \
- echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control
-
+++ /dev/null
-#
-# Clean image to test packages in
-#
-FROM ubuntu:18.04
-RUN apt-get update && \
- apt-get -y dist-upgrade && \
- apt-get -y install procps
+++ /dev/null
-FROM ubuntu:20.04
-
-ARG DEBIAN_FRONTEND=noninteractive
-
-#
-# Install build tools
-#
-RUN apt-get update
-RUN apt-get install -y devscripts equivs git quilt gcc
-
-#
-# Create build directory
-#
-RUN mkdir -p /usr/local/src/repositories
-WORKDIR /usr/local/src/repositories
-
-#
-# Shallow clone the FreeRADIUS source
-#
-ARG source=https://github.com/FreeRADIUS/freeradius-server.git
-ARG release=v3.0.x
-
-RUN git clone --depth 1 --single-branch --branch ${release} ${source}
-WORKDIR freeradius-server
-
-#
-# Install build dependencies
-#
-RUN git checkout ${release}; \
- if [ -e ./debian/control.in ]; then \
- debian/rules debian/control; \
- fi; \
- echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control
+++ /dev/null
-#
-# Clean image to test packages in
-#
-FROM ubuntu:20.04
-RUN apt-get update && \
- apt-get -y dist-upgrade && \
- apt-get -y install procps