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

Refactor: rely on JobSpec as the initial object before moving on to execution #1541

Open
motatoes opened this issue Jun 2, 2024 · 0 comments

Comments

@motatoes
Copy link
Contributor

motatoes commented Jun 2, 2024

Also related to #1540

Currently this is what happens in orchestrator mode:

  • backend receives webhook event
  • backend convert webhook event to jobs
  • backend Convert create jobSpecs from jobs
  • backend creates DiggerJob records from both jobs and jobspecs (database)
  • backend sends jobspec to cli
  • cli unmarshalls jobspec
  • cli converts jobspec to job
  • cli proceeds with execution

And what happens in backendless mode:

  • cli Receive action event
  • convert event payload to jobs
  • execute these jobs

As you can see in both cases we convert the webhook event to jobs. But in the case of orchestrator, the jobs needs to be converted to JobSpec for seraialization and then unserialized and converted to a job again. Why the unnecessary work? If instead we converted every event to a JobSpec we would be able to shorten the branches and make them all very common. This is the proposed refactor:

In orchestrator mode:

  • backend receives webhook event
  • backend converts webhook event to JobSpec
  • backend send jobspec to cli
  • cli unmashals jobspec
  • cli converts jobspec to job for execution

In backendless mode:

  • cli recieves action event
  • cli converts action event to JobSpec
  • cli converts jobspec to job for execution

Indeed it will lead to an additional step in the cli but it also makes the branches between both orchestrator and backendless mode much more common and therefore leads to less code duplication between both modes

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

No branches or pull requests

1 participant