-
Notifications
You must be signed in to change notification settings - Fork 0
feat(queueconfig): adding entity and basic interface for queue config #50
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fbba28b
feat(queueconfig): adding entity and basic interface for queue config
kevinlnew bd80298
fix struct name stuttering
kevinlnew d95f7eb
move queueconfig up to entity top-level, remove unncessary tests
kevinlnew 717d87a
changing to VSCType, VSCRepo, Target; added Create to queueconfig sto…
kevinlnew 9069584
rename to VCSAddress to be less 'git'-y
kevinlnew c7cd6b4
removed Create from queueconfig interface
kevinlnew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package entity | ||
|
|
||
| // QueueConfig holds the configuration for a single submit queue. | ||
| // Each queue maps a VCS repository + target to a processing pipeline. | ||
| // A repository can have multiple queues, but each queue has exactly one target. | ||
| // Immutable after creation. | ||
| type QueueConfig struct { | ||
| // Name uniquely identifies this queue within the system. | ||
| // Referenced by Request.Queue. | ||
| Name string | ||
|
|
||
| // VCSType identifies the version control system (e.g., "git", "svn", "perforce"). | ||
| // A queue operates on exactly one VCS. | ||
| VCSType string | ||
|
|
||
| // VCSAddress identifies the repository in the version control system. | ||
| // The format is VCS-specific: | ||
| // - Git: remote URL (e.g., "git@github.com:uber/submitqueue.git") | ||
| // - Perforce: depot path (e.g., "//depot/project") | ||
| // - SVN: repository URL (e.g., "https://svn.example.com/repos/project") | ||
| VCSAddress string | ||
|
|
||
| // Target is the landing target where changes are merged. | ||
| // The format is VCS-specific: | ||
| // - Git: branch ref (e.g., "main", "release/v2") | ||
| // - Perforce: stream or depot path (e.g., "//depot/main/...") | ||
| // - SVN: repository path (e.g., "trunk/") | ||
| Target string | ||
| } | ||
|
|
||
| // NewQueueConfig creates a new QueueConfig with the given parameters. | ||
| func NewQueueConfig( | ||
| name string, | ||
| vcsType string, | ||
| vcsAddress string, | ||
| target string, | ||
| ) QueueConfig { | ||
| return QueueConfig{ | ||
| Name: name, | ||
| VCSType: vcsType, | ||
| VCSAddress: vcsAddress, | ||
| Target: target, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package entity | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestNewQueueConfig(t *testing.T) { | ||
| cfg := NewQueueConfig("uber/submitqueue/main", "git", "git@github.com:uber/submitqueue.git", "main") | ||
|
|
||
| assert.Equal(t, "uber/submitqueue/main", cfg.Name) | ||
| assert.Equal(t, "git", cfg.VCSType) | ||
| assert.Equal(t, "git@github.com:uber/submitqueue.git", cfg.VCSAddress) | ||
| assert.Equal(t, "main", cfg.Target) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "queueconfig", | ||
| srcs = ["queueconfig.go"], | ||
| importpath = "github.com/uber/submitqueue/extension/queueconfig", | ||
| visibility = ["//visibility:public"], | ||
| deps = ["//entity"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Queue Config Extension | ||
|
|
||
| Vendor-agnostic interface for providing queue configurations. | ||
|
|
||
| ## Interfaces | ||
|
|
||
| ### Store | ||
|
|
||
| Provides queue configurations by name. | ||
|
|
||
| ```go | ||
| type Store interface { | ||
| Get(ctx context.Context, name string) (entity.QueueConfig, error) | ||
| List(ctx context.Context) ([]entity.QueueConfig, error) | ||
| } | ||
| ``` | ||
|
|
||
| ## Entities | ||
|
|
||
| Queue configuration entity lives in `entity/queue_config.go`: | ||
|
|
||
| - **QueueConfig** — configuration for a single submit queue (name, VCS type, VCS repo, target) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package queueconfig | ||
|
|
||
| import ( | ||
| "context" | ||
| "errors" | ||
|
|
||
| "github.com/uber/submitqueue/entity" | ||
| ) | ||
|
|
||
| // ErrNotFound is returned when the requested queue configuration does not exist. | ||
| var ErrNotFound = errors.New("queue config not found") | ||
|
|
||
| // Store loads and provides queue configurations. | ||
| // Implementations may read from YAML files, databases, remote services, etc. | ||
| type Store interface { | ||
| // Get returns the configuration for a named queue. | ||
| // Returns ErrNotFound if no configuration exists for the given name. | ||
| Get(ctx context.Context, name string) (entity.QueueConfig, error) | ||
|
|
||
| // List returns all configured queues. | ||
| List(ctx context.Context) ([]entity.QueueConfig, error) | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.