Skip to content

Commit 4a85210

Browse files
committed
Jenkins job configs
1 parent 3ec7413 commit 4a85210

File tree

3 files changed

+328
-0
lines changed

3 files changed

+328
-0
lines changed

Consul/config.xml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<project>
3+
<actions/>
4+
<description></description>
5+
<keepDependencies>false</keepDependencies>
6+
<properties/>
7+
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
8+
<configVersion>2</configVersion>
9+
<userRemoteConfigs>
10+
<hudson.plugins.git.UserRemoteConfig>
11+
<url>https://github.com/prometheus/prometheus.git</url>
12+
</hudson.plugins.git.UserRemoteConfig>
13+
</userRemoteConfigs>
14+
<branches>
15+
<hudson.plugins.git.BranchSpec>
16+
<name>*/master</name>
17+
</hudson.plugins.git.BranchSpec>
18+
</branches>
19+
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
20+
<submoduleCfg class="list"/>
21+
<extensions/>
22+
</scm>
23+
<canRoam>true</canRoam>
24+
<disabled>false</disabled>
25+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
26+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
27+
<triggers/>
28+
<concurrentBuild>false</concurrentBuild>
29+
<builders>
30+
<hudson.tasks.Shell>
31+
<command>#!/bin/bash
32+
33+
set -ex
34+
35+
# Download, configure, and run Consul.
36+
wget -q https://releases.hashicorp.com/consul/1.0.3/consul_1.0.3_linux_amd64.zip
37+
unzip consul_*
38+
echo &apos;{&quot;service&quot;: {&quot;name&quot;: &quot;web&quot;, &quot;tags&quot;: [&quot;web&quot;], &quot;port&quot;: 9090}}&apos; | tee web.json
39+
./consul agent -dev -config-dir=. &amp;
40+
41+
42+
# Build and run Prometheus.
43+
go get github.com/prometheus/prometheus/cmd/...
44+
make build
45+
cat &lt;&lt; EOF &gt; prometheus.yml
46+
global:
47+
scrape_interval: 1s
48+
49+
scrape_configs:
50+
- job_name: dummy
51+
consul_sd_configs:
52+
- server: &apos;localhost:8500&apos;
53+
relabel_configs:
54+
- source_labels: [__meta_consul_tags]
55+
regex: .*,web,.*
56+
action: keep
57+
- source_labels: [__meta_consul_service]
58+
target_label: job
59+
EOF
60+
./prometheus &amp;
61+
sleep 10
62+
63+
# Check if Consul SD is working correctly.
64+
res=`curl -s http://localhost:9090/api/v1/targets | jq -r &apos;.data.activeTargets[0].health&apos;`
65+
if [[ $res = &quot;up&quot; ]]; then
66+
kill -9 $!
67+
exit 0
68+
fi
69+
kill -9 $!
70+
exit 1</command>
71+
</hudson.tasks.Shell>
72+
</builders>
73+
<publishers>
74+
<hudson.plugins.ws__cleanup.WsCleanup plugin="[email protected]">
75+
<patterns class="empty-list"/>
76+
<deleteDirs>false</deleteDirs>
77+
<skipWhenFailed>false</skipWhenFailed>
78+
<cleanWhenSuccess>true</cleanWhenSuccess>
79+
<cleanWhenUnstable>true</cleanWhenUnstable>
80+
<cleanWhenFailure>true</cleanWhenFailure>
81+
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
82+
<cleanWhenAborted>true</cleanWhenAborted>
83+
<notFailBuild>false</notFailBuild>
84+
<cleanupMatrixParent>false</cleanupMatrixParent>
85+
<externalDelete></externalDelete>
86+
</hudson.plugins.ws__cleanup.WsCleanup>
87+
</publishers>
88+
<buildWrappers>
89+
<hudson.plugins.ws__cleanup.PreBuildCleanup plugin="[email protected]">
90+
<deleteDirs>false</deleteDirs>
91+
<cleanupParameter></cleanupParameter>
92+
<externalDelete></externalDelete>
93+
</hudson.plugins.ws__cleanup.PreBuildCleanup>
94+
<org.jenkinsci.plugins.golang.GolangBuildWrapper plugin="[email protected]">
95+
<goVersion>Go 1.9.3</goVersion>
96+
</org.jenkinsci.plugins.golang.GolangBuildWrapper>
97+
</buildWrappers>
98+
</project>

EC2/config.xml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<project>
3+
<actions/>
4+
<description></description>
5+
<keepDependencies>false</keepDependencies>
6+
<properties>
7+
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="[email protected]">
8+
<projectUrl>https://github.com/PrometheusJenkinsTest/prometheus/</projectUrl>
9+
<displayName></displayName>
10+
</com.coravy.hudson.plugins.github.GithubProjectProperty>
11+
</properties>
12+
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
13+
<configVersion>2</configVersion>
14+
<userRemoteConfigs>
15+
<hudson.plugins.git.UserRemoteConfig>
16+
<name>origin</name>
17+
<refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
18+
<url>https://github.com/PrometheusJenkinsTest/prometheus.git</url>
19+
<credentialsId>712d10e9-0d5b-4b49-8e1f-76b8c31cdb8a</credentialsId>
20+
</hudson.plugins.git.UserRemoteConfig>
21+
</userRemoteConfigs>
22+
<branches>
23+
<hudson.plugins.git.BranchSpec>
24+
<name>${sha1}</name>
25+
</hudson.plugins.git.BranchSpec>
26+
</branches>
27+
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
28+
<submoduleCfg class="list"/>
29+
<extensions/>
30+
</scm>
31+
<assignedNode>ec2 &amp;&amp; linux &amp;&amp; ubuntu</assignedNode>
32+
<canRoam>false</canRoam>
33+
<disabled>false</disabled>
34+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
35+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
36+
<triggers>
37+
<org.jenkinsci.plugins.ghprb.GhprbTrigger plugin="[email protected]">
38+
<spec>H/1 * * * *</spec>
39+
<configVersion>3</configVersion>
40+
<adminlist>conorbro-test</adminlist>
41+
<allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
42+
<orgslist></orgslist>
43+
<cron>H/1 * * * *</cron>
44+
<buildDescTemplate></buildDescTemplate>
45+
<onlyTriggerPhrase>false</onlyTriggerPhrase>
46+
<useGitHubHooks>true</useGitHubHooks>
47+
<permitAll>false</permitAll>
48+
<whitelist>conorbro-test</whitelist>
49+
<autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
50+
<displayBuildErrorsOnDownstreamBuilds>false</displayBuildErrorsOnDownstreamBuilds>
51+
<whiteListTargetBranches>
52+
<org.jenkinsci.plugins.ghprb.GhprbBranch>
53+
<branch></branch>
54+
</org.jenkinsci.plugins.ghprb.GhprbBranch>
55+
</whiteListTargetBranches>
56+
<blackListTargetBranches>
57+
<org.jenkinsci.plugins.ghprb.GhprbBranch>
58+
<branch></branch>
59+
</org.jenkinsci.plugins.ghprb.GhprbBranch>
60+
</blackListTargetBranches>
61+
<gitHubAuthId>3643cc38-7e63-4b3a-8abb-0787f06c1c70</gitHubAuthId>
62+
<triggerPhrase>.*</triggerPhrase>
63+
<skipBuildPhrase>.*\[skip\W+ci\].*</skipBuildPhrase>
64+
<blackListCommitAuthor></blackListCommitAuthor>
65+
<blackListLabels></blackListLabels>
66+
<whiteListLabels></whiteListLabels>
67+
<includedRegions></includedRegions>
68+
<excludedRegions></excludedRegions>
69+
<extensions>
70+
<org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
71+
<commitStatusContext></commitStatusContext>
72+
<triggeredStatus></triggeredStatus>
73+
<startedStatus></startedStatus>
74+
<statusUrl></statusUrl>
75+
<addTestResults>false</addTestResults>
76+
</org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
77+
</extensions>
78+
</org.jenkinsci.plugins.ghprb.GhprbTrigger>
79+
</triggers>
80+
<concurrentBuild>false</concurrentBuild>
81+
<builders>
82+
<hudson.tasks.Shell>
83+
<command>#!/bin/bash
84+
85+
set -ex
86+
87+
go get github.com/prometheus/prometheus/cmd/...
88+
make build
89+
cat &lt;&lt; EOF &gt; prometheus.yml
90+
global:
91+
scrape_interval: 1s
92+
evaluation_interval: 1s
93+
scrape_configs:
94+
- job_name: &apos;node&apos;
95+
ec2_sd_configs:
96+
- region: eu-west-1
97+
access_key: $AWS_ACCESS_KEY_ID
98+
secret_key: $AWS_SECRET_ACCESS_KEY
99+
port: 9100
100+
EOF
101+
./prometheus &amp;
102+
sleep 10
103+
104+
res=`curl -s http://localhost:9090/api/v1/targets | jq -r &apos;.data.activeTargets[0].discoveredLabels.__meta_ec2_public_dns_name&apos;`
105+
if [[ $res =~ &quot;ec2&quot; ]]; then
106+
pkill prometheus
107+
exit 0
108+
fi
109+
pkill prometheus
110+
exit 1</command>
111+
</hudson.tasks.Shell>
112+
</builders>
113+
<publishers>
114+
<hudson.plugins.ws__cleanup.WsCleanup plugin="[email protected]">
115+
<patterns class="empty-list"/>
116+
<deleteDirs>false</deleteDirs>
117+
<skipWhenFailed>false</skipWhenFailed>
118+
<cleanWhenSuccess>true</cleanWhenSuccess>
119+
<cleanWhenUnstable>true</cleanWhenUnstable>
120+
<cleanWhenFailure>true</cleanWhenFailure>
121+
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
122+
<cleanWhenAborted>true</cleanWhenAborted>
123+
<notFailBuild>false</notFailBuild>
124+
<cleanupMatrixParent>false</cleanupMatrixParent>
125+
<externalDelete></externalDelete>
126+
</hudson.plugins.ws__cleanup.WsCleanup>
127+
</publishers>
128+
<buildWrappers>
129+
<hudson.plugins.timestamper.TimestamperBuildWrapper plugin="[email protected]"/>
130+
<org.jenkinsci.plugins.golang.GolangBuildWrapper plugin="[email protected]">
131+
<goVersion>Go 1.9.3</goVersion>
132+
</org.jenkinsci.plugins.golang.GolangBuildWrapper>
133+
</buildWrappers>
134+
</project>

zookeeper/config.xml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<project>
3+
<actions/>
4+
<description></description>
5+
<keepDependencies>false</keepDependencies>
6+
<properties/>
7+
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
8+
<configVersion>2</configVersion>
9+
<userRemoteConfigs>
10+
<hudson.plugins.git.UserRemoteConfig>
11+
<url>https://github.com/prometheus/prometheus.git</url>
12+
</hudson.plugins.git.UserRemoteConfig>
13+
</userRemoteConfigs>
14+
<branches>
15+
<hudson.plugins.git.BranchSpec>
16+
<name>*/master</name>
17+
</hudson.plugins.git.BranchSpec>
18+
</branches>
19+
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
20+
<submoduleCfg class="list"/>
21+
<extensions/>
22+
</scm>
23+
<canRoam>true</canRoam>
24+
<disabled>false</disabled>
25+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
26+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
27+
<triggers/>
28+
<concurrentBuild>false</concurrentBuild>
29+
<builders>
30+
<hudson.tasks.Shell>
31+
<command>#!/bin/bash
32+
33+
# Assuming machine has Go environment, ZooKeeper, and Git.
34+
35+
set -ex
36+
37+
# Create znode and add relevant target data.
38+
/usr/share/zookeeper/bin/zkCli.sh -server localhost:2181 &lt;&lt;EOF
39+
create /demo some_value
40+
create /demo/key1 &apos;{ &quot;serviceEndpoint&quot;: {&quot;host&quot;: &quot;127.0.0.1&quot;, &quot;port&quot;: 9090}, &quot;status&quot;:&quot;grand&quot;, &quot;shard&quot;:1 }&apos;
41+
quit
42+
EOF
43+
44+
# Download, untar, configure, and run Prometheus.
45+
go get github.com/prometheus/prometheus/cmd/...
46+
make build
47+
cat &lt;&lt; EOF &gt; prometheus.yml
48+
global:
49+
scrape_interval: 1s
50+
scrape_configs:
51+
- job_name: &apos;zookeeper&apos;
52+
serverset_sd_configs:
53+
- servers:
54+
- &apos;localhost:2181&apos;
55+
paths:
56+
- &apos;/demo&apos;
57+
EOF
58+
./prometheus &amp;
59+
sleep 10
60+
61+
# Query Prometheus to see if expected target is found.
62+
res=`curl -s http://localhost:9090/api/v1/targets | jq -r &apos;.data.activeTargets[0].discoveredLabels.job&apos;`
63+
if [ $res = &apos;zookeeper&apos; ]; then
64+
kill -9 $!
65+
exit 0
66+
fi
67+
kill -9 $!
68+
exit 1</command>
69+
</hudson.tasks.Shell>
70+
</builders>
71+
<publishers>
72+
<hudson.plugins.ws__cleanup.WsCleanup plugin="[email protected]">
73+
<patterns class="empty-list"/>
74+
<deleteDirs>false</deleteDirs>
75+
<skipWhenFailed>false</skipWhenFailed>
76+
<cleanWhenSuccess>true</cleanWhenSuccess>
77+
<cleanWhenUnstable>true</cleanWhenUnstable>
78+
<cleanWhenFailure>true</cleanWhenFailure>
79+
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
80+
<cleanWhenAborted>true</cleanWhenAborted>
81+
<notFailBuild>false</notFailBuild>
82+
<cleanupMatrixParent>false</cleanupMatrixParent>
83+
<externalDelete></externalDelete>
84+
</hudson.plugins.ws__cleanup.WsCleanup>
85+
</publishers>
86+
<buildWrappers>
87+
<hudson.plugins.ws__cleanup.PreBuildCleanup plugin="[email protected]">
88+
<deleteDirs>false</deleteDirs>
89+
<cleanupParameter></cleanupParameter>
90+
<externalDelete></externalDelete>
91+
</hudson.plugins.ws__cleanup.PreBuildCleanup>
92+
<org.jenkinsci.plugins.golang.GolangBuildWrapper plugin="[email protected]">
93+
<goVersion>Go 1.9.3</goVersion>
94+
</org.jenkinsci.plugins.golang.GolangBuildWrapper>
95+
</buildWrappers>
96+
</project>

0 commit comments

Comments
 (0)