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(types): add support for schedules #833

Closed
wants to merge 17 commits into from
Closed

Conversation

jbrockopp
Copy link
Contributor

@jbrockopp jbrockopp commented Apr 28, 2023

xref: go-vela/community#538

Part of go-vela/community#772

This change adds the structs (a.k.a. types) for schedules to Vela.

This adds a new types package to the following packages:

  • github.com/go-vela/server/api - code that would normally be in github.com/go-vela/types/library
  • github.com/go-vela/server/database - code that would normally be in github.com/go-vela/types/database

I'm currently piggy backing off of a previous repo restructure proposal for this.

The end goal is to remove https://github.com/go-vela/types in favor of code within this repo.

NOTE: If folks would like me to open up a new proposal, please let me know and I will do so.

Also, you'll find that this implementation of types for schedules also incorporates this proposal:

go-vela/community#639

@jbrockopp jbrockopp self-assigned this Apr 28, 2023
@jbrockopp jbrockopp added the feature Indicates a new feature label Apr 28, 2023
@codecov
Copy link

codecov bot commented Apr 28, 2023

Codecov Report

Merging #833 (438d286) into main (5a7b9c5) will increase coverage by 0.62%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #833      +/-   ##
==========================================
+ Coverage   57.49%   58.11%   +0.62%     
==========================================
  Files         271      274       +3     
  Lines       15892    16129     +237     
==========================================
+ Hits         9137     9374     +237     
  Misses       6331     6331              
  Partials      424      424              
Impacted Files Coverage Δ
api/types/schedule.go 100.00% <100.00%> (ø)
database/types/sanitize.go 100.00% <100.00%> (ø)
database/types/schedule.go 100.00% <100.00%> (ø)

@jbrockopp jbrockopp marked this pull request as ready for review April 28, 2023 16:08
@jbrockopp jbrockopp requested a review from a team as a code owner April 28, 2023 16:08
Copy link
Contributor

@ecrupper ecrupper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — I like the types move + nested API objects. Step in the right direction for sure.

@ecrupper
Copy link
Contributor

@jbrockopp Out of curiosity, what was the rationale for the switch from robfig/cron to adhocore/gronx?

@jbrockopp
Copy link
Contributor Author

jbrockopp commented May 10, 2023

@jbrockopp Out of curiosity, what was the rationale for the switch from robfig/cron to adhocore/gronx?

@ecrupper Great question and apologies I didn't highlight the reasoning behind that change.

The tl;dr is github.com/robfig/cron doesn't support all the functionality we need for this feature.

We need to be able to capture both the next (upcoming) time to run for an entry as well as the previous time.

There is an open PR to add support for this functionality to that library:

robfig/cron#361

However, it has been > 2 years since that PR was opened and haven't seen much activity on it since.

Also, that library appears to be abandoned since it has been > 2 years since the last commit:

https://github.com/robfig/cron/commits/master

@JordanSussman
Copy link
Collaborator

We need to be able to capture both the next (upcoming) time to run for an entry as well as the previous time.

You can see the code that accomplishes this within https://github.com/go-vela/server/pull/836/files#diff-dfa7912983d4dacc511bc4724e878cf969898ce5db7f21bd1f2918c034d2466aR212-R227.

Copy link
Member

@wass3rw3rk wass3rw3rk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love the schedule stuff that's starting to flow in 😍

i have a bit of a concern with the approach though. it seems we are entering a bit of "frankenstein" territory which is making it harder to keep up with what is in what state.

the feature addition also kicks off two bigger refactors (nested objects and types move which are fine things on their own). however, now we will basically have 3 bigger refactors in some kind of transitional phase (nested objects, types move, plus db/api refactors you've been kindly working through).

personally, it would be more palatable if this happened in the types and server repos as appropriate in the current state and we work through the types move and nested objects stuff separately, but open to other ideas.

any thoughts on that?

@jbrockopp
Copy link
Contributor Author

@wass3rw3rk this is understandable and I'll begin efforts to implement code changes based off current state.

However, since you asked, the reason why I'm trying to bundle multiple changes into one is based off timing.

Historically, the amount of time it takes to get PRs reviewed and merged hasn't been fast.

That's natural with opensource projects, but to your point, the DB refactor would already be done if this cycle was faster.

This is the exact reason why I'm trying to do both API and DB in parallel to improve the rate of change.

@jbrockopp
Copy link
Contributor Author

Closing in favor of go-vela/types#289

@jbrockopp jbrockopp closed this May 15, 2023
@wass3rw3rk
Copy link
Member

@jbrockopp thanks for the understanding and feedback. we are trying to improve that on all fronts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Indicates a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants