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 schedules #289

Merged
merged 9 commits into from
May 16, 2023
Merged

feat: add support for schedules #289

merged 9 commits into from
May 16, 2023

Conversation

jbrockopp
Copy link
Contributor

@jbrockopp jbrockopp commented May 11, 2023

xref: go-vela/community#538

Part of go-vela/community#772

This adds a new schedule event type which will be used in go-vela/server.

This also adds some test cases for ruleset in the pipeline and yaml packages.

Additionally, this adds a new Schedule{} type to the github.com/go-vela/types/database package:

// Schedule is the database representation of a schedule for a repo.
type Schedule struct {
ID sql.NullInt64 `sql:"id"`
RepoID sql.NullInt64 `sql:"repo_id"`
Active sql.NullBool `sql:"active"`
Name sql.NullString `sql:"name"`
Entry sql.NullString `sql:"entry"`
CreatedAt sql.NullInt64 `sql:"created_at"`
CreatedBy sql.NullString `sql:"created_by"`
UpdatedAt sql.NullInt64 `sql:"updated_at"`
UpdatedBy sql.NullString `sql:"updated_by"`
ScheduledAt sql.NullInt64 `sql:"scheduled_at"`
}

And adds a new Schedule{} type to the github.com/go-vela/types/library package:

// Schedule is the API representation of a schedule for a repo.
//
// swagger:model Schedule
type Schedule struct {
ID *int64 `json:"id,omitempty"`
RepoID *int64 `json:"repo_id,omitempty"`
Active *bool `json:"active,omitempty"`
Name *string `json:"name,omitempty"`
Entry *string `json:"entry,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty"`
CreatedBy *string `json:"created_by,omitempty"`
UpdatedAt *int64 `json:"updated_at,omitempty"`
UpdatedBy *string `json:"updated_by,omitempty"`
ScheduledAt *int64 `json:"scheduled_at,omitempty"`
}

These will be used in the go-vela/server to create a new schedules table in the database.

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

codecov bot commented May 11, 2023

Codecov Report

Merging #289 (cb989d1) into main (1203118) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #289      +/-   ##
==========================================
+ Coverage   96.90%   97.00%   +0.10%     
==========================================
  Files          57       59       +2     
  Lines        6329     6545     +216     
==========================================
+ Hits         6133     6349     +216     
  Misses        145      145              
  Partials       51       51              
Impacted Files Coverage Δ
pipeline/ruleset.go 100.00% <ø> (ø)
yaml/ruleset.go 100.00% <ø> (ø)
database/schedule.go 100.00% <100.00%> (ø)
library/schedule.go 100.00% <100.00%> (ø)

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.

This meant to still be in draft? LGTM

@jbrockopp jbrockopp marked this pull request as ready for review May 16, 2023 01:49
@jbrockopp jbrockopp requested a review from a team as a code owner May 16, 2023 01:49
@plyr4 plyr4 merged commit f538de0 into main May 16, 2023
@plyr4 plyr4 deleted the feature/schedule branch May 16, 2023 13:17
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.

None yet

4 participants