[openSUSE/open-build-service] 27a6ae: Define the new Token::Workflow
Branch: refs/heads/workflow_token Home: https://github.com/openSUSE/open-build-service Commit: 27a6ae0f138202c7ea0338d38363110413604b5b https://github.com/openSUSE/open-build-service/commit/27a6ae0f138202c7ea0338... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token.rb A src/api/app/models/token/workflow.rb A src/api/app/policies/token/workflow_policy.rb M src/api/config/routes/api_routes.rb Log Message: ----------- Define the new Token::Workflow This token will handle the incoming webhooks/events from SCMs like GitHub or GitLab. Co-authored-by: Eduardo Navarro <enavarro@suse.com> Commit: b912bde06e5d4f956464aeaf626764c455b8fb10 https://github.com/openSUSE/open-build-service/commit/b912bde06e5d4f956464ae... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/controllers/trigger_controller.rb A src/api/app/controllers/trigger_workflow_controller.rb M src/api/app/models/token/rebuild.rb M src/api/app/models/token/workflow.rb A src/api/app/services/trigger_controller_service/scm_extractor.rb M src/api/config/routes/api_routes.rb Log Message: ----------- Extract data from a incoming SCM's webhook This kind of webhooks trigger the new Token::Workflow. They come from SCMs like GitHub or GitLab. We extract the data from the payload of the incoming webhook/event, then check that the event and data are valid, and add it to the token as attributes. We create a new controller with the behaviour of the token workflow. Co-authored-by: Daniel Donisa <daniel.donisa@suse.com> Co-authored-by: Eduardo Navarro <enavarro@suse.com> Commit: 754ecd13ba664ea2074695b4871ee60c0ac4a27e https://github.com/openSUSE/open-build-service/commit/754ecd13ba664ea2074695... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: A src/api/app/models/workflow.rb A src/api/app/models/workflow/step/branch_package_step.rb Log Message: ----------- Create wrapper model for SCM workflows Commit: eb35e3ad75bed09c5a02866207764e8880a8ed24 https://github.com/openSUSE/open-build-service/commit/eb35e3ad75bed09c5a0286... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: A src/api/app/services/workflows/yaml_download_service.rb A src/api/app/services/workflows/yaml_to_workflows_service.rb M src/api/config/initializers/zeitwerk.rb Log Message: ----------- Add services to download and parse workflow yaml Commit: 9763c85ed721dc428f32ada9bfd78d1a40c32e9a https://github.com/openSUSE/open-build-service/commit/9763c85ed721dc428f32ad... Author: Dany Marcoux <dmarcoux@posteo.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/controllers/person/token_controller.rb M src/api/spec/controllers/person/token_controller_spec.rb Log Message: ----------- Add support for token.scm_token in POST /person/<login>/token Commit: 9310a5742ab8b6995fadf4c12081781f46139a47 https://github.com/openSUSE/open-build-service/commit/9310a5742ab8b6995fadf4... Author: Dany Marcoux <dmarcoux@posteo.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: A src/api/app/jobs/report_to_scm_job.rb M src/api/app/models/event_subscription.rb M src/api/app/models/token/rebuild.rb M src/api/config/initializers/zeitwerk.rb Log Message: ----------- Create SCMStatusReporter service Commit: 603aa843711a2d6dec3b5150817168135d05eb24 https://github.com/openSUSE/open-build-service/commit/603aa843711a2d6dec3b51... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token/rebuild.rb M src/api/app/models/token/workflow.rb Log Message: ----------- Move code from Token::Rebuild to Token::Workflow Commit: 521e88d52ca6b8e1d0945356400b1639998df8db https://github.com/openSUSE/open-build-service/commit/521e88d52ca6b8e1d09453... Author: Eduardo Navarro <enavarro@suse.com> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token/workflow.rb M src/api/app/services/trigger_controller_service/scm_extractor.rb M src/api/app/services/workflows/yaml_download_service.rb Log Message: ----------- Implement download of the workflows configuration ... ... file, both for GitHub and GitLab. Co-authored-by: Saray Cabrera Padrón <scabrerapadron@suse.de> Commit: f9950c4bced7b2c9752586e24c0328bebd72a7d8 https://github.com/openSUSE/open-build-service/commit/f9950c4bced7b2c9752586... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token/workflow.rb Log Message: ----------- call ScmExtractor with full-path Commit: fe544e33f44eb79baa1d0ce0c7b9ef9798ae07d6 https://github.com/openSUSE/open-build-service/commit/fe544e33f44eb79baa1d0c... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/controllers/trigger_controller.rb Log Message: ----------- Fix missing method Commit: 63ec1cb397fcebc4fe2401a47c9457978a9599d6 https://github.com/openSUSE/open-build-service/commit/63ec1cb397fcebc4fe2401... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/workflow/step/branch_package_step.rb Log Message: ----------- Reduce cognitive complexity of branch method Commit: 900ddcc755f9e38da61aa2bab2d8c2aecfa0ab84 https://github.com/openSUSE/open-build-service/commit/900ddcc755f9e38da61aa2... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token/workflow.rb M src/api/app/policies/token/workflow_policy.rb M src/api/app/services/trigger_controller_service/scm_extractor.rb Log Message: ----------- Fix policy and extractor Also rename `extract` method to `call` and sort the pseudocode on Token#call. Co-authored-by: Eduardo Navarro <enavarro@suse.com> Commit: 1261249b5b9a6061a565df1572186db4256d81d6 https://github.com/openSUSE/open-build-service/commit/1261249b5b9a6061a565df... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/controllers/trigger_workflow_controller.rb Log Message: ----------- Do not use set_package on TriggerWorkflowController Commit: c2432f78405e1587fd2ad621c6aa2c776342c7b3 https://github.com/openSUSE/open-build-service/commit/c2432f78405e1587fd2ad6... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token/workflow.rb Log Message: ----------- WIP: Token Workflow Commit: 472054433790267f16dcb6357a9cf3eb199ce722 https://github.com/openSUSE/open-build-service/commit/472054433790267f16dcb6... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/controllers/trigger_workflow_controller.rb M src/api/app/models/token/workflow.rb M src/api/app/services/trigger_controller_service/scm_extractor.rb Log Message: ----------- Add little improvements - Drop unnecessary curly brackets from method parameters. - Don't assign to variable values that are going to be used only once. - Add .with_indifferent_access to SCMExtractor resulting payload. - Adjust comments. - Rename 'accepted*_event_and_action' to 'allowed*_event_and_action' to be consistent with the constant names (ALLOWED_GITHUB_ACTIONS, ALLOWED_GITLAB_ACTIONS). Commit: 3f5095a337aaa8a524606e969166b56ce9b9ca27 https://github.com/openSUSE/open-build-service/commit/3f5095a337aaa8a524606e... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/services/trigger_controller_service/scm_extractor.rb Log Message: ----------- Fix method name Commit: 306855e11d3c4f4ee17efa5f95ca88e33a567b83 https://github.com/openSUSE/open-build-service/commit/306855e11d3c4f4ee17efa... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: R src/api/app/services/workflows/yaml_download_service.rb A src/api/app/services/workflows/yaml_downloader.rb Log Message: ----------- Rename YAMLDonwloadService Commit: 7927a7dc90a7b638fa93795c4e4f2420029ca5d1 https://github.com/openSUSE/open-build-service/commit/7927a7dc90a7b638fa9379... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/config/initializers/zeitwerk.rb Log Message: ----------- Fix Zeitwerk inflector Commit: ee7675684962e18f81f5e71de115550d9984cfe7 https://github.com/openSUSE/open-build-service/commit/ee7675684962e18f81f5e7... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token/workflow.rb M src/api/app/services/trigger_controller_service/scm_extractor.rb M src/api/app/services/workflows/yaml_downloader.rb Log Message: ----------- Read workflow.yaml from the default branch Commit: d551fd8bfe0f7760f4952f9c23db459cc2fc72b5 https://github.com/openSUSE/open-build-service/commit/d551fd8bfe0f7760f4952f... Author: Eduardo Navarro <enavarro@suse.com> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/services/trigger_controller_service/scm_extractor.rb M src/api/app/services/workflows/yaml_downloader.rb Log Message: ----------- Retrieve the workflows conf file from target branch Co-authored-by: Saray Cabrera Padrón <scabrerapadron@suse.de> Commit: 56f6ced7b930e090fe54f3afe89f87d554cca019 https://github.com/openSUSE/open-build-service/commit/56f6ced7b930e090fe54f3... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/controllers/trigger_controller.rb Log Message: ----------- Skip validate_params for both GitHub and GitLab After more detailed tests, it is clear that the `validate_params` can fail in both GitHub and GitLab webhooks. Each of them can send a non-string value as parameters. For example, GitHub sends an integer value for "number" key (PR number) and GitLab sends a hash representing the project, the user, etc. Commit: 5e806e38386e3db6a5bec2d33791640f7738da83 https://github.com/openSUSE/open-build-service/commit/5e806e38386e3db6a5bec2... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token/workflow.rb Log Message: ----------- Comment line that is still unused and causes linter complains Commit: 876bfce113be2e6954ec9046050e0dbc2029f3a4 https://github.com/openSUSE/open-build-service/commit/876bfce113be2e6954ec90... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/services/trigger_controller_service/scm_extractor.rb Log Message: ----------- Simplify call method to not exceed 25 lines Detected by Code Climate. Commit: beac32fd783254cf10174be59924400f4cba9c2a https://github.com/openSUSE/open-build-service/commit/beac32fd783254cf10174b... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/token/workflow.rb M src/api/app/models/workflow.rb M src/api/app/models/workflow/step/branch_package_step.rb M src/api/app/services/workflows/yaml_to_workflows_service.rb Log Message: ----------- Execute the workflow's steps After downloading the workflow's configuration file we execute the workflow's steps against the configured project and package. Then, validate the steps inside the Step model. Depending on each kind of step, we know which kind of event and actions we expect from the webhooks and what actions we want to perform or ignore (i.e. branch a packae in OBS, just rebuild the package, etc.) That's why we moved the checks about webhook events and actions to the Step class. Co-authored-by: Eduardo Navarro <enavarro@suse.com> Commit: 0217cf9cd6b1ce7dde53299a0168eefbe17b3aa3 https://github.com/openSUSE/open-build-service/commit/0217cf9cd6b1ce7dde5329... Author: Dany Marcoux <dmarcoux@posteo.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M dist/Makefile M dist/obs-server.spec M dist/systemd/obs-api-support.target A dist/systemd/obs-delayedjob-queue-scm.service M src/api/app/jobs/report_to_scm_job.rb M src/api/app/models/event/base.rb M src/api/app/models/event/build_fail.rb M src/api/app/models/event/build_success.rb M src/api/app/models/token/workflow.rb Log Message: ----------- Rely on CreateJob class for ReportToScmJob Co-authored-by: Victor Pereira <vpereira@suse.com> Commit: 8da7a91a0aa68c7675d2b5d89744667caaf823c4 https://github.com/openSUSE/open-build-service/commit/8da7a91a0aa68c7675d2b5... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/spec/models/update_notification_events_spec.rb Log Message: ----------- Fix rspec for update_notification_events Commit: b373773a1c1df541702226cca18f5aea945471df https://github.com/openSUSE/open-build-service/commit/b373773a1c1df541702226... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/services/scm_status_reporter.rb M src/api/app/services/trigger_controller_service/scm_extractor.rb M src/api/app/services/workflows/yaml_downloader.rb Log Message: ----------- Use github repo full_name from webhook payload Instead of manually combining owner and repo name to get the repo full_name, we can simply use the full_name straight from the webhook payload Commit: f0f453015e0130fdf6af13df67b0d500efad7078 https://github.com/openSUSE/open-build-service/commit/f0f453015e0130fdf6af13... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/models/workflow/step/branch_package_step.rb M src/api/app/services/trigger_controller_service/scm_extractor.rb Log Message: ----------- Create _branch_request file We need to create the _branch_request file in the branched package in order to let the obs_scm service point to the revision of the pull_request/merge_request Commit: 6f510cf4c693af288bff90995511959013d25759 https://github.com/openSUSE/open-build-service/commit/6f510cf4c693af288bff90... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-06 (Thu, 06 May 2021) Changed paths: M src/api/app/services/trigger_controller_service/scm_extractor.rb Log Message: ----------- Add github and gitlab event to scm extractor payload hash The event is required in the `Workflow::Step::BranchPackageStep#new_pull_request?` method Compare: https://github.com/openSUSE/open-build-service/compare/a215002e3981...6f510c...
participants (1)
-
Lukas Krause