Merge branch 'development' into 'master'

Bug Fix 0.2.1

Closes #13

See merge request nofusscomputing/projects/python-gitlab-management!13
This commit is contained in:
2020-06-21 10:25:53 +00:00
6 changed files with 39 additions and 36 deletions

View File

@ -46,10 +46,6 @@ PyLint:
- if: $CI_MERGE_REQUEST_IID
when: never
- if: '$CI_COMMIT_BRANCH'
changes:
- gitlab_management/*.py
- test/*.py
- ./*.py
when: always
artifacts:
expire_in: 60 days
@ -74,10 +70,6 @@ Unit Test:
- if: $CI_MERGE_REQUEST_IID
when: never
- if: '$CI_COMMIT_BRANCH'
changes:
- gitlab_management/*.py
- test/test_*.py
- setup.py
when: always
artifacts:
expire_in: 3 days
@ -103,10 +95,6 @@ Function Test:
- if: $CI_MERGE_REQUEST_IID
when: never
- if: '$CI_COMMIT_BRANCH'
changes:
- gitlab_management/*.py
- test/test_*.py
- setup.py
when: always
artifacts:
expire_in: 3 days
@ -132,10 +120,6 @@ Integration Test:
- if: $CI_MERGE_REQUEST_IID
when: never
- if: '$CI_COMMIT_BRANCH'
changes:
- gitlab_management/*.py
- test/test_*.py
- setup.py
when: always
artifacts:
expire_in: 3 days
@ -168,10 +152,6 @@ Coverage:
- if: $CI_MERGE_REQUEST_IID
when: never
- if: '$CI_COMMIT_BRANCH'
changes:
- gitlab_management/*.py
- setup.py
- test/*.py
when: on_success
dependencies:
- Unit Test
@ -213,6 +193,8 @@ gitlab-management_package:
- README.md
- CONTRIBUTING.md
when: on_success
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"'
when: always
artifacts:
expire_in: 3 days
when: on_success
@ -246,6 +228,8 @@ Docker_Build-Alpine:
- README.md
- CONTRIBUTING.md
when: on_success
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"'
when: always
dependencies:
- gitlab-management_package
tags:
@ -276,9 +260,6 @@ pages:
- if: $CI_MERGE_REQUEST_IID
when: never
- if: '$CI_COMMIT_BRANCH'
changes:
- gitlab_management/*.py
- setup.py
when: on_success
@ -300,6 +281,8 @@ bandit-sast:
- setup.py
when: on_success
allow_failure: false
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"'
when: always
Scan gitlab-management-Alpine:
@ -320,6 +303,8 @@ Scan gitlab-management-Alpine:
- setup.py
when: on_success
allow_failure: false
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"'
when: always
container_scanning:
@ -351,6 +336,8 @@ gemnasium-python-dependency_scanning:
- requirements.pip
when: on_success
allow_failure: false
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"'
when: always
artifacts:
paths:
- gl-dependency-scanning-report.json
@ -375,12 +362,18 @@ license_scanning:
- setup.py
when: on_success
allow_failure: false
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"'
when: always
Documentation:
stage: validate
image: readthedocs/build:latest
script:
# 'dist/version' not required to validate the docs
- rm -vf $CI_PROJECT_DIR/dist/version
- rm -vf $CI_PROJECT_DIR/gitlab_management/__init__.py
- rm -vf $CI_PROJECT_DIR/dockerfile
- bash $CI_PROJECT_DIR/test/validation-build-docs.sh
dependencies:
- gitlab-management_package
@ -389,8 +382,8 @@ Documentation:
when: never
- if: $CI_MERGE_REQUEST_IID
when: never
- if: '$CI_COMMIT_BRANCH == "master"'
when: never
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"'
when: always
- if: '$CI_COMMIT_BRANCH != "master"'
changes:
- gitlab_management/*.py

View File

@ -80,7 +80,7 @@ Tested and confirmed `.gitlab-ci.yml` tasks as working with the above command
```bash
cd {Repo Directory}
rm -Rf build bin docs/_build gitlab_management.egg-info lib include pyvenv.cfg
rm -Rf build bin docs/_build gitlab_management.egg-info lib include pyvenv.cfg docs/module docs/includes dist/version gitlab_management/__init__.py
CI_PROJECT_DIR=/Repository && docker run -e CI_PROJECT_DIR=$CI_PROJECT_DIR -w $CI_PROJECT_DIR -v $PWD:$CI_PROJECT_DIR readthedocs/build:latest bash test/validation-build-docs.sh
```

View File

@ -9,14 +9,14 @@
[![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)
[![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/nofusscomputing/gitlab-management/stable?color=2496ED&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)
[![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/nofusscomputing/gitlab-management/dev?color=2496ED&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/)

20
buildinit.py Normal file → Executable file
View File

@ -15,10 +15,14 @@ __license__ = "GNU LGPLv3"
__copyright__ = "(C) All Rights reserved"
__source__ = ''
__title__ = "gitlab-management"
__version__ = "0.2.0"
__version__ = "0.2.1"
__doc__ = "https://gitlab.com/nofusscomputing/projects/python-gitlab-management"
CurrentDirectory = './'
if '/docs' in os.environ['PWD']:
CurrentDirectory = '../'
else:
CurrentDirectory = './'
DistributionDirectory = 'dist'
ModuleDirectory = CurrentDirectory + 'gitlab_management/'
VersionFile = CurrentDirectory + DistributionDirectory + '/version'
@ -30,14 +34,16 @@ def init() -> bool:
global __source__, __version__, CurrentRepo, GIT_BRANCH, GIT_COMMIT
if os.path.isdir('./.git'):
if os.path.isdir(CurrentDirectory + '.git'):
CurrentRepo = git.Repo(search_parent_directories=True)
GIT_COMMIT = CurrentRepo.head.object.hexsha
# Check if running within a GitLab Runner
if os.environ.get('CI_COMMIT_BRANCH') is None and os.environ.get('CI_JOB_ID') is None:
if os.environ.get('CI_COMMIT_BRANCH') is None and os.environ.get('CI_JOB_ID') is None and os.environ.get('READTHEDOCS') is None:
GIT_BRANCH = CurrentRepo.head.reference.name
elif os.environ.get('READTHEDOCS') is not None:
GIT_BRANCH = 'READTHEDOCS'
else:
GIT_BRANCH=os.environ.get('CI_COMMIT_BRANCH')
@ -142,10 +148,12 @@ print(OutputPrefix + 'Starting init python script')
if init():
if not WriteFile(CurrentDirectory + 'dockerfile', BuildDockerfile()):
sys.exit(753)
#sys.exit(753)
pass
if not WriteFile(ModuleDirectory + '__init__.py', BuildModuleInit()):
sys.exit(754)
#sys.exit(754)
pass
else:
print(OutputPrefix + 'Init Failure')

View File

@ -100,7 +100,9 @@ html_static_path = ['_static']
import subprocess
Commands = [
['echo $PWD', 'display current working directory'],
['echo CurrentDirectory $PWD', 'display current working directory'],
['pip3 install -r ../requirements.txt', 'setup ready for buildinit to run'],
['python3 ../buildinit.py', 'generate the dynamic files, dockerfile and __init__.py'],
['mkdir -p includes', 'create temp directory source/includes'],
['m2r --dry-run ../README.md > includes/ReadMe.rst', 'convert repo readme to .rst'],
['m2r --dry-run ../CONTRIBUTING.md > includes/Contributing.rst', 'convert repo contrib to .rst'],

View File

@ -8,7 +8,7 @@ class GitlabManagement:
No Fuss Computing's Gitlab Config Management python module.
"""
import gitlab
import gitlab.v4.objects
import traceback