levonet.ci_github_pr_description

CI: Add Build Information to Pull Request

Build Status

This feature adds build information to the description of a Pull Request.

Required Variables

  • ci_github_api (default: https://api.github.com)
  • ci_github_username (required): Your Github username.
  • ci_github_password (required): Access token for Github.
  • ci_github_owner (required): The owner or organization name on Github.
  • ci_github_repo (required): The name of your project repository on Github.
  • ci_github_pr_number (required): The number of the Pull Request on Github.
  • ci_github_branch (optional): The name of the branch on Github.
  • ci_github_jira_task_url (optional): The URL for the Jira task related to the repository.
  • ci_github_jira_task_filter (optional): A regular expression to filter Jira tasks from the Github branch.
    Example: (TODO|BUGS)-\d+.
  • ci_github_message_body (required): Custom text messages that include CI information.
  • ci_github_message_id (optional): An ID for the messages. Useful if there are multiple messages in the Pull Request description.

Example Playbook

- hosts: 127.0.0.1
  connection: local
  gather_facts: no
  vars:
    ci_github_username: ci-bot
    ci_github_password: secret
    ci_github_branch: "{{ github_branch }}"
    ci_github_pr_number: "{{ github_pr_number }}"
    ci_github_owner: myorg
    ci_github_repo: myapp
    ci_github_jira_task_filter: (MYAPPAPI|MYAPPDB|BUGS)-\d+
    ci_github_jira_task_url: https://myorg.atlassian.net/browse/
    ci_github_message_body: |
      * App: [pr-{{ ci_github_pr_number }}.myapp.myorg.com|http://pr-{{ ci_github_pr_number }}.myapp.myorg.com]
      * Logs: [myapp-PR-{{ ci_github_pr_number }}|http://grafana.myorg.com/d/XxXxXx/logs?var-host=sandbox1&var-app=myapp-PR-{{ ci_github_pr_number }}]
      * Jenkins: [PR-{{ ci_github_pr_number }}|http://jenkins.myorg.com/job/myapp/view/change-requests/job/PR-{{ ci_github_pr_number }}/]
  roles:
    - role: levonet.ci_github_pr_description

To run it in Jenkins:

ansible-playbook myplaybook.yml -e github_branch="${CHANGE_BRANCH}" -e github_pr_number="${CHANGE_ID}"

This will update the Pull Request description to include:

Old description information if exists

License

MIT

Author Information

This role was created by Pavlo Bashynskyi.

Informazioni sul progetto

Add build information to Pull Request description.

Installa
ansible-galaxy install levonet.ci_github_pr_description
Licenza
mit
Download
61.5k
Proprietario