mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
Add CI Jenkins stage with test case for intel-device-plugin: QAT
This commit adds bash scripts with the proper granularity for each sub-stage, needed for QAT device main stage validation. Signed-off-by: Rivera Gonzalez, Julio C <julio.c.rivera.gonzalez@intel.com>
This commit is contained in:
parent
96622b5e55
commit
a0ba1b38fe
273
Jenkinsfile
vendored
273
Jenkinsfile
vendored
@ -1,13 +1,13 @@
|
||||
pipeline {
|
||||
agent {
|
||||
label "xenial-intel-device-plugins"
|
||||
label "master"
|
||||
}
|
||||
options {
|
||||
timeout(time: 2, unit: "HOURS")
|
||||
timeout(time: 3, unit: "HOURS")
|
||||
}
|
||||
environment {
|
||||
GO111MODULE="on"
|
||||
REG = "cloud-native-image-registry.westus.cloudapp.azure.com/"
|
||||
REG="cloud-native-image-registry.westus.cloudapp.azure.com/"
|
||||
RUNC_VERSION="v1.0.0-rc8"
|
||||
CRIO_VERSION="v1.14.6"
|
||||
BUILDAH_VERSION="v1.10.0"
|
||||
@ -20,137 +20,178 @@ pipeline {
|
||||
REPO_DIR="$GOPATH/src/github.com/intel/${REPO_NAME}"
|
||||
}
|
||||
stages {
|
||||
stage("Get requirements") {
|
||||
parallel {
|
||||
stage("go") {
|
||||
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"
|
||||
sh "cp -rf ${env.WORKSPACE} $REPO_DIR"
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "go get -v golang.org/x/lint/golint"
|
||||
sh "go get -v golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow"
|
||||
sh "go get -v github.com/fzipp/gocyclo"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("buildah") {
|
||||
steps {
|
||||
sh "sudo apt-get update"
|
||||
sh "sudo apt-get -y install e2fslibs-dev libfuse-dev libgpgme11-dev libdevmapper-dev libglib2.0-dev libprotobuf-dev"
|
||||
sh "mkdir -p ${GOPATH}/src/github.com/containers"
|
||||
dir(path: "${GOPATH}/src/github.com/containers") {
|
||||
sh "git clone --single-branch --depth 1 -b $BUILDAH_VERSION https://github.com/containers/buildah"
|
||||
}
|
||||
dir(path: "${GOPATH}/src/github.com/containers/buildah") {
|
||||
sh 'make buildah TAGS=""'
|
||||
sh "sudo cp buildah /usr/local/bin"
|
||||
sh "sudo mkdir -p /etc/containers"
|
||||
sh '''echo '[registries.search]' > registries.conf'''
|
||||
sh '''echo 'registries = ["docker.io"]' >> registries.conf'''
|
||||
sh "sudo mv registries.conf /etc/containers/registries.conf"
|
||||
sh "sudo curl https://raw.githubusercontent.com/kubernetes-sigs/cri-o/$CRIO_VERSION/test/policy.json -o /etc/containers/policy.json"
|
||||
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 vet, lint, cyclomatic"){
|
||||
parallel {
|
||||
stage("make lint") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make lint"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("make format") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make format"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("make vet") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make vet"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("make cyclomatic-check") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make cyclomatic-check"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("make test BUILDTAGS=kerneldrv") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make test BUILDTAGS=kerneldrv"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('make pre-pull') {
|
||||
stage("Set env") {
|
||||
when { changeRequest() }
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make pre-pull"
|
||||
script {
|
||||
env.TAG = env.CHANGE_ID + '-rejected'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('make images') {
|
||||
parallel {
|
||||
stage("make images with docker") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make -j4 images"
|
||||
stage("Build && Publish") {
|
||||
agent {
|
||||
label "xenial-intel-device-plugins"
|
||||
}
|
||||
stages {
|
||||
stage("Get requirements") {
|
||||
parallel {
|
||||
stage("go") {
|
||||
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"
|
||||
sh "cp -rf ${env.WORKSPACE} $REPO_DIR"
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "go get -v golang.org/x/lint/golint"
|
||||
sh "go get -v golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow"
|
||||
sh "go get -v github.com/fzipp/gocyclo"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("buildah") {
|
||||
steps {
|
||||
sh "sudo apt-get update"
|
||||
sh "sudo apt-get -y install e2fslibs-dev libfuse-dev libgpgme11-dev libdevmapper-dev libglib2.0-dev libprotobuf-dev"
|
||||
sh "mkdir -p ${GOPATH}/src/github.com/containers"
|
||||
dir(path: "${GOPATH}/src/github.com/containers") {
|
||||
sh "git clone --single-branch --depth 1 -b $BUILDAH_VERSION https://github.com/containers/buildah"
|
||||
}
|
||||
dir(path: "${GOPATH}/src/github.com/containers/buildah") {
|
||||
sh 'make buildah TAGS=""'
|
||||
sh "sudo cp buildah /usr/local/bin"
|
||||
sh "sudo mkdir -p /etc/containers"
|
||||
sh '''echo '[registries.search]' > registries.conf'''
|
||||
sh '''echo 'registries = ["docker.io"]' >> registries.conf'''
|
||||
sh "sudo mv registries.conf /etc/containers/registries.conf"
|
||||
sh "sudo curl https://raw.githubusercontent.com/kubernetes-sigs/cri-o/$CRIO_VERSION/test/policy.json -o /etc/containers/policy.json"
|
||||
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 images with buildah") {
|
||||
stage("make vet, lint, cyclomatic"){
|
||||
parallel {
|
||||
stage("make lint") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make lint"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("make format") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make format"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("make vet") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make vet"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("make cyclomatic-check") {
|
||||
steps {
|
||||
dir(path: "$REPO_DIR") {
|
||||
sh "make cyclomatic-check"
|
||||
}
|
||||
}
|
||||
}
|
||||
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 images BUILDER=buildah"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
script {
|
||||
if (env.CHANGE_ID == null) {
|
||||
post {
|
||||
success {
|
||||
withDockerRegistry([ credentialsId: "e16bd38a-76cb-4900-a5cb-7f6aa3aeb22d", url: "https://${REG}" ]) {
|
||||
sh "make push"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Intel Device plugins') {
|
||||
when { changeRequest() }
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
5
Makefile
5
Makefile
@ -80,4 +80,7 @@ lock-images:
|
||||
@scripts/update-clear-linux-base.sh clearlinux/golang:latest $(shell ls build/docker/*.Dockerfile)
|
||||
@scripts/update-clear-linux-base.sh clearlinux:latest $(shell find demo -name Dockerfile)
|
||||
|
||||
.PHONY: all format vet cyclomatic-check test lint build images $(cmds) $(images) lock-images vendor pre-pull
|
||||
set-version:
|
||||
@scripts/set-version.sh $(TAG)
|
||||
|
||||
.PHONY: all format vet cyclomatic-check test lint build images $(cmds) $(images) lock-images vendor pre-pull set-version
|
||||
|
23
scripts/jenkins/Makefile
Normal file
23
scripts/jenkins/Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright 2019 Intel Corporation.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Makefile for jenkins-tests intel-device-plugins.
|
||||
|
||||
tests = $(shell ls -d */ | cut -f1 -d'/')
|
||||
|
||||
$(tests):
|
||||
@make -C $@ all
|
||||
|
||||
tests: $(tests)
|
||||
|
||||
info:
|
||||
@kubectl get pods
|
||||
@kubectl describe pods
|
||||
|
||||
logs-$(tests):
|
||||
@make -C $(subst logs-,,$@) logs
|
||||
|
||||
logs: info logs-$(tests)
|
||||
|
||||
.PHONY: info logs logs-$(tests) tests $(tests)
|
18
scripts/jenkins/qat/Makefile
Normal file
18
scripts/jenkins/qat/Makefile
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright 2019 Intel Corporation.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Makefile for QAT-DPDK jenkins.
|
||||
|
||||
all: plugin tests
|
||||
|
||||
plugin:
|
||||
@./plugin-deploy.sh
|
||||
|
||||
tests:
|
||||
@./tc-deploy.sh
|
||||
|
||||
logs:
|
||||
@./logs.sh
|
||||
|
||||
.PHONY: all plugin tests logs
|
16
scripts/jenkins/qat/logs.sh
Executable file
16
scripts/jenkins/qat/logs.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2019 Intel Corporation.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Show all logs related with qat.
|
||||
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
|
||||
PODS=$(kubectl get pods | grep -i qat | awk '{print $1}')
|
||||
for pod in $PODS; do
|
||||
kubectl logs $pod
|
||||
done
|
17
scripts/jenkins/qat/plugin-deploy.sh
Executable file
17
scripts/jenkins/qat/plugin-deploy.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2019 Intel Corporation.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Deploys current jenkins build test image 'intel-qat-plugin' in the cluster.
|
||||
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
|
||||
REPO_ROOT=$(realpath $(dirname $0)/../../..)
|
||||
kubectl create -f ${REPO_ROOT}/deployments/qat_plugin/qat_plugin_default_configmap.yaml
|
||||
kubectl create -f ${REPO_ROOT}/deployments/qat_plugin/qat_plugin.yaml
|
||||
kubectl rollout status ds/intel-qat-plugin --timeout=5m
|
||||
kubectl wait --for=condition=Ready pod --all --timeout=5m && sleep 60s
|
19
scripts/jenkins/qat/tc-deploy.sh
Executable file
19
scripts/jenkins/qat/tc-deploy.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2019 Intel Corporation.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Deploys current jenkins-build test image for dpdk-app (crypto-perf)
|
||||
# in the cluster.
|
||||
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
|
||||
REPO_ROOT=$(realpath $(dirname $0)/../../..)
|
||||
for test in $(ls -d ${REPO_ROOT}/deployments/qat_dpdk_app/test-*); do
|
||||
kubectl apply -k $test &
|
||||
done
|
||||
wait
|
||||
kubectl wait --for=condition=Ready pod --all --timeout=5m && sleep 60s
|
Loading…
Reference in New Issue
Block a user