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:
@ -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
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
||||
@ -9,14 +9,14 @@
|
||||
[](https://gitlab.com/nofusscomputing/projects/python-gitlab-management/)
|
||||
[](https://nofusscomputing.gitlab.io/projects/python-gitlab-management/master/coverage/)
|
||||
[](https://gitlab.com/nofusscomputing/projects/python-gitlab-management/-/jobs/artifacts/master/file/gl-code-quality-report.html?job=PyLint)
|
||||
[](https://hub.docker.com/r/nofusscomputing/gitlab-management)
|
||||
[](https://hub.docker.com/r/nofusscomputing/gitlab-management)
|
||||
[](https://python-gitlab-management.readthedocs.io/en/stable/)
|
||||
|
||||
|
||||
[](https://gitlab.com/nofusscomputing/projects/python-gitlab-management/)
|
||||
[](https://nofusscomputing.gitlab.io/projects/python-gitlab-management/development/coverage/)
|
||||
[](https://gitlab.com/nofusscomputing/projects/python-gitlab-management/-/jobs/artifacts/development/file/gl-code-quality-report.html?job=PyLint)
|
||||
[](https://hub.docker.com/r/nofusscomputing/gitlab-management)
|
||||
[](https://hub.docker.com/r/nofusscomputing/gitlab-management)
|
||||
[](https://python-gitlab-management.readthedocs.io/en/development/)
|
||||
|
||||
|
||||
|
||||
20
buildinit.py
Normal file → Executable file
20
buildinit.py
Normal file → Executable 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')
|
||||
|
||||
@ -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'],
|
||||
|
||||
@ -8,7 +8,7 @@ class GitlabManagement:
|
||||
No Fuss Computing's Gitlab Config Management python module.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import gitlab
|
||||
import gitlab.v4.objects
|
||||
import traceback
|
||||
|
||||
Reference in New Issue
Block a user