@@ -22,14 +22,48 @@ Tables will be automatically created.
2222
2323## Getting started
2424
25- Install your database vendor specific plugin, you can use the Jenkins plugin site to search for it:
25+ To install the plugin login to Jenkins → Manage Jenkins → Manage Plugins → Available → Search for 'JUnit SQL Storage' → Install.
2626
27- https://plugins.jenkins.io/ui/search/?labels=database
27+ Use the following steps if you want to build and install the plugin from source.
28+
29+ ### Building
30+
31+ To build the plugin use the ` package ` goal
32+ ```
33+ $ mvn clean package -P quick-build
34+ ```
35+ to run the tests use the ` test ` goal
36+ ```
37+ $ mvn clean test
38+ ```
39+
40+ ### Deploying Jenkins and the plugin
2841
29- e.g. you could install the [ PostgreSQL Database] ( https://plugins.jenkins.io/database-postgresql/ ) plugin.
42+ To try out your changes you can deploy Jenkins using the ` deploy.sh ` file provided in the repository.
43+ ```
44+ $ ./deploy.sh
45+ ```
46+ This will compile the junit-sql-storage plugin (.hpi file), build a docker image of Jenkins with the compiled
47+ junit-sql-storage plugin installed, then deploy the docker swarm of jaeger, postgresql, and Jenkins.
3048
3149### UI
3250
51+ You can also use the Jenkins UI to install the plugin and configure it.
52+
53+ ### Installing Compiled Plugin
54+
55+ Once you've compiled the plugin (see above) you can install it from the Jenkins UI. Go to 'Manage Jenkins' → 'Plugins'
56+ → 'Advanced' → 'Deploy' → 'Choose File' → 'Deploy'
57+
58+ <img alt =" Install hpi plugin file " src =" images/install-junit-sql-storage-plugin.png " width =" 800 " >
59+
60+ Next, install your database vendor specific plugin, you can use the Jenkins plugin site to search for it:
61+
62+ https://plugins.jenkins.io/ui/search/?labels=database
63+
64+ e.g. you could install the [ PostgreSQL Database] ( https://plugins.jenkins.io/database-postgresql/ ) plugin or the
65+ [ MySQL Database] ( https://plugins.jenkins.io/database-mysql/ ) plugin.
66+
3367Manage Jenkins → Configure System → Junit
3468
3569In the dropdown select 'SQL Database'
@@ -42,10 +76,15 @@ Select the database implementation you want to use and click 'Test Connection' t
4276
4377![ JUnit SQL plugin database configuration] ( images/junit-sql-database-config.png )
4478
79+ > ** Note:** use ` db ` as the 'Host Name' if running Jenkins from inside a docker container as part of the
80+ > docker-compose.yaml deployment
81+
4582Click 'Save'
4683
4784### Configuration as code
4885
86+ You can also configure the plugin using the [ Configuration as Code] ( https://plugins.jenkins.io/configuration-as-code/ ) plugin.
87+
4988``` yaml
5089unclassified :
5190 globalDatabaseConfiguration :
@@ -60,6 +99,38 @@ unclassified:
6099 storage : " database"
61100` ` `
62101
102+ Here's an example of how to use it
103+
104+ ` ` `
105+ java -jar java-cli.jar -s http://<host.domain.name>:8080 -auth admin:<api_token> apply-configuration < junit-sql-storage-plugin-config.yml
106+ ```
107+
108+ ### Accessing Jaeger
109+
110+ You can access the Jaeger UI by going to ` http://localhost:16686 ` , here you can view the performance of the Jenkins
111+ server and your plugin changes.
112+
113+ ### Accessing the database
114+
115+ You can also query the postgres database by connecting to the ` db ` container.
116+
117+ ```
118+ $ docker compose exec db psql -U postgres
119+ psql (16.3 (Debian 16.3-1.pgdg120+1))
120+ Type "help" for help.
121+
122+ postgres=# SELECT * FROM caseResults LIMIT 2;
123+ job | build | suite | package | classname | testname | errordetails | skipped | duration | stdout | stderr | st
124+ acktrace | timestamp
125+ ------------+-------+------------------------------------------------------------+-------------------------------------------+------------------------------------------------------------+--------------------------+--------------+---------+----------+--------+--------+---
126+ ---------+----------------------------
127+ xxxx-xxxxx | 1 | xxx.xxxx.xxx.xxxx.xxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx | xxx.xxxx.xxx.xxxx.xxxxxx | xxx.xxxx.xxx.xxxx.xxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx | xxxxxxxxxxxxxxxxxxxxxxxx | | | 0.331 | | |
128+ | 2024-06-13 18:18:26.897532
129+ xxxx-xxxxx | 1 | xxx.xxxx.xxx.xxxxxxxxx.xxxxxxx.xxxxxxxxxx.xxxxxxxxxxxxxxxx | xxx.xxxx.xxx.xxxxxxxxx.xxxxxxx.xxxxxxxxxx | xxx.xxxx.xxx.xxxxxxxxx.xxxxxxx.xxxxxxxxxx.xxxxxxxxxxxxxxxx | xxxxxxxxxxxxxxxxxx | | | 0.292 | | |
130+ | 2024-06-13 18:18:26.897532
131+ (2 rows)
132+ ```
133+
63134## Contributing
64135
65136Refer to our [ contribution guidelines] ( https://github.com/jenkinsci/.github/blob/master/CONTRIBUTING.md )
0 commit comments