|
| 1 | +pipeline { |
| 2 | + agent { |
| 3 | + label "xenial-intel-device-plugins" |
| 4 | + } |
| 5 | + options { |
| 6 | + timeout(time: 2, unit: "HOURS") |
| 7 | + } |
| 8 | + environment { |
| 9 | + RUNC_VERSION="v1.0.0-rc6" |
| 10 | + CRIO_VERSION="v1.11.5" |
| 11 | + OSTREE_VERSION="v2018.8" |
| 12 | + BUILDAH_VERSION="v1.4" |
| 13 | + GO_VERSION="1.11.11" |
| 14 | + GO_TAR="go${GO_VERSION}.linux-amd64.tar.gz" |
| 15 | + GOROOT="/usr/local/go" |
| 16 | + GOPATH="/tmp/go" |
| 17 | + PATH="${env.PATH}:/usr/local/go/bin:${GOPATH}/bin" |
| 18 | + REPO_NAME="intel-device-plugins-for-kubernetes" |
| 19 | + REPO_DIR="$GOPATH/src/github.com/intel/${REPO_NAME}" |
| 20 | + } |
| 21 | + stages { |
| 22 | + stage("Get requirements") { |
| 23 | + parallel { |
| 24 | + stage("go") { |
| 25 | + steps { |
| 26 | + sh "curl -O https://dl.google.com/go/${GO_TAR}" |
| 27 | + sh "tar -xvf $GO_TAR" |
| 28 | + sh "sudo mv go $GOROOT" |
| 29 | + sh "mkdir -p $GOPATH/src/github.com/intel" |
| 30 | + sh "cp -rf ${env.WORKSPACE} $REPO_DIR" |
| 31 | + dir(path: "$REPO_DIR") { |
| 32 | + sh "go get -v golang.org/x/lint/golint" |
| 33 | + sh "go get -v github.com/fzipp/gocyclo" |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | + stage("buildah") { |
| 38 | + steps { |
| 39 | + sh "sudo apt-get -y install e2fslibs-dev libfuse-dev libgpgme11-dev libdevmapper-dev libglib2.0-dev libprotobuf-dev" |
| 40 | + sh "mkdir -p ${GOPATH}/src/github.com/containers" |
| 41 | + dir(path: "${GOPATH}/src/github.com/containers") { |
| 42 | + sh "git clone --single-branch --depth 1 -b $BUILDAH_VERSION https://github.com/containers/buildah" |
| 43 | + } |
| 44 | + dir(path: "${GOPATH}/src/github.com/containers/buildah") { |
| 45 | + sh 'make buildah TAGS=""' |
| 46 | + sh "sudo cp buildah /usr/local/bin" |
| 47 | + sh "sudo mkdir -p /etc/containers" |
| 48 | + sh '''echo '[registries.search]' > registries.conf''' |
| 49 | + sh '''echo 'registries = ["docker.io"]' >> registries.conf''' |
| 50 | + sh "sudo mv registries.conf /etc/containers/registries.conf" |
| 51 | + sh "sudo curl https://raw.githubusercontent.com/kubernetes-sigs/cri-o/$CRIO_VERSION/test/policy.json -o /etc/containers/policy.json" |
| 52 | + sh "sudo curl -L https://github.com/opencontainers/runc/releases/download/$RUNC_VERSION/runc.amd64 -o /usr/bin/runc" |
| 53 | + sh "sudo chmod +x /usr/bin/runc" |
| 54 | + } |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + stage("make vet, lint, cyclomatic"){ |
| 60 | + parallel { |
| 61 | + stage("make lint") { |
| 62 | + steps { |
| 63 | + dir(path: "$REPO_DIR") { |
| 64 | + sh "make lint" |
| 65 | + } |
| 66 | + } |
| 67 | + } |
| 68 | + stage("make format") { |
| 69 | + steps { |
| 70 | + dir(path: "$REPO_DIR") { |
| 71 | + sh "make format" |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + stage("make vet") { |
| 76 | + steps { |
| 77 | + dir(path: "$REPO_DIR") { |
| 78 | + sh "make vet" |
| 79 | + } |
| 80 | + } |
| 81 | + } |
| 82 | + stage("make cyclomatic-check") { |
| 83 | + steps { |
| 84 | + dir(path: "$REPO_DIR") { |
| 85 | + sh "make cyclomatic-check" |
| 86 | + } |
| 87 | + } |
| 88 | + } |
| 89 | + stage("make test") { |
| 90 | + steps { |
| 91 | + dir(path: "$REPO_DIR") { |
| 92 | + sh "make test" |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | + } |
| 97 | + } |
| 98 | + stage('make images') { |
| 99 | + parallel { |
| 100 | + stage("make images with docker") { |
| 101 | + steps { |
| 102 | + dir(path: "$REPO_DIR") { |
| 103 | + sh "make images" |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + stage("make images with buildah") { |
| 108 | + steps { |
| 109 | + dir(path: "$REPO_DIR") { |
| 110 | + sh "make images BUILDER=buildah" |
| 111 | + } |
| 112 | + } |
| 113 | + } |
| 114 | + } |
| 115 | + } |
| 116 | + stage('make demos') { |
| 117 | + parallel { |
| 118 | + stage('make demos with docker') { |
| 119 | + steps { |
| 120 | + dir(path: "$REPO_DIR") { |
| 121 | + sh "make demos" |
| 122 | + } |
| 123 | + } |
| 124 | + } |
| 125 | + stage('make demos with buildah') { |
| 126 | + steps { |
| 127 | + dir(path: "$REPO_DIR") { |
| 128 | + sh "make demos BUILDER=buildah" |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | +} |
0 commit comments