Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2620 from mattrose/pipelines-v3-pr
Add Jenkins continuous integration to FreeRADIUS for v3.0.x
  • Loading branch information
alandekok committed May 1, 2019
2 parents 6091001 + 83f635b commit 9756972
Show file tree
Hide file tree
Showing 9 changed files with 333 additions and 0 deletions.
35 changes: 35 additions & 0 deletions scripts/jenkins/Jenkinsfile
@@ -0,0 +1,35 @@
platforms = ["ubuntu14", "ubuntu16", "ubuntu18","centos7","debian8","debian9"]
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}-test","-f ./scripts/jenkins/${platform}/Dockerfile ./scripts/jenkins/${platform}").inside {
checkout([$class: 'GitSCM', branches: [[name: '*/v3.0.x']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout'],[$class: 'RelativeTargetDirectory', relativeTargetDir: "${platform}"]], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/mattrose/freeradius-server']]])
sh "cat /etc/os-release || cat /etc/redhat-release"
dir(platform) {
if (platform.contains("centos")) {
sh 'mkdir -p rpmbuild/{SOURCES,SPECS,BUILD,BUILDROOT,RPMS,SRPMS}'
sh 'tar -j -c --transform "s/./freeradius-server-$(cat VERSION)/" --exclude ".git" --exclude "rpmbuild" -f rpmbuild/SOURCES/freeradius-server-$(cat VERSION).tar.bz2 .'
sh 'for file in $(grep "^Source...:" redhat/freeradius.spec | cut -d" " -f2) ; do cp redhat/$file rpmbuild/SOURCES/$file ; done'
sh 'rpmbuild --define "_topdir $(pwd)/rpmbuild" -bb redhat/freeradius.spec'
} else {
sh "make deb"
}
}
}
}
echo platform.toString()
}.curry(value)
}
closures
}

node {
checkout scm
parallel buildClosures(platforms)
}
54 changes: 54 additions & 0 deletions scripts/jenkins/README.md
@@ -0,0 +1,54 @@
### 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
creates 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 Dockerfiles in the
distribution-specific subdirectories to be able 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 you have all the necessary software installed it's just a matter of
creating a new Pipeline Item in Jenkins and [configuring 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 8 (Jessie)
* Debian 9 (Stretch)
* Centos 6
* CentOS 7

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. You can
also access the packages 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/

On that page, there are directories containing packages for each of the linux distributions.



### 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`
41 changes: 41 additions & 0 deletions scripts/jenkins/centos6/Dockerfile
@@ -0,0 +1,41 @@
FROM centos:6
RUN yum groupinstall -y "Development Tools"
RUN yum install -y rpmdevtools
RUN yum install -y 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 --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-6.noarch.rpm

#
# Install build dependencies
#
# RUN [ -e redhat/freeradius.spec ] && yum-builddep -y redhat/freeradius.spec

41 changes: 41 additions & 0 deletions scripts/jenkins/centos7/Dockerfile
@@ -0,0 +1,41 @@
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

37 changes: 37 additions & 0 deletions scripts/jenkins/debian8/Dockerfile
@@ -0,0 +1,37 @@
FROM debian:jessie

#
# Jessie has now been archived, so we need to remove the updates
# line from sources.list
#
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list
#
# 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

32 changes: 32 additions & 0 deletions scripts/jenkins/debian9/Dockerfile
@@ -0,0 +1,32 @@
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


31 changes: 31 additions & 0 deletions scripts/jenkins/ubuntu14/Dockerfile
@@ -0,0 +1,31 @@
FROM ubuntu:14.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

31 changes: 31 additions & 0 deletions scripts/jenkins/ubuntu16/Dockerfile
@@ -0,0 +1,31 @@
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

31 changes: 31 additions & 0 deletions scripts/jenkins/ubuntu18/Dockerfile
@@ -0,0 +1,31 @@
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

0 comments on commit 9756972

Please sign in to comment.