!5 ~CodeReview for MR !5. closes #1.

This commit is contained in:
2020-06-21 04:41:07 +00:00
parent 050c204310
commit 43f71e219f
7 changed files with 104 additions and 18 deletions

View File

@ -5,15 +5,18 @@
[![Pipelien Status - Stable](https://img.shields.io/badge/dynamic/json.svg?label=Pipeline%20%5Bstable%5D&query=0.status&url=https://gitlab.com/api/v4/projects/19099644/pipelines?ref=master&color=ff782e&logo=gitlab&style=plastic)](https://gitlab.com/nofusscomputing/projects/python-gitlab-management/)
[![Code Coverage - Stable](https://img.shields.io/badge/dynamic/json?color=F01F7A&label=Coverage%20%5Bstable%5D&query=%24.totals.percent_covered&suffix=%&logo=codecov&style=plastic&url=https%3A%2F%2Fnofusscomputing.gitlab.io%2Fprojects%2Fpython-gitlab-management%2Fmaster%2Fcoverage.json)](https://nofusscomputing.gitlab.io/projects/python-gitlab-management/master/coverage/)
[![PyLint Score Master](https://img.shields.io/badge/dynamic/json?color=73398D&label=PyLint%20Score%20%5Bstable%5D&query=%24.PyLintScore&style=plastic&url=https:%2F%2Fgitlab.com%2Fnofusscomputing%2Fprojects%2Fpython-gitlab-management%2F-%2Fjobs%2Fartifacts%2Fmaster%2Ffile%2Fbadge_pylint.json?job=PyLint)](https://gitlab.com/nofusscomputing/projects/python-gitlab-management/-/jobs/artifacts/master/file/gl-code-quality-report.html?job=PyLint)
[![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/nofusscomputing/gitlab-management/stable?label=Docker%20%5Bstable%5D&logo=docker&style=plastic)](https://hub.docker.com/r/nofusscomputing/gitlab-management)
[![Read the Docs (version)](https://img.shields.io/readthedocs/python-gitlab-management/stable?label=Docs%20stable&logo=readthedocs&style=plastic)](https://python-gitlab-management.readthedocs.io/en/stable/)
[![Pipelien Status - Dev](https://img.shields.io/badge/dynamic/json.svg?label=Pipeline%20%5BDev%5D&query=0.status&url=https://gitlab.com/api/v4/projects/19099644/pipelines/?ref=development&color=ff782e&logo=gitlab&style=plastic)](https://gitlab.com/nofusscomputing/projects/python-gitlab-management/)
[![Code Coverage - dev](https://img.shields.io/badge/dynamic/json?color=F01F7A&label=Coverage%20%5BDev%5D&query=%24.totals.percent_covered&suffix=%&logo=codecov&style=plastic&url=https://gitlab.com/nofusscomputing/projects/python-gitlab-management/-/jobs/artifacts/development/file/badge_coverage.json?job=Coverage)](https://nofusscomputing.gitlab.io/projects/python-gitlab-management/development/coverage/)
[![PyLint Score Dev](https://img.shields.io/badge/dynamic/json?color=73398D&label=PyLint%20Score%20%5BDev%5D&query=%24.PyLintScore&style=plastic&url=https://gitlab.com/nofusscomputing/projects/python-gitlab-management/-/jobs/artifacts/development/file/badge_pylint.json?job=PyLint)](https://gitlab.com/nofusscomputing/projects/python-gitlab-management/-/jobs/artifacts/development/file/gl-code-quality-report.html?job=PyLint)
[![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/nofusscomputing/gitlab-management/dev?label=Docker%20%5Bdev%5D&logo=docker&style=plastic)](https://hub.docker.com/r/nofusscomputing/gitlab-management)
[![Read the Docs (version)](https://img.shields.io/readthedocs/python-gitlab-management/development?label=Docs%20devel&logo=readthedocs&style=plastic)](https://python-gitlab-management.readthedocs.io/en/development/)

31
docs/pages/cli.rst Normal file
View File

@ -0,0 +1,31 @@
Command Line Interface (CLI)
============================
``gitlab-management`` can be run from the command line. to enable functionality when running the command, use arguments. ``-h`` will display help.
``-h`` displays the following
.. code-block:: bash
GitLab-Management Help
To run this module the following options are available. There is a short and long version of each option.
Example: python3 gitlab-management -T {GitlabAuthToken}
-H --Host (Optional) GitLab host to connect to. include http(s)://. Default: https://gitlab.com
-T --Token (Mandatory) GitLab Private token for authentication.
-l --labels Process configuration group.labels.
-v --verbose (Optional) Verbose command output.
-h --Help used to display this help text.
When running the module from the cli, exit codes are returned to denote what has occured. exit code ``0`` is always returned on success.
Please see `cli class <../module/gitlab_management.cli.html>`_ for more details.
See Also
--------
- `cli Class <../module/gitlab_management.cli.html>`_

View File

@ -1,16 +0,0 @@
# Docker
The module has been built into a docker container that can be found on [docker hub](https://hub.docker.com/r/nofusscomputing/gitlab-management). by design the container does not need a command to be specified at runtime, as the `ENTRYPOINT` has been set to `gitlab-management`. Therefore you only need to specify the arguments for `gitlab-management`. If you fail to specify any arguments in the `docker run` command, gitlab-management help will be displayed
## Building
**To Build, execute the following:**
``` bash
python3 setup.py sdist bdist_wheel
docker build . --no-cache -t nofusscomputing/gitlab-management:$(cat dist/version)-alpine
```
## Running
**To run the docker image, execute to following:**
``` bash
WORKING_DIR=/Config && docker run -v $PWD:$WORKING_DIR -w $WORKING_DIR nofusscomputing/gitlab-management:$(cat dist/version)-alpine {Arguments}
```
>**Note:** substitute `{Arguments}` with the switches for gitlab-management, i.e. `-h` for help.

23
docs/pages/docker.rst Normal file
View File

@ -0,0 +1,23 @@
Docker
=======
The module has been built into a docker container that can be found on `docker hub <https://hub.docker.com/r/nofusscomputing/gitlab-management>`_. by design the container does not need a command to be specified at runtime, as the ``ENTRYPOINT`` has been set to ``gitlab-management``. Therefore you only need to specify the `arguments <../pages/cli.html>`_ for ``gitlab-management``. If you fail to specify any arguments in the ``docker run`` command, gitlab-management help will be displayed
Building
--------
**To Build, execute the following:**
.. code-block:: bash
python3 setup.py sdist bdist_wheel
docker build . --no-cache -t nofusscomputing/gitlab-management:$(cat dist/version)-alpine
Running
-------
**To run the docker image, execute to following:**
.. code-block:: bash
WORKING_DIR=/Config && docker run -v $PWD:$WORKING_DIR -w $WORKING_DIR nofusscomputing/gitlab-management:$(cat dist/version)-alpine {Arguments}
.. tip:: **Note:** substitute ``{Arguments}`` with the switches for gitlab-management, i.e. ``-h`` for help.

View File

@ -6,6 +6,7 @@ For assistance in using this module please see the sections below.
.. toctree::
:maxdepth: 2
cli
configuration
docker
labels

View File

@ -4,13 +4,13 @@ Unit testing is done on all classes and methods. Unit testing has been broken do
1. Function
1. Integration
Depending on what is type of item is being tested will depend on where the testing code will go.
Depending on what item is being tested will depend on where the testing code will go.
## Unit
The Unit test is the most basic of all of the tests. It's intent is to check the following items:
1. Method exists `{Classname}.globals`
1. all Inputs
1. The retrun values
1. The return values
1. Exceptions
* Unexpected
* Expected exceptions are thrown

44
test.md Executable file
View File

@ -0,0 +1,44 @@
## Problem to solve
<!-- What problem do we solve? Try to define the who/what/why of the opportunity as a user story. For example, "As a (who), I want (what), so I can (why/value)." ) -->
Actions taken by the module should have the option to be logged for auditing purposes. This would allow actions performed to be tracked, checked and have metrics available should it be needed.
## Details
1. **project changed** if a user notices that something has changed in the project/group, an audit log would enable a check to confirm the what and when or if it was made by `gitlab-management`
* [ ] ~Feature log to a specified location
1. **Usage tracking** with logging, you will be able to determine how much `gitlab-management` is being used. for this to occur the log file should be able to stand up to scrutiny.
* [ ] ~Feature commit log to git repository
* if the specified log location is a git repository, commit the log to the repository.
* possible log message: `Logfile {filename} updated with {SHA1_HASH} SHA1 fingerprint.`
* [ ] ~Feature Determine if log path `git sub-module`, commit to it, not parent repo.
1. **Specify log level** Minimum logging level will be `Information`, with the option to specify `Debug`. No other level will be available at this stage.
* [ ] ~Feature Specify log level
1. **Log format** the log file will be plain text. at this stage, it will be formatted as a csv. A CSV will allow easy import into many different programs for further review or madification.
* [ ] ~Feature Log file a CSV.
<!-- Include use cases, benefits, goals, or any other details that will help us understand the problem better. -->
## Documentation
* [ ] ~Documentation CLI help
* There needs to be a Switch for activating this feature.
* [ ] ~Documentation page for python-gitlab-management.readthedocs.io
<!--
Add all known Documentation Requirements in this section.
-->
### Links / references
<!-- place any links here including any references. i.e. any other python modules required-->
/label ~Feature ~"Documentation::Not Started"