Skip to content

Commit bb54a0e

Browse files
Update docs
* add Jenkins trigger docs * update docs with multiple instances configurations * change order of site plugins execution
1 parent 6629aff commit bb54a0e

9 files changed

+181
-22
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Visit [Eiffel Community](https://eiffel-community.github.io) to get started and
4343
1. [**Understanding subscriptions**](wiki/markdown/subscriptions.md)
4444
- [**REST POST notification**](wiki/markdown/subscription-with-REST-POST-notification.md)
4545
- [**Email notification**](wiki/markdown/subscription-with-email-notification.md)
46+
- [**Trigger parameterized Jenkins jobs**](wiki/markdown/triggering-jenkins-jobs.md)
4647
1. [**Understanding rules**](wiki/markdown/rules.md)
4748
- [**Introduction**](wiki/markdown/rules.md#Introduction)
4849
- [**Rule set up**](wiki/markdown/rules.md#Rule-set-up)

pom.xml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -493,39 +493,19 @@
493493
</configuration>
494494
</plugin>
495495

496-
<plugin>
497-
<groupId>org.apache.maven.plugins</groupId>
498-
<artifactId>maven-site-plugin</artifactId>
499-
<version>3.7.1</version>
500-
<configuration>
501-
<!-- This is where site.xml is located -->
502-
<siteDirectory>${basedir}/wiki</siteDirectory>
503-
<!-- Github pages only generates documentation from docs
504-
directory -->
505-
<outputDirectory>${basedir}/docs</outputDirectory>
506-
</configuration>
507-
<dependencies>
508-
<dependency>
509-
<groupId>org.apache.maven.doxia</groupId>
510-
<artifactId>doxia-module-markdown</artifactId>
511-
<version>1.8</version>
512-
</dependency>
513-
</dependencies>
514-
</plugin>
515-
516496
<plugin>
517497
<artifactId>maven-resources-plugin</artifactId>
518498
<version>3.1.0</version>
519499
<executions>
520500
<execution>
521501
<id>copy-resources</id>
522502
<!-- here the phase you need -->
523-
<phase>site</phase>
503+
<phase>pre-site</phase>
524504
<goals>
525505
<goal>copy-resources</goal>
526506
</goals>
527507
<configuration>
528-
<!-- plugin requires all resources to exist within
508+
<!-- site plugin requires all resources to exist within
529509
resources/ directory -->
530510
<!-- but we don't want to break links in documentation -->
531511
<outputDirectory>${basedir}/wiki/resources/images</outputDirectory>
@@ -542,6 +522,25 @@
542522
</executions>
543523
</plugin>
544524

525+
<plugin>
526+
<groupId>org.apache.maven.plugins</groupId>
527+
<artifactId>maven-site-plugin</artifactId>
528+
<version>3.7.1</version>
529+
<configuration>
530+
<!-- This is where site.xml is located -->
531+
<siteDirectory>${basedir}/wiki</siteDirectory>
532+
<!-- Github pages only generates documentation from docs
533+
directory -->
534+
<outputDirectory>${basedir}/docs</outputDirectory>
535+
</configuration>
536+
<dependencies>
537+
<dependency>
538+
<groupId>org.apache.maven.doxia</groupId>
539+
<artifactId>doxia-module-markdown</artifactId>
540+
<version>1.8</version>
541+
</dependency>
542+
</dependencies>
543+
</plugin>
545544
</plugins>
546545
</build>
547546
</project>

wiki/markdown/configuration.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,26 @@ for the application to run properly.
66

77
Each property is explained in the file so open the properties file for a view
88
on properties role.
9+
10+
## Setting up multiple EI instances
11+
12+
Eiffel intelligence is designed to be able to collect different information in different objects. What information to be collected from what events to what object is configured using a set of rules.
13+
14+
### Set up multiple instances with different rule sets in each instance
15+
16+
In this case we use the same instance of Rabbitmq and MongoDb.
17+
18+
- rabbitmq.consumerName property should be different for each rule set. Otherwise the rabbitmq will split the events in the queue among all the instances listening to that queue
19+
- MongoDb collection names should also be different for each rule set
20+
21+
<img src="images/multiple_EI_instances.png">
22+
</img>
23+
24+
### Set up multiple instances with same rule set
25+
26+
This situation may be needed when the events throughput is very high. In this case the same configuration file is copied to the server where the extra instance will be started.
27+
28+
<img src="images/multiple_EI_instances_same_rule.png">
29+
</img>
30+
31+

wiki/markdown/images/multiple_EI_instances.gliffy

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
186 KB
Loading

wiki/markdown/images/multiple_EI_instances_same_rule.gliffy

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Loading
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Trigger Jenkins
2+
3+
There are some important details to know when triggering Jenkins jobs with parameters and/or token.
4+
5+
## Using _**token**_
6+
Tokens need to be treated as constants so they should be surrounded with single quotes. See examples below.
7+
8+
## _**buildWithParameters**_ endpoint
9+
* Jenkins discards the body specified in notificationMessageKeyValues
10+
* the parameters need to be send in the URL
11+
* do not specify more parameters than you have in your job. This is a Jenkins security feature to hinder that someone triggers jobs that overwrite job environment variables. Your job will not be triggered otherwise.
12+
13+
Example below shows a subscription that triggers a parameterized Jenkins job having job token and a parameter object containing the aggregated object.
14+
Observe that we use buildWithParameters and empty notificationMessageKeyValues.
15+
16+
{
17+
"subscriptionName" : "Subscription1",
18+
19+
// the name of the user who created the subscription
20+
// defaults to an empty string if LDAP is disabled
21+
"ldapUserName" : "ABC",
22+
23+
// instructs whether same subscription should be re-triggered for new additions
24+
// to the aggregated object. If false only first time the conditions are fulfilled
25+
// a notification will be triggered. No matter how many times the aggregated object
26+
// is updated.
27+
"repeat" : false,
28+
"notificationMessageKeyValuesAuth" : [],
29+
"created" : 1542117412833,
30+
31+
// how to notify when a subscription is triggered
32+
"notificationType" : "REST_POST",
33+
"authenticationType" : "BASIC_AUTH",
34+
35+
// the username and password to insert in headers of the POST request when sending
36+
// a notification via REST POST
37+
"userName" : "functionalUser",
38+
"password" : "functionalUserPassword",
39+
40+
// which url to use for the HTTP POST request
41+
"notificationMeta" : "http://eiffel-jenkins1:8080/job/ei-artifact-triggered-job/buildWithParameters?token='TOKEN'&object=id",
42+
43+
// headers for the HTTP request, can be 'application/x-www-form-urlencoded' or 'application/json'
44+
"restPostBodyMediaType" : "application/json",
45+
46+
// the data to send with the HTTP POST request
47+
"notificationMessageKeyValues" : [
48+
{
49+
}
50+
],
51+
52+
// An array of requirements. At least one requirement should be fulfilled to
53+
// trigger this subscription.
54+
"requirements" : [
55+
{
56+
// Array of conditions. Here we use JMESPATH condition based on content in
57+
// aggregated object. All conditions needs to be fulfilled in order for
58+
// a requirement to be fulfilled.
59+
60+
"conditions" : [
61+
{
62+
"jmespath" : "gav.groupId=='com.othercompany.library'"
63+
}
64+
]
65+
}
66+
67+
]
68+
}
69+
70+
## _**build**_ endpoint
71+
* the parameters should be specified in notificationMessageKeyValues. Also here not more parameters than the job is configured with. Your job will not be triggered otherwise.
72+
* no job parameters in the URL
73+
74+
The subscription below triggers the same parameterized Jenkins job but we now use build endpoint and we send the parameter in a json form using REST body.
75+
76+
{
77+
"subscriptionName" : "Subscription1",
78+
79+
// the name of the user who created the subscription
80+
// defaults to an empty string if LDAP is disabled
81+
"ldapUserName" : "ABC",
82+
83+
// instructs whether same subscription should be re-triggered for new additions
84+
// to the aggregated object. If false only first time the conditions are fulfilled
85+
// a notification will be triggered. No matter how many times the aggregated object
86+
// is updated.
87+
"repeat" : false,
88+
"notificationMessageKeyValuesAuth" : [],
89+
"created" : 1542117412833,
90+
91+
// how to notify when a subscription is triggered
92+
"notificationType" : "REST_POST",
93+
"authenticationType" : "BASIC_AUTH",
94+
95+
// the username and password to insert in headers of the POST request when sending
96+
// a notification via REST POST
97+
"userName" : "functionalUser",
98+
"password" : "functionalUserPassword",
99+
100+
// which url to use for the HTTP POST request
101+
"notificationMeta" : "http://eiffel-jenkins1:8080/job/ei-artifact-triggered-job/build?token='TOKEN'",
102+
103+
// headers for the HTTP request, can be 'application/x-www-form-urlencoded' or 'application/json'
104+
"restPostBodyMediaType" : "application/json",
105+
106+
// the data to send with the HTTP POST request
107+
"notificationMessageKeyValues" : [
108+
{
109+
// form value will be run through JMESPATH engine to extract
110+
// content from aggregated object.
111+
112+
"formkey" : "json",
113+
"formvalue" : "{parameter: [{ name: 'object', value : to_string(@) }]}"
114+
}
115+
],
116+
117+
// An array of requirements. At least one requirement should be fulfilled to
118+
// trigger this subscription.
119+
"requirements" : [
120+
{
121+
// Array of conditions. Here we use JMESPATH condition based on content in
122+
// aggregated object. All conditions needs to be fulfilled in order for
123+
// a requirement to be fulfilled.
124+
125+
"conditions" : [
126+
{
127+
"jmespath" : "gav.groupId=='com.othercompany.library'"
128+
}
129+
]
130+
}
131+
132+
]
133+
}

wiki/site.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<item collapse="true" name="Understanding subscriptions" href="subscriptions.html">
4747
<item name="Subscription with REST POST notification" href="subscription-with-REST-POST-notification.html" />
4848
<item name="Subscription with Email notification" href="subscription-with-email-notification.html" />
49+
<item name="Trigger parameterized Jenkins jobs" href="triggering-jenkins-jobs.html" />
4950
</item>
5051
<item collapse="true" name ="Understanding rules" href="rules.html">
5152
<item name="Merge Resolver Rules" href="merge-resolver-rules.html" />

0 commit comments

Comments
 (0)