Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for pipeline plugins #722

Closed
wants to merge 1 commit into from
Closed

Conversation

MoritzWeber0
Copy link
Member

@MoritzWeber0 MoritzWeber0 commented May 26, 2023

Our Systems engineering toolchain team offers several model modifiers and model derivative jobs.

Example for model modifiers are:

  • ID injection bot (inject IDs into model elements)

Example for model derivates:

  • Model complexity badge generation
  • Diagram cache generation
  • Automatic documentation generation

Synchronisation between TeamForCapella and Git is also considered as job, somewhere in between.

Currently, all "jobs" run in the Gitlab CI. There is no UI for the setup of these jobs. Each job repository provides a Gitlab CI templates, which can be easily integrated in project repositories. However, this approach is not intuitive for users / system architects, leading to operational support effort for operation teams, which have to take care of the creation and updates of jobs.

Another disadavantage of the current approach is the Gitlab dependency. Not all environments have a Gitlab instance available. Getting it running on other platforms maintaining templates for different CI/CD platforms is a lot of effort.

This commit adds a plugin/job store to the Capella Colloration Manager. A plugin/job is still developed in a Git repository. Plugins have to define a mbse-works-plugin.yml, providing metadata, input, output, trigger and job information.

With this information, registered plugins can be easily integrated into projects. The integration should be intuitive for project leads.

The steps are:

  • Create a new pipeline
  • Select a supported plugin from the store
  • Configure the plugin: Supported types for the beginning are:
    • git (Select a linked git model from the project, so that the job can access the Git repository information)
    • t4c (Select a linked T4C repository/project from the project). The job gets the connection information + a session token.
    • yml (Most flexible option, the yml configuration file is mounted into the job container, validation via json schema)
    • environment (Key/value pairs, which are used as environment variable for the job)
  • Confirm the creation

As part of this commit, there are only two options:

  • Run the pipeline manually
  • Run it as 3am during the night.

Currently, there is no locking and pipeline/job dependency support. Triggering pipelines via webhooks is planned as this would provide a integration with most Git repository servers.

TODO:

  • Preview pipeline creation, create pipelines properly in the backend.
  • Trigger a pipeline (resolve all required variables and configuration).
  • Create CronJob if cron is used as trigger target.
  • Write a YAML schema for the plugin file.

@MoritzWeber0 MoritzWeber0 force-pushed the pipelines-pagination branch 5 times, most recently from 55f02ec to e234733 Compare June 26, 2023 15:33
Base automatically changed from pipelines-pagination to main June 26, 2023 15:55
@MoritzWeber0 MoritzWeber0 changed the base branch from main to fix-logs-loading July 28, 2023 09:47
@MoritzWeber0 MoritzWeber0 force-pushed the fix-logs-loading branch 3 times, most recently from c1f6680 to a6c075e Compare August 1, 2023 12:35
Base automatically changed from fix-logs-loading to main August 1, 2023 12:41
@MoritzWeber0 MoritzWeber0 force-pushed the plugins-store branch 2 times, most recently from 0e3ccf0 to 7e06bdc Compare October 16, 2023 19:27
@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Attention: 490 lines in your changes are missing coverage. Please review.

Comparison is base (5dbbe56) 72.50% compared to head (873ec8c) 65.73%.

❗ Current head 873ec8c differs from pull request most recent head 576fb32. Consider uploading reports for the commit 576fb32 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #722      +/-   ##
==========================================
- Coverage   72.50%   65.73%   -6.78%     
==========================================
  Files         162      178      +16     
  Lines        5289     5633     +344     
  Branches      592      604      +12     
==========================================
- Hits         3835     3703     -132     
- Misses       1322     1826     +504     
+ Partials      132      104      -28     
Files Coverage Δ
backend/capellacollab/core/database/__init__.py 70.83% <100.00%> (ø)
backend/capellacollab/core/database/models.py 100.00% <100.00%> (ø)
backend/capellacollab/plugins/models.py 100.00% <100.00%> (ø)
backend/capellacollab/routes.py 100.00% <100.00%> (ø)
backend/capellacollab/plugins/injectables.py 62.50% <62.50%> (ø)
...ollab/projects/toolmodels/pipelines/runs/helper.py 0.00% <0.00%> (ø)
...collab/projects/toolmodels/pipelines/validation.py 0.00% <0.00%> (ø)
...ollab/projects/toolmodels/pipelines/injectables.py 0.00% <0.00%> (ø)
backend/capellacollab/plugins/schema.py 0.00% <0.00%> (ø)
...collab/projects/toolmodels/pipelines/exceptions.py 0.00% <0.00%> (ø)
... and 11 more

... and 15 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

backend/capellacollab/plugins/routes.py Dismissed Show dismissed Hide dismissed
@MoritzWeber0 MoritzWeber0 force-pushed the plugins-store branch 6 times, most recently from 9d90888 to e898489 Compare October 20, 2023 18:26
@MoritzWeber0 MoritzWeber0 force-pushed the plugins-store branch 3 times, most recently from ec89338 to 6b7125c Compare November 1, 2023 07:50
The System engineering toolchain team for Digitale Schiene is offering
several model modifiers and model derivative jobs.

Example for model modifiers are:
- ID injection bot (inject IDs into model elements)

Example for model derivates:
- Model complexity badge generation
- Diagram cache generation
- Automatic documentation generation

Synchronisation between TeamForCapella and Git is also considered as job,
somewhere in between.

Currently, all "jobs" are run in the Gitlab CI. There is no UI for the setup of these jobs.
Each job repository provides a Gitlab CI templates, which can be easily integrated in project repositories.
However, this approach is not intuitive for external people, leading to operation support effort for operation teams, which have to take care of the creation and updates of jobs.

Another disadavantage of the current approach is the Gitlab dependency.
Not all environments have a Gitlab instance available. Getting it running on other platforms is even more effort.

This commit adds a plugin/job store to the Capella Colloration Manager.
A plugin/job is still developed in a Git repository. Plugins have to define a
`mbse-works-plugin.yml`, providing metadata, input, output, trigger and job information.

The JSON schema can be fetched via `GET /api/v1.0/plugins-schema` (backend).
A human-readable documentation is available via `/docs/plugin-schema` (backend).

With this information, registered plugins can be easily integrated into projects.
The integration should be intuitive for project leads.

The steps are:
- Create a new pipeline
- Select a supported plugin from the store
- Configure the plugin: Supported types for the beginning are:
    - git (Select a linked git model from the project, so that the job can access the Git repository information)
    - t4c (Select a linked T4C repository/project from the project). The job gets the connection information + a session token.
    - yml (Most flexible option, the yml configuration file is mounted into the job container, validation via yml schema)
    - environment (Key/value pairs, which are used as environment variable for the job)
- Confirm the creation

As part of this commit, there are only two options:
- Run the pipeline manually
- Run it as 3am during the night.

Co-authored-by: ewuerger <[email protected]>
Co-authored-by: Paula-Kli <[email protected]>
Copy link

sonarcloud bot commented Nov 2, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug B 2 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 11 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@MoritzWeber0 MoritzWeber0 changed the title feat: Add support for plugins feat: Add support for pipeline plugins Jul 29, 2024
@MoritzWeber0
Copy link
Member Author

Due to the number of conflicts and the state of the PR, I'll close it. It can still be used as inspiration for future implementations.

@MoritzWeber0 MoritzWeber0 deleted the plugins-store branch September 2, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant