Compare commits

...

3 Commits
main ... dev

  1. 6
      README.md
  2. 2
      galaxy.yml
  3. 13
      plugins/modules/gitea_pull_request_comment.py
  4. 13
      plugins/modules/gitlab_merge_request_comment.py

6
README.md

@ -2,13 +2,13 @@
![CI Status](https://woodpecker.aws.osuv.de/api/badges/ansible_collections/markuman.devops/status.svg)
Documentation for the collection.
Install:
`ansible-galaxy collection install markuman.devops`
# markuman.devops
Covers/plan gitlab (_just one_), gitea and woodpecker modules and sentry (_glitchtip_) callback plugin (_so far_).
Covers/plan gitlab (_just one_), gitea and woodpecker modules and sentry (_glitchtip_) callback plugin (_so far_).
Modules I hack together and have not contributed to `community.` collections.
## markuman.devops.gitlab_merge_request_comment

2
galaxy.yml

@ -8,7 +8,7 @@ namespace: markuman
name: devops
# The version of the collection. Must be compatible with semantic versioning
version: 1.0.0
version: 2.0.0-dev
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

13
plugins/modules/gitea_pull_request_comment.py

@ -51,6 +51,14 @@ EXAMPLES = '''
from ansible.module_utils.basic import AnsibleModule
import os
import traceback
try:
import requests
HAS_REQUESTS_LIB = True
except ImportError:
HAS_REQUESTS_LIB = False
IMPORT_ERROR = traceback.format_exc()
def main():
@ -69,11 +77,6 @@ def main():
issue_id = os.environ.get('CI_PULL_REQUEST')
if issue_id and api_token:
try:
import requests
except ImportError as error:
module.log(error)
repo = os.environ.get('CI_REPO')
gitea_url = f'https://{api_url}/api/v1/repos/{repo}/issues/{issue_id}/comments'

13
plugins/modules/gitlab_merge_request_comment.py

@ -51,6 +51,14 @@ EXAMPLES = '''
from ansible.module_utils.basic import AnsibleModule
import os
import traceback
try:
import requests
HAS_REQUESTS_LIB = True
except ImportError:
HAS_REQUESTS_LIB = False
IMPORT_ERROR = traceback.format_exc()
def main():
@ -69,11 +77,6 @@ def main():
_mr_id = os.environ.get('CI_OPEN_MERGE_REQUESTS')
if _mr_id and api_token:
try:
import requests
except ImportError as error:
module.log(error)
mr_id = _mr_id.split('!')[-1]
pr_id = os.environ.get('CI_PROJECT_ID')
gitlab_mr_url = f'https://{api_url}/api/v4/projects/{pr_id}/merge_requests/{mr_id}/notes'

Loading…
Cancel
Save