Support changing labels #201
No reviewers
Labels
No Label
kind
bug
kind
build
kind/compatible
kind
dependencies
kind
docs
kind
enhancement
kind
feature
kind
help wanted
kind
proposal
kind
refactor
related
act
related
environment
related
exec
related
gitea
related
workflow
reviewed
confirmed
reviewed
duplicate
reviewed
invalid
reviewed
needs feedback
reviewed
wontfix
reviewed
workaround
No Milestone
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/act_runner#201
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "sillyguodong/act_runner:feature/declare_labels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement proposal: https://github.com/go-gitea/gitea/issues/24540
Related:
Support changing labelsto WIP: Support changing labelssillyguodong referenced this pull request2023-06-05 03:32:21 +00:00
WIP: Support changing labelsto Support changing labelsRelease a new tag for actions-proto-go, please update.
@ -72,2 +78,4 @@
runner := run.NewRunner(cfg, reg, cli)
// declare the labels of the runner before fetching tasks
err = runner.Declare(ctx, ls.Names())
Not correct, should be:
Declare
Declare
returnUNIMPLEMENTED
(see https://grpc.github.io/grpc/core/md_doc_statuscodes.html), show warning logs and fallback to old logic, because the Gitea instance is an old version.Declare
return successfully, check if labels in config file and registration file are equal.SaveRegistration
if necessary, and show info logs.@ -46,6 +46,7 @@ func runRegister(ctx context.Context, regArgs *registerArgs, configFile *string)
log.Warnf("Runner in user-mode.")
}
log.Warnf("configFile: %s", *configFile)
Why
Warn
?@ -39,9 +39,6 @@ func New(endpoint string, insecure bool, uuid, token, version string, opts ...co
if token != "" {
req.Header().Set(TokenHeader, token)
}
if version != "" {
Keep this, be compatibility with older Gitea instances.
@ -28,1 +28,4 @@
fetch_interval: 2s
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
# Please enter sequences (equivalent to lists or arrays).
labels:
Not everyone knows YAML well enough to understand
Please enter sequences (equivalent to lists or arrays).
Maybe:
@ -46,0 +48,4 @@
var overwrite bool
if len(cfg.Runner.Labels) > 0 {
// Determine if the labels in the `.runner` file are the same as the labels in config.
if isEqual := utils.AreStrSlicesElemsEqual(cfg.Runner.Labels, reg.Labels); !isEqual {
Why
AreStrSlicesElemsEqual
?I think it's a good idea to keep exactly the same value in
.runner
and config file, even the order.@ -41,3 +41,4 @@
}
// TODO: version will be removed from request header after Gitea 1.20 released.
if version != "" {
req.Header().Set(VersionHeader, version)
VersionHeader
could be deprecated.@ -28,1 +28,4 @@
fetch_interval: 2s
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
# Like: ["macos-arm64:host", "ubuntu-latest:docker://node:16-bullseye", "ubuntu-22.04:docker://node:16-bullseye"]
# If it's empty when registering, will use default labels.
Incorrect.
@ -0,0 +6,4 @@
import "reflect"
// AreStrSlicesElemsEqual determines whether elements in two slices are equal (ignoring order).
func AreStrSlicesElemsEqual(s1, s2 []string) bool {
Incorrect.
Think about:
Maybe
477a1cc40e/modules/util/slice.go (L39)
But I don't think we really need this here.
Blocked by https://github.com/go-gitea/gitea/pull/24806Stating here for the record:
If act_runner connect to an old version of Gitea instance, the feature would be disabled and warning would be logged, but runner can still run without the error.
https://github.com/go-gitea/gitea/pull/24806 is merged.