diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bcc9ee0..02aef8e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,4 +106,4 @@ jobs: TRELLO_API_KEY: ${{ secrets.TRELLO_API_KEY }} TRELLO_API_TOKEN: ${{ secrets.TRELLO_API_TOKEN }} needs: unittest - if: ${{ github.event_name }} == "push" \ No newline at end of file + if: ${{ github.event_name }} == "push" diff --git a/README.md b/README.md index bc22d4e..18c5859 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,3 @@ Unit Tests sind in der Datei `src/test_main.py` definiert. Zusätzlich sind für Für CI/CD wird hauptsächlich das Auto DevOps System von GitLab verwendet. Zusätzlich findet sich die gesamte Integration mit Trello im `pipeline/` Verzeichnis. Dazu existiert auch eine weitere [README](./pipeline/README.md). -## Prozesses - -Diese finden sich im `bpmn/` Verzeichnis. diff --git a/bpmn/UML class.png b/bpmn/UML class.png deleted file mode 100644 index d31d809..0000000 Binary files a/bpmn/UML class.png and /dev/null differ diff --git a/bpmn/feature_branch_process.bpmn b/bpmn/feature_branch_process.bpmn deleted file mode 100644 index 5fb7a7b..0000000 --- a/bpmn/feature_branch_process.bpmn +++ /dev/null @@ -1,483 +0,0 @@ - - - - - - - - - - - - - - - - - - Flow_0gs01gt - Flow_12zfzy9 - - - DataStoreReference_02nr1co - Property_06kf6q9 - - - DataStoreReference_133aini - - - - Flow_1uixcbx - Flow_1ocumnl - - - DataStoreReference_02nr1co - Property_1iwlle8 - - - DataStoreReference_133aini - - - - Flow_0s4bycn - Flow_0qk6hj2 - - - DataStoreReference_02nr1co - Property_0ys364u - - - DataStoreReference_133aini - - - - Flow_1ocumnl - Flow_12zfzy9 - Flow_0qk6hj2 - Flow_1xp6i4a - - - Flow_1mjqdrk - - DataStoreReference_06o1aal - - - - Flow_1mjqdrk - Flow_16tfmpd - - - Flow_16tfmpd - Flow_1g3sj6w - - - DataStoreReference_06o1aal - Property_18ayddm - - - DataStoreReference_02nr1co - - - - Flow_1g3sj6w - Flow_1uixcbx - Flow_0gs01gt - Flow_0s4bycn - - - - - Flow_1xp6i4a - - - DataStoreReference_133aini - Property_0re1s5n - - - - - - - - - - - - - - - - - - Activity_0rjxixb - Gateway_0im6pkt - Event_0a8dawd - Event_0a4sxja - Activity_0nbyr3u - Activity_078f0bp - - - StartEvent_09zsngm - Activity_19698y7 - Activity_0idryvk - Activity_0hyggaq - Event_0wxq9h6 - - - - Flow_1338e6n - - - Flow_1338e6n - Flow_0pa5a6n - - - Flow_0pa5a6n - - - Flow_15iyvxv - - - Flow_01p22km - Flow_1pivuh4 - Flow_1qxgue8 - - - Flow_0xq0b2s - Flow_1imykly - - - Flow_1imykly - - - Flow_1yi4jkr - - - Flow_1qxgue8 - - - Flow_15iyvxv - Flow_01p22km - - - Flow_1pivuh4 - Flow_0xq0b2s - Flow_1yi4jkr - - - - - - - - - - - - - - - - DataStoreReference_02nr1co - Property_0x4dqy3 - - - - Flow_0cpp6xo - - - Flow_0cpp6xo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/feature_branch_process.svg b/bpmn/feature_branch_process.svg deleted file mode 100644 index 075e571..0000000 --- a/bpmn/feature_branch_process.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - -GitlabÜberprüfung der Code QualitätUnit TestsSASTAnnahme Commit auf Feature BranchStart der CI/CD PipelineBauen der ApplikationUpload aller Ergebnisse undAufbau der Review UngebungSoftware EntwicklungQ&AEntwicklerSchreiben des QuelltextesCommit auf Feature BranchManuelles Testen der AppMerge durchführenEintragen des Ergebnis in die PipelineMerge Request akzeptierenServerErzeugung einer Review Instanz der AppLöschen der Review InstanzPM SystemDocker RegistryStartQuelltext RepositoryTesten erfolgreich?NeinArtifact RegistryJa \ No newline at end of file diff --git a/bpmn/idee_e-business.pdf b/bpmn/idee_e-business.pdf deleted file mode 100644 index 6d24886..0000000 Binary files a/bpmn/idee_e-business.pdf and /dev/null differ diff --git a/bpmn/main_branch_process.bpmn b/bpmn/main_branch_process.bpmn deleted file mode 100644 index e860765..0000000 --- a/bpmn/main_branch_process.bpmn +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - - Flow_0kjv2tl - - - DataStoreReference_16hjkyg - Property_13sdap6 - - - - Flow_0kjv2tl - - - - - - Flow_1yc1ond - - - - Flow_1916w3r - - - Flow_1yc1ond - Flow_1k3sd4r - - - Flow_0pjuut5 - Flow_1topjdx - - - Flow_0wc92ou - Flow_1916w3r - - - Flow_0sfbzy1 - - - Flow_0kax3e3 - - - DataStoreReference_0siujtf - Property_0s6vc8p - - - - Flow_0kax3e3 - Flow_0pjuut5 - Flow_0wc92ou - - - - Flow_1topjdx - - - Flow_1k3sd4r - Flow_0sfbzy1 - - DataStoreReference_16hjkyg - - - DataStoreReference_0siujtf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/main_branch_process.svg b/bpmn/main_branch_process.svg deleted file mode 100644 index 38771c5..0000000 --- a/bpmn/main_branch_process.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - -PM SoftwareServerDeployment im Production SystemGitLabStart der CI/CD PipelineAktualisierung des PM TasksSenden der ErfolgsmeldungStarten des Deployment ProzessesAufbereiten derInformationen für das PM SystemAusführung der Integrations-testsCode MergeDocker RegistryDeployment abgeschlossenArtifact Registry \ No newline at end of file diff --git a/pipeline/GitCommit.py b/pipeline/GitCommit.py index 6dae50e..6e944f1 100644 --- a/pipeline/GitCommit.py +++ b/pipeline/GitCommit.py @@ -7,7 +7,21 @@ class GitCommit: ''' - Hier muss noch eine Beschreibung rein. + Diese Klasse beinhaltet die nötigen Informationen eines Git Commits, + der für Workflow-Systeme eingesetzt wird. Diese Klasse ist nicht + Quellsystem-spezifisch und wird als Elternklasse für die spezifischen + Klassen von Gitlab und Github eingesetzt. + + Parameters: + branch_name (str): Name des Git Branches des Commits + commit_hash(str): Hashwert des Commits + commit_message(str): Nachricht des Commits + image_name(str): Name des Docker-Images, das aus dem Commit erzeugt wird + project_url(str): URL zu dem konkreten Projekt bei GitHub/Lab + pipeline_id(str): ID der aktuellen CI/CD Pipeline + pipeline_link_url(str): Link zur Pipeline bei GitHub/Lab + commit_link_url(str): Link zum Commit bei GitHub/Lab + test_report_link_url(str): Link zum Unittest Report bei GitHub/Lab ''' def __init__(self, branch_name, commit_hash, commit_message, image_name, project_url, pipeline_id, pipeline_link_url, @@ -29,10 +43,9 @@ def check_source_system(): ''' if os.environ.get('GITHUB_ACTIONS') in ['true', True]: return 'Github' - elif os.environ.get('GITLAB_CI') in ['true', True]: + if os.environ.get('GITLAB_CI') in ['true', True]: return 'Gitlab' - else: - raise GitException('Source system not recognized.') + raise GitException('Source system not recognized.') def get_branch_name(self): ''' diff --git a/pipeline/GitHubCommit.py b/pipeline/GitHubCommit.py index e7ab1d8..6d2f5e4 100644 --- a/pipeline/GitHubCommit.py +++ b/pipeline/GitHubCommit.py @@ -8,8 +8,11 @@ class GitHubCommit(GitCommit): ''' Die Klasse beinhaltet die relevanten Informationen eines jeden Git Commits. + Der Konstruktor bezieht alle Informationen dafür spezifisch von GitHub Actions. Diese werden aus den Umgebungsvariablen extrahiert und dem Verwender zur Verfügung gestellt. + Die Umgebungsvariablen werden entweder von GitHub an sich gestellt oder + werden in der CI-YAML Datei definiert. ''' def __init__(self): github_commit_message = os.environ.get('GH_COMMIT_MESSAGE') diff --git a/pipeline/GitLabCommit.py b/pipeline/GitLabCommit.py index ecf7dda..c0292bc 100644 --- a/pipeline/GitLabCommit.py +++ b/pipeline/GitLabCommit.py @@ -9,6 +9,7 @@ class GitLabCommit(GitCommit): ''' Die Klasse extrahiert alle Infomationen aus GitLab und erzeugt einen GitCommit. + Der Konstruktor bezieht alle Informationen dafür spezifisch von GitLab Runnern. Diese werden aus den Umgebungsvariablen extrahiert und dem Verwender zur Verfügung gestellt. ''' diff --git a/pipeline/README.md b/pipeline/README.md index 7dc9fdf..d11b7ed 100644 --- a/pipeline/README.md +++ b/pipeline/README.md @@ -5,7 +5,7 @@ 1. Ein Trello Board muss erstellt sein. Die ID davon muss bekannt sein. Diese wird in den GitLab CI/CD Variablen eingetragen (Name: `TRELLO_BOARD_ID`). 2. Ein PowerUp muss in Trello erstellt werden und mit dem Board verbunden werden. Der angezeigt API Key wird in die CI/CD Variablen in GitLab eingetragen (Name: `TRELLO_API_KEY`). 3. Der User muss einen API Token erstellen und in die CI/CD Variablen in GitLab eintragen (Name: `TRELLO_API_TOKEN`) -4. Das Board muss mindestens die folgenden Spalten in der exakt gleichen Benamung haben: `In Development`, `In Review`, `Ready to Deploy`, `Deployed`. Es muss ein Label mit dem Namen `gitlab` existieren. +4. Das Board muss mindestens die folgenden Spalten in der exakt gleichen Benamung haben: `In Development`, `In Review`, `Ready to Deploy`, `Deployed`. Es muss ein Label mit dem Namen `git` existieren. 5. Es kann nun eine Karte erstellt werden. Der Titel muss den Namen den zukünftigen Feature Branches beinhalten. Die Karte muss mit den Label "gitlab" versehen werden. Der Name des Feature Branches darf nur einmalig in dem Board vorkommen. Bei Duplikaten bricht das Programm ab. ## Schritte innerhalb der Feature Branch Pipelines @@ -74,12 +74,6 @@ Die Klasse benötigt die folgenden (Umgebungs-)Variablen zur Initialisierung: | board_id | ID des Trello Boards | `TRELLO_BOARD_ID` | | api_key | API Key des Trello PowerUps | `TRELLO_API_KEY` | | api_token | API Token des Trello Nutzers | `TRELLO_API_TOKEN` | -| gitlab_branch_name | Aktueller Branch im Git Repository | `CI_COMMIT_REF_NAME` | -| gitlab_commit_hash | (langer) Commit Hash im Git Repository | `CI_COMMIT_SHA` | -| gitlab_commit_message | Nachricht innerhalb des Commits | `CI_COMMIT_MESSAGE` | -| gitlab_pipeline_id | ID der Pipeline in GitLab | `CI_PIPELINE_ID` | -| gitlab_project_url | URL zum Repository in GitLab | `CI_PROJECT_URL` | -| gitlab_image_name | Name des Docker Images in der GitLab Registry | `CI_REGISTRY_IMAGE` | Die folgenden Befehle werden zur Ausführung verwendet: * Vor der Feature Branch Pipeline @@ -112,7 +106,3 @@ python3 pipeline.py --step post_production Die eigentlichen Jobs in der Pipeline sind als Templates in der `trello-ci.yaml` Datei hinterlegt. -## TODOs -- Image Name implementieren -- Prod Pipeline testen -- Anhänge implementieren diff --git a/pipeline/pipeline.py b/pipeline/pipeline.py index 703fc6c..f6a40bd 100644 --- a/pipeline/pipeline.py +++ b/pipeline/pipeline.py @@ -3,6 +3,7 @@ ''' import os import argparse +from sys import exit from TrelloTask import TrelloTask from TrelloException import TrelloException from GitCommit import GitCommit @@ -31,21 +32,29 @@ git_commit = GitLabCommit() if source_system == 'Gitlab' else git_commit trello = TrelloTask(git_commit) +# Vor der Ausführung der Production Pipeline if args.step == allowed_step_strings[0]: - # Vor der Ausführung der Production Pipeline trello.pre_production_pipeline() -elif args.step == allowed_step_strings[1]: - # Nach der Ausführung der Production Pipeline + exit(0) + +# Nach der Ausführung der Production Pipeline +if args.step == allowed_step_strings[1]: IS_PIPELINE_FAILED = os.environ.get('PIPELINE_FAILED') == 'true' trello.post_production_pipeline(IS_PIPELINE_FAILED) -elif args.step == allowed_step_strings[2]: - # Vor der Ausführung der Feature Branch Pipeline + exit(0) + +# Vor der Ausführung der Feature Branch Pipeline +if args.step == allowed_step_strings[2]: trello.pre_feature_branch_pipeline() -elif args.step == allowed_step_strings[3]: - # Während der Ausführung der Feature Branch Pipeline + exit(0) + +# Während der Ausführung der Feature Branch Pipeline +if args.step == allowed_step_strings[3]: trello.intra_feature_branch_pipeline() -elif args.step == allowed_step_strings[4]: - # Nach der Ausführung der Feature Branch Pipeline + exit(0) + +# Nach der Ausführung der Feature Branch Pipeline +if args.step == allowed_step_strings[4]: IS_PIPELINE_FAILED = os.environ.get('PIPELINE_FAILED') == 'true' if os.environ.get('REVIEW_ACCEPTED') is not None \ and os.environ.get('REVIEW_ACCEPTED').lower() in ['yes', 'true']: @@ -53,3 +62,4 @@ else: IS_REVIEW_FAILED = True trello.post_feature_branch_pipeline(IS_REVIEW_FAILED, IS_PIPELINE_FAILED) + exit(0)