This API is designed to fetch data from Jenkins and store the fetched data in mongoDB.
This API gives below two routes:
- /getJobsDetails: This gives details of all jobs present in Jenkins.
- /getSlavesDetails: This gives details of all masters and slaves in Jenkins.
To get this API running, first you need to set below environment variables:
Variable Key | Variable Description | Variable Example Value |
---|---|---|
JENKINS_MASTER | Domain name of Jenkins Instance | localhost:8085 |
JENKINS_USERNAME | Username of admin account in Jenkins | admin |
JENKINS_PASSWORD | Password of admin account in Jenkins | password |
DB_CONNECTION_STRING | Mongo DB connection string | dashboard-database-h8w2s.mongodb.net/test?retryWrites=true&w=majority |
DB_USERNAME | Username of one account in mongoDB | dbUser |
DB_PASSWORD | Password of one account in mongoDB | dbPassword |
-
Set all the environment variables correctly as defined in previous section.
-
Install all dependencies
$ npm install
- Run the API
$ node index.js