/commands

Some CLI commands to integrate with DevOps tools

Primary LanguagePythonMIT LicenseMIT

Commands

Some CLI commands to integrate with DevOps tools

Installation

$ pip3 install -r requirements.txt

Configuration

Create config.json file with following data:

{
  "sonarqube" : {
    "url" : "SONARQUBE URL",
    "token": "SONAR USER TOKEN"
  },
  "gitlab" : {
    "url" : "GITLAB URL",
    "token": "GITLAB USER TOKEN",
    "integrateSlack": true,
    "slackChannel": "SLACK CHANNEL TO CODE REVIEWS"
  },
  "jenkins" : {
    "url" : "JENKINS URL",
    "username" : "JENKINS USERNAME",
    "token": "JENKINS USER TOKEN OR PASSWORD",
    "email": "email@tosend.result",
    "integrateGitlab": true,
    "integrateSlack": true,
    "slackChannel": "SLACK CHANNEL TO BUILD RESULTS"
  },
  "slack" : {
    "token": "SLACK USER TOKEN"
  }
}

Set jenkins.integrateGitlab to true to integrate Gitlab/Jenkins projects

Sample:

{
  "sonarqube" : {
    "url" : "http://sonarqube.mydomain.com",
    "token": "1231241419831g123123"
  },
  "gitlab" : {
    "url" : "https://gitlab.com",
    "token": "1231241419831g123123",
    "integrateSlack": true,
    "slackChannel": "slack-channel"
  },
  "jenkins" : {
    "url" : "http://jenkins.com",
    "username" : "username",
    "token": "1231241419831g123123",
    "email": "email@tosend.result",
    "integrateGitlab": true,
    "integrateSlack": true,
    "slackChannel": "usa-build-jenkins"
  },
  "slack" : {
    "token": "1231241419831g123123"
  }
}

Usage

Sonar

List Sonar status of user favorite projects

$ python3 commands.py sonar

Gitlab

Gitlab commands

$ python3 commands.py gitlab [COMMAND]

List of Commands
  - merge - Create merge request

Jenkins

Jenkins commands

$ python3 commands.py jenkins [COMMAND]

List of Commands
  - build - Build a job

Genarating Tokens

Generate Jenkins tokens

http://URL_JENKINS/user/USER_JENKINS/configure

Generate Gitlab tokens:

http://URL_GITLAB/profile/personal_access_tokens

Generate Slack tokens:

https://api.slack.com/custom-integrations/legacy-tokens

License

MIT