kubernetes/monitoring/jenkins/init/jobs/test.ab.k8s-3tier-webapp/config.xml
<?xml version='1.1' encoding='UTF-8'?>
<project>
<actions />
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.ChoiceParameterDefinition>
<name>SERVICE</name>
<description>target service</description>
<choices class="java.util.Arrays$ArrayList">
<a class="string-array">
<string></string>
<string>activemq</string>
<string>rabbitmq</string>
<string>hazelcast</string>
<string>redis</string>
<string>kafka</string>
</a>
</choices>
</hudson.model.ChoiceParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.plugins.git.GitSCM" plugin="git@4.4.5">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://github.com/yurake/k8s-3tier-webapp</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list" />
<extensions />
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers />
<concurrentBuild>true</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>#!/bin/sh -x
cd kubernetes/monitoring/test/ab
kubectl apply -f ab-${SERVICE}-job.yaml
kubectl -n monitoring wait --for=condition=complete --timeout=600s job/ab-${SERVICE}
kubectl -n monitoring describe job ab-${SERVICE}
kubectl -n monitoring logs -f $(kubectl get pods -n monitoring | awk '{print $1}' | grep ab-${SERVICE})
kubectl -n monitoring logs -f $(kubectl get pods -n monitoring | awk '{print $1}' | grep ab-${SERVICE}) > ../../../../out.data
kubectl delete -f ab-${SERVICE}-job.yaml
</command>
<configuredLocalRules />
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>cat > apache-benchmark.p << "EOF"
# output as png image
set terminal png
# save file to "benchmark.png"
set output "benchmark-SERVICE-DATE.png"
# graph title
set title "ab -n 100 -c 10 http://k8s.3tier.webapp/quarkus/SERVICE/publish"
#nicer aspect ratio for image size
set size 1,0.7
# y-axis grid
set grid y
#x-axis label
set xlabel "request"
#y-axis label
set ylabel "response time (ms)"
#plot data from "out.data" using column 9 with smooth sbezier lines
plot "out.data" using 9 smooth sbezier with lines title "something"</command>
<configuredLocalRules />
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>sed -i -n '/starttime/,$p' out.data
DATE=`date "+%Y%m%d-%H%M%S"`
sed -i -e "s/SERVICE/${SERVICE}/g" apache-benchmark.p
sed -i -e "s/DATE/${DATE}/g" apache-benchmark.p
gnuplot apache-benchmark.p</command>
<configuredLocalRules />
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>find ${WORKSPACE} -name "benchmark-*.png" -mtime +3 -exec rm {} \;</command>
<configuredLocalRules />
</hudson.tasks.Shell>
</builders>
<publishers />
<buildWrappers>
<org.csanchez.jenkins.plugins.kubernetes.KubectlBuildWrapper plugin="kubernetes@1.27.3">
<serverUrl>https://kubernetes.default.svc.cluster.local</serverUrl>
<credentialsId>1fd27e80-81ad-45be-a952-fe5e0d217074</credentialsId>
</org.csanchez.jenkins.plugins.kubernetes.KubectlBuildWrapper>
</buildWrappers>
</project>