[openSUSE/open-build-service] 867326: Define the new Token::Workflow
Branch: refs/heads/workflow_token Home: https://github.com/openSUSE/open-build-service Commit: 86732693109a7e0f7fc0198d3503aee1a2051619 https://github.com/openSUSE/open-build-service/commit/86732693109a7e0f7fc019... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: 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: eb2955e472be130c2ec36352628961a0637fb3d2 https://github.com/openSUSE/open-build-service/commit/eb2955e472be130c2ec363... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-10 (Mon, 10 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/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: 27f5cc09d995cb2b961e5e094dffc961fab49ac6 https://github.com/openSUSE/open-build-service/commit/27f5cc09d995cb2b961e5e... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: A src/api/app/services/workflows/yaml_download_service.rb M 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: f48978546e78e3b3ae497629f15de5d51540e88b https://github.com/openSUSE/open-build-service/commit/f48978546e78e3b3ae4976... Author: Dany Marcoux <dmarcoux@posteo.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: A src/api/app/jobs/report_to_scm_job.rb M src/api/app/models/token/rebuild.rb M src/api/config/initializers/zeitwerk.rb Log Message: ----------- Create SCMStatusReporter service Commit: 51856273e1db353388b7bd6e44d099354ddcde24 https://github.com/openSUSE/open-build-service/commit/51856273e1db353388b7bd... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/app/models/token/rebuild.rb Log Message: ----------- Move code from Token::Rebuild to Token::Workflow Commit: d3e163c0db9da0393cbcb276cf04eb91280980a9 https://github.com/openSUSE/open-build-service/commit/d3e163c0db9da0393cbcb2... Author: Eduardo Navarro <enavarro@suse.com> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: 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: 2941159f5b4e7340a8568bad30b2647ee40420fc https://github.com/openSUSE/open-build-service/commit/2941159f5b4e7340a8568b... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/app/controllers/trigger_controller.rb Log Message: ----------- Fix missing method Commit: d349d0ebf2b43e4a26bd11832a7e64359786861d https://github.com/openSUSE/open-build-service/commit/d349d0ebf2b43e4a26bd11... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: 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: 9004c49787fff1994fb5a675e1ace523e50f4c3c https://github.com/openSUSE/open-build-service/commit/9004c49787fff1994fb5a6... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/app/controllers/trigger_workflow_controller.rb Log Message: ----------- Do not use set_package on TriggerWorkflowController Commit: a0c57fba03405d500522632cd1686cc2d85a677a https://github.com/openSUSE/open-build-service/commit/a0c57fba03405d50052263... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/app/controllers/trigger_workflow_controller.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: 58aad1569a5059f349d814cd70f5c0ff7ebb546c https://github.com/openSUSE/open-build-service/commit/58aad1569a5059f349d814... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/app/services/trigger_controller_service/scm_extractor.rb Log Message: ----------- Fix method name Commit: 6c9c34c03fb5fe7af54843c5935c1740038072cc https://github.com/openSUSE/open-build-service/commit/6c9c34c03fb5fe7af54843... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: R src/api/app/services/workflows/yaml_download_service.rb M src/api/app/services/workflows/yaml_downloader.rb Log Message: ----------- Rename YAMLDownloadService Commit: ee37f589ff8c05ab6784bb6cffdcf22b1e1c1b9c https://github.com/openSUSE/open-build-service/commit/ee37f589ff8c05ab6784bb... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/config/initializers/zeitwerk.rb Log Message: ----------- Fix Zeitwerk inflector Commit: 6f2ddaafac83ad2d84c6ac175442df22d993f9d0 https://github.com/openSUSE/open-build-service/commit/6f2ddaafac83ad2d84c6ac... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-10 (Mon, 10 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: ----------- Read workflow.yaml from the default branch Commit: fab6d6c456290786f567d1f85b9abff3d947f4c9 https://github.com/openSUSE/open-build-service/commit/fab6d6c456290786f567d1... Author: Eduardo Navarro <enavarro@suse.com> Date: 2021-05-10 (Mon, 10 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: 0591d7eb0aef522d2c23c3f13a6b5ed545031389 https://github.com/openSUSE/open-build-service/commit/0591d7eb0aef522d2c23c3... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-10 (Mon, 10 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: 5c95d09b31cad93cf8522a98424f9a3d219cba15 https://github.com/openSUSE/open-build-service/commit/5c95d09b31cad93cf8522a... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-10 (Mon, 10 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: 504e6914a1363ebaa473e03ee3b843be92e3270e https://github.com/openSUSE/open-build-service/commit/504e6914a1363ebaa473e0... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: 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: 676fe6e64a1ce00b445263eff8826bf4d51f1dda https://github.com/openSUSE/open-build-service/commit/676fe6e64a1ce00b445263... Author: Dany Marcoux <dmarcoux@posteo.de> Date: 2021-05-10 (Mon, 10 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 Log Message: ----------- Rely on CreateJob class for ReportToScmJob Co-authored-by: Victor Pereira <vpereira@suse.com> Commit: 678879c4f1fae44f5e4ff690c5e9e9076b3cd1f9 https://github.com/openSUSE/open-build-service/commit/678879c4f1fae44f5e4ff6... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/spec/models/update_notification_events_spec.rb Log Message: ----------- Fix rspec for update_notification_events Commit: 3ac9d4c55e2b81082288df6c7ead26145ab57494 https://github.com/openSUSE/open-build-service/commit/3ac9d4c55e2b81082288df... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-10 (Mon, 10 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: ----------- 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: 20c6acd3da5b18fd9d8576a5026f5ab0c7c3fac3 https://github.com/openSUSE/open-build-service/commit/20c6acd3da5b18fd9d8576... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: 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: 7b934d4efec904aebd4a23602db98b1b081b62fd https://github.com/openSUSE/open-build-service/commit/7b934d4efec904aebd4a23... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-10 (Mon, 10 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 Commit: 23dc62d09e6166a351ab8ca2fcc3b2f13599fbb5 https://github.com/openSUSE/open-build-service/commit/23dc62d09e6166a351ab8c... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/config/initializers/zeitwerk.rb Log Message: ----------- Use ReportToScm instead of ReportToSCMJob Commit: ab1334615f52ce43867fd58d9716a24ddc90e6dd https://github.com/openSUSE/open-build-service/commit/ab1334615f52ce43867fd5... Author: Saray Cabrera Padrón <scabrerapadron@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/app/controllers/trigger_workflow_controller.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: d70c859277a073cdcf3fe18002ab1f5ce2913fb8 https://github.com/openSUSE/open-build-service/commit/d70c859277a073cdcf3fe1... Author: Lukas Krause <lkrause@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: A src/api/app/services/workflows/yaml_download_service.rb M src/api/config/initializers/zeitwerk.rb Log Message: ----------- Add services to download and parse workflow yaml Commit: bff04ce99bedf5eb55e457911eb41a921812cd62 https://github.com/openSUSE/open-build-service/commit/bff04ce99bedf5eb55e457... Author: Dany Marcoux <dmarcoux@posteo.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/app/models/token/rebuild.rb M src/api/config/initializers/zeitwerk.rb Log Message: ----------- Create SCMStatusReporter service Commit: d71812f108446efc98e535c74de8798b711adb9b https://github.com/openSUSE/open-build-service/commit/d71812f108446efc98e535... Author: Victor Pereira <vpereira@suse.de> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: M src/api/app/models/token/rebuild.rb Log Message: ----------- Move code from Token::Rebuild to Token::Workflow Commit: a2072d98811c193a938ead004f68d43e735707b2 https://github.com/openSUSE/open-build-service/commit/a2072d98811c193a938ead... Author: Eduardo Navarro <enavarro@suse.com> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: 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: 97576cdea7405595cc892fd4acdc43523af3fcee https://github.com/openSUSE/open-build-service/commit/97576cdea7405595cc892f... Author: Dani Donisa <dani.doni@gmail.com> Date: 2021-05-10 (Mon, 10 May 2021) Changed paths: R src/api/app/services/workflows/yaml_download_service.rb Log Message: ----------- Rename YAMLDonwloadService Compare: https://github.com/openSUSE/open-build-service/compare/82c7006d53e6...97576c...
participants (1)
-
Dani Donisa