jenkins-telegram-chatops

Telegram bot for running Jenkins jobs

MIT License

Stars
6

Jenkins telegram chatops

Jenkins-telegram-chatops is a Telegram bot written using Spring Boot which handing able to show list of Jenkins jobs and run specific job.

Key features

  • listing Jenkins jobs using /jobs command
  • running specific Jenkins job
  • monitoring using Prometheus
  • holding secrets with HashiCorp Vault

Build

Build from source

You can build application using following command:

./gradlew clean build

Requirements:

JDK >= 11

Unit tests

You can run unit tests using following command:

./grdlew test

Mutation tests

You can run mutation tests using following command:

./grdlew pitest

You will be able to find pitest report in build/reports/pitest/ folder.

Running jenkins-telegram-chatops

After the build you will get fully executable jar archive

You can run application using following commands:

java -jar jenkins-telegram-chatops.jar

or

./jenkins-telegram-chatops.jar

Configuration

According to Spring Docs you can override default application properties by put custom application.properties file in one of the following locations:

  • a /config subdirectory of the current directory
  • the current directory

Custom properties

Retryable configuration for checking Jenkins jobs status

When Jenkins job run via REST API jenkins-telegram-chatops waits until it finished. There are three steps :

  • wait until job in Jenkins queue
  • wait until job not started yet
  • wait until job building

Each steps performs REST API calls in maxAttempts attempts with some delay.

Running Jenkins jobs

INTEGRATIONS

Monitoring using Prometheus

You can access prometheus metrics by url:

{host:port}/actuator/prometheus

Holding secrets with HashiCorp Vault

Integration with Vault was made using spring-cloud-vault.

By default jenkins-telegram-chatops integration with Vault disabled.

To enable integration with Vault pass following arguments to jenkins-telegram-chatops run command:

java -jar jenkins-telegram-chatops.jar --spring.cloud.vault.enabled=true --spring.cloud.vault.uri=<your vault uri> 
--spring.cloud.vault.token=<your vault token> --spring.cloud.vault.kv.application-name=<vault application name>

Contributing

Feel free to contribute. New feature proposals and bug fixes should be submitted as GitHub pull requests. Fork the repository on GitHub, prepare your change on your forked copy, and submit a pull request.

IMPORTANT!

Before contributing please read about Conventional Commits / Conventional Commits RU

Badges
Extracted from project README
Conventional Commits Quality Gate Status Reliability Rating Maintainability Rating Security Rating Bugs Code Smells Vulnerabilities Duplicated Lines (%) Lines of Code Technical Debt
Related Projects