mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-02-04 04:14:48 +00:00
Compare commits
2 Commits
b1ae30dda8
...
f0b5aff3bb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0b5aff3bb | ||
|
|
44b4736703 |
@@ -281,7 +281,7 @@ func registerNoInteractive(ctx context.Context, configFile string, regArgs *regi
|
|||||||
}
|
}
|
||||||
if err := inputs.validate(); err != nil {
|
if err := inputs.validate(); err != nil {
|
||||||
log.WithError(err).Errorf("Invalid input, please re-run act command.")
|
log.WithError(err).Errorf("Invalid input, please re-run act command.")
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
if err := doRegister(ctx, cfg, inputs); err != nil {
|
if err := doRegister(ctx, cfg, inputs); err != nil {
|
||||||
return fmt.Errorf("Failed to register runner: %w", err)
|
return fmt.Errorf("Failed to register runner: %w", err)
|
||||||
|
|||||||
19
internal/app/cmd/register_test.go
Normal file
19
internal/app/cmd/register_test.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"gotest.tools/v3/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestRegisterNonInteractiveReturnsLabelValidationError(t *testing.T) {
|
||||||
|
err := registerNoInteractive(t.Context(), "", ®isterArgs{
|
||||||
|
Labels: "label:invalid",
|
||||||
|
Token: "token",
|
||||||
|
InstanceAddr: "http://localhost:3000",
|
||||||
|
})
|
||||||
|
assert.Error(t, err, "unsupported schema: invalid")
|
||||||
|
}
|
||||||
@@ -16,6 +16,13 @@ EXTRA_ARGS=""
|
|||||||
if [[ ! -z "${GITEA_RUNNER_LABELS}" ]]; then
|
if [[ ! -z "${GITEA_RUNNER_LABELS}" ]]; then
|
||||||
EXTRA_ARGS="${EXTRA_ARGS} --labels ${GITEA_RUNNER_LABELS}"
|
EXTRA_ARGS="${EXTRA_ARGS} --labels ${GITEA_RUNNER_LABELS}"
|
||||||
fi
|
fi
|
||||||
|
if [[ ! -z "${GITEA_RUNNER_EPHEMERAL}" ]]; then
|
||||||
|
EXTRA_ARGS="${EXTRA_ARGS} --ephemeral"
|
||||||
|
fi
|
||||||
|
RUN_ARGS=""
|
||||||
|
if [[ ! -z "${GITEA_RUNNER_ONCE}" ]]; then
|
||||||
|
RUN_ARGS="${RUN_ARGS} --once"
|
||||||
|
fi
|
||||||
|
|
||||||
# In case no token is set, it's possible to read the token from a file, i.e. a Docker Secret
|
# In case no token is set, it's possible to read the token from a file, i.e. a Docker Secret
|
||||||
if [[ -z "${GITEA_RUNNER_REGISTRATION_TOKEN}" ]] && [[ -f "${GITEA_RUNNER_REGISTRATION_TOKEN_FILE}" ]]; then
|
if [[ -z "${GITEA_RUNNER_REGISTRATION_TOKEN}" ]] && [[ -f "${GITEA_RUNNER_REGISTRATION_TOKEN_FILE}" ]]; then
|
||||||
@@ -54,4 +61,4 @@ fi
|
|||||||
unset GITEA_RUNNER_REGISTRATION_TOKEN
|
unset GITEA_RUNNER_REGISTRATION_TOKEN
|
||||||
unset GITEA_RUNNER_REGISTRATION_TOKEN_FILE
|
unset GITEA_RUNNER_REGISTRATION_TOKEN_FILE
|
||||||
|
|
||||||
exec act_runner daemon ${CONFIG_ARG}
|
exec act_runner daemon ${CONFIG_ARG} ${RUN_ARGS}
|
||||||
|
|||||||
Reference in New Issue
Block a user