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:
Rivera Gonzalez, Julio C 2019-08-29 10:11:28 -05:00 committed by Obed N Munoz
parent 96622b5e55
commit a0ba1b38fe
7 changed files with 254 additions and 117 deletions

49
Jenkinsfile vendored
View File

@ -1,9 +1,9 @@
pipeline { pipeline {
agent { agent {
label "xenial-intel-device-plugins" label "master"
} }
options { options {
timeout(time: 2, unit: "HOURS") timeout(time: 3, unit: "HOURS")
} }
environment { environment {
GO111MODULE="on" GO111MODULE="on"
@ -19,6 +19,19 @@ pipeline {
REPO_NAME="intel-device-plugins-for-kubernetes" REPO_NAME="intel-device-plugins-for-kubernetes"
REPO_DIR="$GOPATH/src/github.com/intel/${REPO_NAME}" 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 "xenial-intel-device-plugins"
}
stages { stages {
stage("Get requirements") { stage("Get requirements") {
parallel { parallel {
@ -144,13 +157,41 @@ pipeline {
} }
post { post {
success { success {
script {
if (env.CHANGE_ID == null) {
withDockerRegistry([ credentialsId: "e16bd38a-76cb-4900-a5cb-7f6aa3aeb22d", url: "https://${REG}" ]) { withDockerRegistry([ credentialsId: "e16bd38a-76cb-4900-a5cb-7f6aa3aeb22d", url: "https://${REG}" ]) {
sh "make push" 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'
}
}
}
}
} }
} }

View File

@ -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/golang:latest $(shell ls build/docker/*.Dockerfile)
@scripts/update-clear-linux-base.sh clearlinux:latest $(shell find demo -name 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
View 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)

View 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
View 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

View 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

View 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