-
-
Notifications
You must be signed in to change notification settings - Fork 722
feat: add config to taskrc.yml #2389
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
Open
vmaerten
wants to merge
19
commits into
main
Choose a base branch
from
feat/add-flags-to-taskrc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b4b084a
wip
vmaerten 95e32d3
wip
vmaerten b63c4d3
wip
vmaerten b903bfb
update schema
vmaerten 0b4060d
update docs
vmaerten 654d258
update docs
vmaerten e23dec8
remove debug
vmaerten d5253e4
add remote flags in cli.md
vmaerten 8ed358d
add gentle force to cli.md
vmaerten 335866d
add task icon
vmaerten 2f693c2
use cpm.Or
vmaerten 313e563
nitpick: field ordering
vmaerten 781944b
Update website/src/docs/reference/config.md
vmaerten 0b0dbff
fix
vmaerten 646c3b1
fix example
vmaerten 1db27d2
remove cli remote
vmaerten 24460b9
remove cli remote
vmaerten 62748f0
move remote config to experiment page
vmaerten 52a6620
move remote config to experiment page
vmaerten 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
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 |
---|---|---|
@@ -1,27 +1,48 @@ | ||
package ast | ||
|
||
import ( | ||
"cmp" | ||
"maps" | ||
"time" | ||
|
||
"github.com/Masterminds/semver/v3" | ||
) | ||
|
||
type TaskRC struct { | ||
Version *semver.Version `yaml:"version"` | ||
Verbose *bool `yaml:"verbose"` | ||
Concurrency *int `yaml:"concurrency"` | ||
Remote Remote `yaml:"remote"` | ||
Experiments map[string]int `yaml:"experiments"` | ||
} | ||
|
||
type Remote struct { | ||
Insecure *bool `yaml:"insecure"` | ||
Offline *bool `yaml:"offline"` | ||
Timeout *time.Duration `yaml:"timeout"` | ||
CacheExpiry *time.Duration `yaml:"cache-expiry"` | ||
} | ||
|
||
// Merge combines the current TaskRC with another TaskRC, prioritizing non-nil fields from the other TaskRC. | ||
func (t *TaskRC) Merge(other *TaskRC) { | ||
if other == nil { | ||
return | ||
} | ||
if t.Version == nil && other.Version != nil { | ||
t.Version = other.Version | ||
} | ||
|
||
t.Version = cmp.Or(other.Version, t.Version) | ||
|
||
if t.Experiments == nil && other.Experiments != nil { | ||
t.Experiments = other.Experiments | ||
} else if t.Experiments != nil && other.Experiments != nil { | ||
maps.Copy(t.Experiments, other.Experiments) | ||
} | ||
|
||
// Merge Remote fields | ||
t.Remote.Insecure = cmp.Or(other.Remote.Insecure, t.Remote.Insecure) | ||
t.Remote.Offline = cmp.Or(other.Remote.Offline, t.Remote.Offline) | ||
t.Remote.Timeout = cmp.Or(other.Remote.Timeout, t.Remote.Timeout) | ||
t.Remote.CacheExpiry = cmp.Or(other.Remote.CacheExpiry, t.Remote.CacheExpiry) | ||
|
||
t.Verbose = cmp.Or(other.Verbose, t.Verbose) | ||
t.Concurrency = cmp.Or(other.Concurrency, t.Concurrency) | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up for debate, but I'm not convinced that these flags should be documented here. I've always seen the experiments as independent from the rest of Task and fully documented within their experiments page. This means that the main docs are stable and not changing all the time.
The intention would then be to move the experiment docs to the appropriate place when released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get your point, but it still feels a bit odd to me that it’s in
reference/config.yml
but not incli.md
.Personally, I think all the flags you see in
task -h
should also show up incli.md
.Remote experiments are used a lot, and it’s not always clear which flags exist or what they actually do just from the experiment page. That’s why I suggested documenting it, but with a note like:
That said, if you both prefer not to include it here, I’m fine with removing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for the config reference, I would include a section for the
experiments:
key, but not include the specific experiments. Just say something along the lines of "please refer to the experiments pages for more details" and then describe the name of the key and values over there.I don't think specific experiments should be described in any pages outside the experiments docs themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean but I've removed all remote and gentle force stuff from CLI.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! Let me know if this is what you had in mind 🙂