mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00

In Jenkins, we are using Xenial (16.04) as the worker distro and that is causing some maintenance issues. For instance, the manually installed buildah version lacks behind Github's CI that gets buildah from a repository. This change moves Jenkins to Ubuntu 18.04 so we get to install buildah from packages directly too. While we are at it, move Github VMs to Ubuntu 20.04. This allows us the change with both LTS versions. Finally, increase Jenkins timeout from 3 to 4 hours to be able to build all the demo container images without getting aborted. Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
171 lines
4.8 KiB
Groovy
171 lines
4.8 KiB
Groovy
pipeline {
|
|
agent {
|
|
label "master"
|
|
}
|
|
options {
|
|
timeout(time: 4, unit: "HOURS")
|
|
}
|
|
environment {
|
|
GO111MODULE="on"
|
|
REG="cloud-native-image-registry.westus.cloudapp.azure.com/"
|
|
RUNC_VERSION="v1.0.0-rc92"
|
|
CRIO_VERSION="v1.19.0"
|
|
GOLANGCI_LINT_VERSION="v1.30.0"
|
|
GO_VERSION="1.15.3"
|
|
GO_TAR="go${GO_VERSION}.linux-amd64.tar.gz"
|
|
GOROOT="/usr/local/go"
|
|
GOPATH="/tmp/go"
|
|
PATH="${env.PATH}:/usr/local/go/bin:${GOPATH}/bin"
|
|
REPO_NAME="intel-device-plugins-for-kubernetes"
|
|
REPO_DIR="$GOPATH/src/github.com/intel/${REPO_NAME}"
|
|
}
|
|
stages {
|
|
stage("Set env") {
|
|
when { changeRequest() }
|
|
steps {
|
|
script {
|
|
env.TAG = env.CHANGE_ID + '-rejected'
|
|
}
|
|
}
|
|
}
|
|
stage("Build && Publish") {
|
|
agent {
|
|
label "bionic-intel-device-plugins"
|
|
}
|
|
stages {
|
|
stage("Get requirements") {
|
|
steps {
|
|
sh "curl -O https://dl.google.com/go/${GO_TAR}"
|
|
sh "tar -xvf $GO_TAR"
|
|
sh "sudo mv go $GOROOT"
|
|
sh "mkdir -p $GOPATH/src/github.com/intel $GOPATH/bin"
|
|
sh "cp -rf ${env.WORKSPACE} $REPO_DIR"
|
|
sh "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOPATH}/bin ${GOLANGCI_LINT_VERSION}"
|
|
sh '''#!/usr/bin/env bash
|
|
. /etc/os-release
|
|
REPOURL=http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${ID^}_${VERSION_ID}
|
|
echo "deb ${REPOURL} /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
|
wget -nv ${REPOURL}/Release.key -O - | sudo apt-key add -
|
|
'''
|
|
sh "sudo apt-get update -qq"
|
|
sh "sudo apt-get -qq -y install libusb-1.0-0-dev buildah make gcc pkg-config"
|
|
sh "sudo curl https://raw.githubusercontent.com/cri-o/cri-o/${CRIO_VERSION}/test/policy.json -o /etc/containers/policy.json"
|
|
sh "sudo curl https://raw.githubusercontent.com/cri-o/cri-o/${CRIO_VERSION}/test/registries.conf -o /etc/containers/registries.conf"
|
|
sh "sudo sed -i -e 's/quay/docker/' /etc/containers/registries.conf"
|
|
sh "sudo curl -L https://github.com/opencontainers/runc/releases/download/$RUNC_VERSION/runc.amd64 -o /usr/bin/runc"
|
|
sh "sudo chmod +x /usr/bin/runc"
|
|
}
|
|
}
|
|
stage("make go-mod-tidy") {
|
|
steps {
|
|
dir(path: "$REPO_DIR") {
|
|
sh "make go-mod-tidy"
|
|
}
|
|
}
|
|
}
|
|
stage("make lint"){
|
|
parallel {
|
|
stage("make lint") {
|
|
steps {
|
|
dir(path: "$REPO_DIR") {
|
|
sh "make lint"
|
|
}
|
|
}
|
|
}
|
|
stage("make test BUILDTAGS=kerneldrv") {
|
|
steps {
|
|
dir(path: "$REPO_DIR") {
|
|
sh "make test BUILDTAGS=kerneldrv"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('make pre-pull') {
|
|
steps {
|
|
dir(path: "$REPO_DIR") {
|
|
sh "make pre-pull"
|
|
}
|
|
}
|
|
}
|
|
stage('make images') {
|
|
parallel {
|
|
stage("make images with docker") {
|
|
steps {
|
|
dir(path: "$REPO_DIR") {
|
|
sh "make -j4 images"
|
|
}
|
|
}
|
|
}
|
|
stage("make images with buildah") {
|
|
steps {
|
|
dir(path: "$REPO_DIR") {
|
|
sh "make images BUILDER=buildah"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('make demos') {
|
|
parallel {
|
|
stage('make demos with docker') {
|
|
steps {
|
|
dir(path: "$REPO_DIR") {
|
|
sh "make demos"
|
|
}
|
|
}
|
|
}
|
|
stage('make demos with buildah') {
|
|
steps {
|
|
dir(path: "$REPO_DIR") {
|
|
sh "make demos BUILDER=buildah"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
withDockerRegistry([ credentialsId: "e16bd38a-76cb-4900-a5cb-7f6aa3aeb22d", url: "https://${REG}" ]) {
|
|
sh "make push"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Intel Device plugins') {
|
|
when {
|
|
beforeAgent true
|
|
allOf { changeRequest(); environment name: 'BMAAS', value: 'yes' }
|
|
}
|
|
agent {
|
|
label "clr-bmaas-intel-device-plugins"
|
|
}
|
|
environment {
|
|
WORKDIR="${env.WORKSPACE}/scripts/jenkins"
|
|
}
|
|
stages {
|
|
stage('Set tag') {
|
|
steps {
|
|
sh 'make set-version'
|
|
}
|
|
}
|
|
stage('Tests') {
|
|
steps {
|
|
dir(path: "$WORKDIR") {
|
|
sh 'make tests'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
dir(path: "$WORKDIR") {
|
|
sh 'make logs'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|