Browse Source

First Jenkins build

pull/1/head
Michael COSTA 6 months ago
parent
commit
50e4eb0317
14 changed files with 106 additions and 2355 deletions
  1. +5
    -3
      .gitignore
  2. +0
    -708
      CHANGELOG.md
  3. +3
    -3
      CONTRIBUTING.md
  4. +3
    -2
      Jenkinsfile
  5. +17
    -8
      Makefile
  6. +33
    -1583
      README.md
  7. +0
    -18
      requirements.txt
  8. BIN
      scrippy-git.png
  9. +10
    -0
      scrippy_git/__init__.py
  10. +8
    -8
      scrippy_git/git/__init__.py
  11. +2
    -20
      setup.cfg
  12. +2
    -2
      sonar-project.properties
  13. +0
    -0
      tests/__init__.py
  14. +23
    -0
      tests/test_git.py

+ 5
- 3
.gitignore View File

@ -1,13 +1,15 @@
*un~
*.swp
*.pyc
*/__pycache__
**/__pycache__/
build/
dist/
infra.egg-info/
python_infra.egg-info/
scrippy_git.egg-info/
test.py
populate_dir.py
.vscode/
venv/
.pytest_cache/
.idea
.coverage
junit_report.xml

+ 0
- 708
CHANGELOG.md View File

@ -1,708 +0,0 @@
# Changelog
Fichier généré automatiquement par auto-changelog
## 1.1.52 (2021-01-20)
#### Fixes
* Makefile: Bad VERSION number
* Makefile: Bad VERSION number
* Makefile: Bad VERSION number
* bumpversion current_version
* Makefile: More targets
* Makefile: More targets
* Makefile: More targets
* Makefile: More targets
* Makefile: More targets
* Makefile
#### Others
* Makefile bumpversion and release targets
* Makefile bumpversion and release targets
Full set of changes: [`1.1.46...1.1.52`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.46...1.1.52)
## 1.1.46 (2020-12-29)
#### Fixes
* remote.ssh.exec_command should not show command unless --debug is used
Full set of changes: [`1.1.45...1.1.46`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.45...1.1.46)
## 1.1.45 (2020-12-29)
#### Fixes
* remote.ssh.exec_command should not show command unless --debug is used
Full set of changes: [`1.1.44...1.1.45`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.44...1.1.45)
## 1.1.44 (2020-12-09)
#### Fixes
* TERM is not defined on remote execution
Full set of changes: [`1.1.43...1.1.44`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.43...1.1.44)
## 1.1.43 (2020-12-09)
#### Fixes
* No more color in Jobscheduler + colors in log files
* No more color in Jobscheduler + colors in log files
* No more color in Jobscheduler + colors in log files
Full set of changes: [`1.1.42...1.1.43`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.42...1.1.43)
## 1.1.42 (2020-11-25)
#### Fixes
* SIN-15126
Full set of changes: [`1.1.41...1.1.42`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.41...1.1.42)
## 1.1.41 (2020-11-25)
#### Fixes
* SIN-15126
* SIN-15126
* SIN-15126
Full set of changes: [`1.1.40...1.1.41`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.40...1.1.41)
## 1.1.40 (2020-11-25)
#### Fixes
* SIN-15126
* SIN-15126
Full set of changes: [`1.1.39...1.1.40`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.39...1.1.40)
## 1.1.39 (2020-10-27)
#### Fixes
* (errorhandler): correction gestion du sys.exit
Full set of changes: [`1.1.38...1.1.39`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.38...1.1.39)
## 1.1.38 (2020-10-27)
#### New Features
* (history): en cas d'exception affiche le nom de l'exception dans le hist à la place de l'exit_code
* (error_handler): ajout gestion d'exception
#### Fixes
* commit only if repo is dirty
Full set of changes: [`1.1.37...1.1.38`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.37...1.1.38)
## 1.1.37 (2020-10-26)
#### Fixes
* infra.git: Utilisation de l objet Repo.git
* infra.git: Prise en charge des suppressions de fichiers
* infra.git: Prise en charge des suppressions de fichiers
* infra.git: Prise en charge des suppressions de fichiers
Full set of changes: [`1.1.36...1.1.37`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.36...1.1.37)
## 1.1.36 (2020-10-26)
#### Fixes
* api.validator global catch
* infra.api: There is NO Validator class
* infra.api: Validator is available from infra.api
* api: flake8 ready
Full set of changes: [`1.1.35...1.1.36`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.35...1.1.36)
## 1.1.35 (2020-10-23)
#### New Features
* Added multi_options support to infra.git
Full set of changes: [`1.1.34...1.1.35`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.34...1.1.35)
## 1.1.34 (2020-10-23)
#### New Features
* infra.git: Gestion des dépôts Git
Full set of changes: [`1.1.33...1.1.34`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.33...1.1.34)
## 1.1.33 (2020-10-20)
#### Fixes
* remote.ssh: Secure regexp match + unshadowing dir builtin
Full set of changes: [`1.1.32...1.1.33`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.32...1.1.33)
## 1.1.32 (2020-10-19)
#### Fixes
* Lower remote.ssh default verbosity
#### Others
* SIN-13730 test execution sur le master
Full set of changes: [`1.1.31...1.1.32`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.31...1.1.32)
## 1.1.31 (2020-10-19)
#### Fixes
* Le controle de la conf se fait dans tous les cas
Full set of changes: [`1.1.30...1.1.31`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.30...1.1.31)
## 1.1.30 (2020-10-19)
#### Fixes
* (remote): Ssh exec_command correction bug commande qui ne se termine pas
Full set of changes: [`1.1.29...1.1.30`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.29...1.1.30)
## 1.1.29 (2020-10-16)
#### Fixes
* (remote): Ssh exec_command correction bug commande qui ne se termine pas
Full set of changes: [`1.1.28...1.1.29`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.28...1.1.29)
## 1.1.28 (2020-10-13)
Full set of changes: [`1.1.27...1.1.28`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.27...1.1.28)
## 1.1.27 (2020-10-13)
#### Fixes
* remote.ftp.put_file remove remote_dir first char only if needed
Full set of changes: [`1.1.26...1.1.27`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.26...1.1.27)
## 1.1.26 (2020-10-13)
#### Fixes
* remote.ftp.put_file remove remote_dir first char only if needed
Full set of changes: [`1.1.25...1.1.26`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.25...1.1.26)
## 1.1.25 (2020-10-13)
#### Fixes
* remote.ftp prot_c fallback to prot p
Full set of changes: [`1.1.24...1.1.25`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.24...1.1.25)
## 1.1.24 (2020-10-13)
#### Fixes
* remote.ftp prot_c fallback to prot p
Full set of changes: [`1.1.23...1.1.24`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.23...1.1.24)
## 1.1.23 (2020-10-13)
#### Fixes
* remote.ftp prot_c fallback to prot p
Full set of changes: [`1.1.22...1.1.23`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.22...1.1.23)
## 1.1.22 (2020-10-12)
#### Fixes
* (remote): Ssh exec_command correction bug commande qui ne se termine pas
Full set of changes: [`1.1.21...1.1.22`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.21...1.1.22)
## 1.1.21 (2020-10-06)
#### New Features
* (ssh): exec_command accept maintenant l'ensemble des paramètres de la methode de paramiko
* (ssh): exec_command changement du retour stdin -> exit_code voir readme https://gitlab-infra.ref.gnc/python-infra/python-infra/blob/master/README.md\[#ex](https://gitlab-infra.ref.gnc/python-infra/python-infra/issues/ex)%C3%A9cuter-une-commande-sur-un-h%C3%B4te-distant
Full set of changes: [`1.1.20...1.1.21`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.20...1.1.21)
## 1.1.20 (2020-10-02)
#### New Features
* (remote): remote Ssh ajout de la method sftp_stat
Full set of changes: [`1.1.19...1.1.20`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.19...1.1.20)
## 1.1.19 (2020-10-01)
Full set of changes: [`1.1.18...1.1.19`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.18...1.1.19)
## 1.1.18 (2020-10-01)
#### Fixes
* Check authorized user before using PIDStack
#### Others
* remote/gncftp: clean lint
Full set of changes: [`1.1.17...1.1.18`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.17...1.1.18)
## 1.1.17 (2020-10-01)
Full set of changes: [`1.1.16...1.1.17`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.16...1.1.17)
## 1.1.16 (2020-10-01)
#### New Features
* ajout des 'with' sur les class Ssh, DB, SpamAssassinClient, Ftp, GncFtp
#### Others
* correction gestion des tags
* suppression de la notification des Merge Request [ci-skip]
Full set of changes: [`1.1.15...1.1.16`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.15...1.1.16)
## 1.1.15 (2020-09-21)
Full set of changes: [`1.1.14...1.1.15`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.14...1.1.15)
## 1.1.14 (2020-09-17)
#### Fixes
* _find_remote_files: exit_on_error
#### Others
* Avertissement de non-confidentialité
Full set of changes: [`1.1.13...1.1.14`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.13...1.1.14)
## 1.1.13 (2020-09-16)
Full set of changes: [`1.1.12...1.1.13`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.12...1.1.13)
## 1.1.12 (2020-09-14)
#### Fixes
* (context): correction erreur sur le context en utilisant les 2 options --nolog et --no-log-file
Full set of changes: [`1.1.11...1.1.12`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.11...1.1.12)
## 1.1.11 (2020-08-24)
Full set of changes: [`1.1.10...1.1.11`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.10...1.1.11)
## 1.1.10 (2020-08-24)
Full set of changes: [`1.1.9...1.1.10`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.9...1.1.10)
## 1.1.9 (2020-08-24)
#### Fixes
* security fix + sonar quality fixes
* Jinja2 autoescape == True by default
Full set of changes: [`1.1.8...1.1.9`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.8...1.1.9)
## 1.1.8 (2020-08-24)
#### New Features
* stack_file_path extension
Full set of changes: [`1.1.7...1.1.8`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.7...1.1.8)
## 1.1.7 (2020-08-24)
#### Fixes
* PermissionError handling on lockfile
Full set of changes: [`1.1.6...1.1.7`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.6...1.1.7)
## 1.1.6 (2020-08-21)
#### Refactorings
* Better filelock logging handling
Full set of changes: [`1.1.5...1.1.6`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.5...1.1.6)
## 1.1.5 (2020-08-21)
#### Refactorings
* Better filelock logging handling
Full set of changes: [`1.1.4...1.1.5`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.4...1.1.5)
## 1.1.4 (2020-08-20)
Full set of changes: [`1.1.3...1.1.4`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.3...1.1.4)
## 1.1.3 (2020-08-20)
#### New Features
* max_instance
Full set of changes: [`1.1.2...1.1.3`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.2...1.1.3)
## 1.1.2 (2020-08-17)
Full set of changes: [`1.1.1...1.1.2`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.1.1...1.1.2)
## 1.1.1 (2020-08-17)
#### Refactorings
* api.apiloader
Full set of changes: [`1.0.153...1.1.1`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.153...1.1.1)
## 1.0.153 (2020-08-13)
#### Others
* auto-changlog fix diff url
* upgrade auto-changelog 0.4.0 -> 0.5.1
Full set of changes: [`1.0.152...1.0.153`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.152...1.0.153)
## 1.0.152 (2020-08-10)
Full set of changes: [`1.0.151...1.0.152`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.151...1.0.152)
## 1.0.151 (2020-08-07)
#### Refactorings
* VWMareApi
Full set of changes: [`1.0.150...1.0.151`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.150...1.0.151)
## 1.0.150 (2020-08-03)
#### New Features
* api.Client ajout SSL verify
Full set of changes: [`1.0.149...1.0.150`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.149...1.0.150)
## 1.0.149 (2020-08-03)
#### Fixes
* api.Client response referenced before assignement
Full set of changes: [`1.0.148...1.0.149`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.148...1.0.149)
## 1.0.148 (2020-08-03)
#### Others
* fix project url in setup.cfg
Full set of changes: [`1.0.147...1.0.148`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.147...1.0.148)
## 1.0.147 (2020-08-03)
#### New Features
* infra.api.Client
#### Fixes
* Better README.md
* Typo in README.md
* better doc
* grammar in README.dm
#### Others
* updated module requirements + added requirements.txt
Full set of changes: [`1.0.145...1.0.147`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.145...1.0.147)
## 1.0.145 (2020-07-30)
#### Others
* clean Jenkinsfile
Full set of changes: [`1.0.144...1.0.145`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.144...1.0.145)
## 1.0.144 (2020-07-30)
#### New Features
* notifyMergeRequest
Full set of changes: [`1.0.143...1.0.144`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.143...1.0.144)
## 1.0.143 (2020-07-30)
#### Docs
* Correction de la doc d install
Full set of changes: [`1.0.142...1.0.143`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.142...1.0.143)
## 1.0.142 (2020-07-27)
#### Fixes
* remote.gncftp.close
Full set of changes: [`1.0.141...1.0.142`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.141...1.0.142)
## 1.0.141 (2020-07-27)
#### New Features
* infra.conf.Config.get_section
Full set of changes: [`1.0.140...1.0.141`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.140...1.0.141)
## 1.0.140 (2020-07-16)
#### Fixes
* README.md: Ajoute doc sur nolog
Full set of changes: [`1.0.139...1.0.140`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.139...1.0.140)
## 1.0.139 (2020-07-16)
#### Fixes
* README.md: Ajoute doc sur nolog
Full set of changes: [`1.0.138...1.0.139`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.138...1.0.139)
## 1.0.138 (2020-07-16)
#### Fixes
* infra.db: type == postgres
Full set of changes: [`1.0.137...1.0.138`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.137...1.0.138)
## 1.0.137 (2020-07-08)
Full set of changes: [`1.0.136...1.0.137`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.136...1.0.137)
## 1.0.136 (2020-07-08)
#### Fixes
* python3.4 argparse.ArgumentParser has no allow_abbrev argument
Full set of changes: [`1.0.135...1.0.136`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.135...1.0.136)
## 1.0.135 (2020-06-22)
#### New Features
* infra.remote.Ssh.sftp_list
Full set of changes: [`1.0.134...1.0.135`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.134...1.0.135)
## 1.0.134 (2020-06-22)
#### Fixes
* sftp_delete must open sftp connection first
Full set of changes: [`1.0.133...1.0.134`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.133...1.0.134)
## 1.0.133 (2020-06-22)
#### New Features
* infra.remote.Ssh.sftp_delete
Full set of changes: [`1.0.132...1.0.133`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.132...1.0.133)
## 1.0.132 (2020-06-19)
#### New Features
* Ajout de la classe Db_from_cc
Full set of changes: [`1.0.131...1.0.132`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.131...1.0.132)
## 1.0.131 (2020-06-19)
#### Refactorings
* infra.remote.ssh
Full set of changes: [`1.0.130...1.0.131`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.130...1.0.131)
## 1.0.130 (2020-06-12)
#### Fixes
* Db.execute default params
* Db.execute default params
Full set of changes: [`1.0.129...1.0.130`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.129...1.0.130)
## 1.0.129 (2020-06-12)
#### Fixes
* Db.execute default params
Full set of changes: [`1.0.128...1.0.129`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.128...1.0.129)
## 1.0.128 (2020-06-12)
#### Fixes
* Db.execute default params
Full set of changes: [`1.0.127...1.0.128`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.127...1.0.128)
## 1.0.127 (2020-06-12)
#### Fixes
* Db.execute default params
Full set of changes: [`1.0.126...1.0.127`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.126...1.0.127)
## 1.0.126 (2020-06-12)
#### Fixes
* Db.execute default params
Full set of changes: [`1.0.125...1.0.126`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.125...1.0.126)
## 1.0.125 (2020-06-12)
#### Fixes
* Db.execute default params
Full set of changes: [`1.0.124...1.0.125`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.124...1.0.125)
## 1.0.124 (2020-06-12)
#### Fixes
* Db.execute default params
Full set of changes: [`1.0.123...1.0.124`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.123...1.0.124)
## 1.0.123 (2020-06-12)
#### Fixes
* Db.execute for Oracle
Full set of changes: [`1.0.122...1.0.123`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.122...1.0.123)
## 1.0.122 (2020-06-12)
#### Others
* Updated Readme for Oracle support
Full set of changes: [`1.0.121...1.0.122`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.121...1.0.122)
## 1.0.121 (2020-06-12)
#### Others
* ajustement ordre bump2version tag auto-changelog
Full set of changes: [`1.0.120...1.0.121`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.120...1.0.121)
## 1.0.120 (2020-06-12)
#### Fixes
* Typo in Jenkinsfile
Full set of changes: [`1.0.119...1.0.120`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.119...1.0.120)
## 1.0.119 (2020-06-12)
#### Others
* end of test
Full set of changes: [`1.0.118...1.0.119`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.118...1.0.119)
## 1.0.118 (2020-06-12)
#### Fixes
* default db_type is pgsql
#### Others
* This is a test
Full set of changes: [`1.0.117...1.0.118`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.117...1.0.118)
## 1.0.117 (2020-06-04)
#### Others
* mise en place du changelog auto-généré
Full set of changes: [`1.0.116...1.0.117`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.116...1.0.117)
## 1.0.116 (2020-06-03)
#### Fixes
* (args): pour le type bool correction de la valeur par défaut de la valeur par defaut
Full set of changes: [`1.0.115...1.0.116`](https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/1.0.115...1.0.116)
## 1.0.115 (2020-05-29)
#### New Features
* add bumpversion
#### Fixes
* ajout du push increment version

+ 3
- 3
CONTRIBUTING.md View File

@ -1,8 +1,8 @@
## Environnement de dev
```sh
python3 -m venv socle-infra-venv
source socle-infra-venv/bin/activate
python3 -m venv scrippy-git
source scrippy-git/bin/activate
pip install -e .
```
@ -57,7 +57,7 @@ Les scopes correspondent aux noms des modules jusqu'au deuxième niveau.
**Sans caratères speciaux !**
**exemple :** `infra.remote.ftp`, `infra.remote.ssh`, `infra.remote`, `infra.db`, `infra.mail.mailer`, etc...
**exemple :** `scrippy-remote.remote.ftp`, `scrippy-remote.remote.ssh`, `scrippy-remote.remote`, `scrippy-db.db`, `scrippy-mail.mail.mailer`, etc...
### Breaking change
Pour les breaking changes ajouter `!` avant le `: <description>`


+ 3
- 2
Jenkinsfile View File

@ -39,7 +39,7 @@ pipeline {
withPythonEnv('python3') {
sh "pip install --upgrade pip"
sh "python -m pip install .[dev]"
sh "python3 -m pytest --cov=scrippy_git --junitxml=./junit_report.xml"
}
}
}
@ -71,7 +71,7 @@ pipeline {
withPythonEnv('python3') {
sh "bump2version patch"
String version = getAppVersion()
sh "auto-changelog -v ${version} --issue-url https://gitlab-infra.ref.gnc/python-infra/python-infra/issues/{id} --starting-commit dbd7aa41a423126f5ede4e7c1c8436ca02ce022a -d 'Fichier généré automatiquement par auto-changelog' --diff-url https://gitlab-infra.ref.gnc/python-infra/python-infra/compare/{previous}...{current}"
sh "auto-changelog -v ${version} --issue-url https://gitlab-infra.ref.gnc/scrippy/scrippy-git/issues/{id} --starting-commit 2062da5ba9a4b09f4f4741d0fbe8f8c9e8d002d5 -d 'Fichier généré automatiquement par auto-changelog' --diff-url https://gitlab-infra.ref.gnc/scrippy/scrippy-git/compare/{previous}...{current}"
sh "git add setup.cfg .bumpversion.cfg CHANGELOG.md"
sh "git commit -m 'increment version and update changelog [ci-skip]'"
sh "git tag ${version}"
@ -94,6 +94,7 @@ pipeline {
post {
always {
junit allowEmptyResults: true, testResults: 'junit_report.xml'
commentMergeRequest()
cleanWs()
}


+ 17
- 8
Makefile View File

@ -1,7 +1,7 @@
VERSION=$(shell python3 ./setup.py --version)
.RECIPEPREFIX +=
.PHONY: install uninstall all distclean bumpversion autochangelog tag dist push release
.PHONY: install uninstall all distclean test bumpversion autochangelog tag dist push release
all: | uninstall install distclean
@ -9,10 +9,19 @@ install:
sudo python3 ./setup.py build install
uninstall:
sudo pip3 uninstall -y python-infra
sudo pip3 uninstall -y scrippy-git
distclean:
sudo rm -Rf ./build ./dist ./python_infra.egg-info
sudo rm -Rf ./build \
./dist \
./scrippy_git.egg-info \
./scrippy_git/__pycache__ \
./tests/__pycache__ \
./junit_report.xml \
./.coverage
test:
python3 -m pytest --cov=scrippy_git --junitxml=./junit_report.xml
bumpversion:
bump2version patch
@ -20,10 +29,10 @@ bumpversion:
autochangelog:
VERSION=$(shell python3 ./setup.py --version)
auto-changelog -v "${VERSION}" \
--issue-url https://git.mcos.nc/issues/{id} \
--starting-commit dbd7aa41a423126f5ede4e7c1c8436ca02ce022a \
-d 'Fichier généré automatiquement par auto-changelog' \
--diff-url https://git.mcos.nc/python/infra/src/tag/{current}
--issue-url https://git.mcos.nc/scrippy/scrippy-db/issues/{id} \
--starting-commit 5b816bb55da5dce91734e9341cb14e06afc3a122 \
-d 'Fichier généré automatiquement par auto-changelog' \
--diff-url https://git.mcos.nc/scrippy/scrippy-db/src/tag/{current}
tag:
VERSION=$(shell python3 ./setup.py --version)
@ -38,4 +47,4 @@ push:
git push origin
git push --tags
release: | distclean bumpversion autochangelog tag dist push
release: | distclean test bumpversion autochangelog tag dist push

+ 33
- 1583
README.md
File diff suppressed because it is too large
View File


+ 0
- 18
requirements.txt View File

@ -1,19 +1 @@
GitPython>=2.1.15
psycopg2-binary>=2.8.3
markupsafe>=1.1.1
pycparser>=2.19
paramiko>=2.6.0
argcomplete>=1.10.0
bcrypt>=3.1.7
coloredlogs>=10.0
pytz>=2019.3
pynacl>=1.3.0
cryptography>=2.7
six>=1.12.0
jinja2>=2.10.3
asn1crypto>=1.0.1
prettytable>=0.7.2
cffi>=1.12.3
humanfriendly>=4.18
sqlparse>=0.3.0
filelock>=3.0.12

BIN
scrippy-git.png View File

Before After
Width: 532  |  Height: 334  |  Size: 22 KiB

+ 10
- 0
scrippy_git/__init__.py View File

@ -0,0 +1,10 @@
"""Module client Git."""
class ScrippyGitError(Exception):
"""Classe d'erreur spécifique."""
def __init__(self, message):
"""Initialise l'instance."""
self.message = message
super().__init__(self.message)

git/__init__.py → scrippy_git/git/__init__.py View File

@ -1,7 +1,7 @@
import os
"""Module client Git."""
import git
import sys
import logging
from scrippy_git import ScrippyGitError
class Repo():
@ -36,15 +36,15 @@ class Repo():
self.cloned = git.Repo.clone_from(self.url, path, branch=branch, multi_options=options)
self.origin = self.cloned.remote(name=origin)
except Exception as e:
logging.critical(" '-> Erreur lors du clonage du depot: [{}]: {}".format(e.__class__.__name__, e))
sys.exit(1)
err_msg = "Erreur lors du clonage du depot: [{}]: {}".format(e.__class__.__name__, e)
raise ScrippyGitError(err_msg)
def commit(self, message, error_on_clean_repo=True):
logging.info("[+] Commit: [{}]: {}".format(self.name, message))
if not self.cloned.is_dirty(untracked_files=True):
if error_on_clean_repo:
logging.critical("Impossible de commiter sans modification")
sys.exit(1)
err_msg = "Impossible de commiter sans modification"
raise ScrippyGitError(err_msg)
logging.warning(" '-> Aucune modification a commiter")
return
self.cloned.git.add(".")
@ -64,5 +64,5 @@ class Repo():
self.pull()
self.push()
except Exception as e:
logging.critical(" '-> Erreur lors du commit: [{}]: {}".format(e.__class__.__name__, e))
sys.exit(1)
err_msg = "Erreur lors du commit: [{}]: {}".format(e.__class__.__name__, e)
raise ScrippyGitError(err_msg)

+ 2
- 20
setup.cfg View File

@ -4,9 +4,9 @@ classifiers =
Programming Language :: Python :: 3
License :: WTFPL
Operating System :: POSIX :: Linux
url = https://gitlab-infra.ref.gnc/puppet/python-infra
url = https://gitlab-infra.ref.gnc/scrippy/scrippy_git
description = "Socle de fonctions utilisées dans les scripts python de gestion d'infrastructure."
name = python-infra
name = scrippy_git
long_description = file: README.md
long_description_content_type = text/markdown
author = Michael Costa, Florent Chevalier
@ -16,24 +16,6 @@ author_email = michael.costa@mcos.nc, florent.chevalier@gouv.nc
packages = find:
install_requires =
GitPython>=2.1.15
psycopg2-binary>=2.8.3
markupsafe>=1.1.1
pycparser>=2.19
paramiko>=2.6.0
argcomplete>=1.10.0
bcrypt>=3.1.7
coloredlogs>=10.0
pytz>=2019.3
pynacl>=1.3.0
cryptography>=2.7
six>=1.12.0
jinja2>=2.10.3
asn1crypto>=1.0.1
prettytable>=0.7.2
cffi>=1.12.3
humanfriendly>=4.18
sqlparse>=0.3.0
filelock>=3.0.12
[options.extras_require]
dev =


+ 2
- 2
sonar-project.properties View File

@ -1,5 +1,5 @@
sonar.projectName=python-infra
sonar.gitlab.project_id=puppet/python-infra
sonar.projectName=scrippy_git
sonar.gitlab.project_id=scrippy/scrippy_git
sonar.gitlab.url=https://gitlab-infra.ref.gnc


+ 0
- 0
tests/__init__.py View File


+ 23
- 0
tests/test_git.py View File

@ -0,0 +1,23 @@
"""Test scrippy_git."""
import os
import shutil
from scrippy_git import git
USERNAME = "git"
HOST = "gitlab-infra.ref.gnc"
PORT = 22022
REPONAME = "scrippy/scrippy-git.git"
BRANCH = "master"
def test_git_pull():
"""Test pull and commit."""
repo = git.Repo(USERNAME, HOST, PORT, REPONAME)
local_path = os.path.join("./", REPONAME)
repo.clone(branch=BRANCH, path=local_path)
test_fname = os.path.join(local_path, "dead_parrot.txt")
with open(test_fname, mode="w") as test_file:
test_file.write("Nobody expects the Spanish inquisition !")
commit_message = "Inquisition shall not be expected"
repo.commit(commit_message)
shutil.rmtree(os.path.dirname(local_path))

Loading…
Cancel
Save