mirror of
https://gitea.com/gitea/act_runner
synced 2026-11-21 10:27:46 +01:00
Add `runner.client_cert_file` and `runner.client_key_file` for Gitea instances that require mutual TLS. The runner presents the certificate on its RPCs, job summary uploads, and the action, reusable workflow and `builtin:checkout` clones from the instance. The files are read on use, so renewed certificates apply without a restart. Job steps do not get them. An incomplete or mismatched pair fails startup. Clones now decide the token, client certificate and `runner.insecure` with one host check, which also gives reusable workflow clones the TLS settings they lacked. `runner.insecure` still only covers the registered address. Fixes: https://gitea.com/gitea/runner/issues/321 Co-authored-by: silverwind <2021+silverwind@noreply.gitea.com> Co-authored-by: silverwind <me@silverwind.io> Reviewed-on: https://gitea.com/gitea/runner/pulls/1273 Reviewed-by: silverwind <2021+silverwind@noreply.gitea.com> Co-authored-by: bircni <bircni@icloud.com>
74 lines
2.2 KiB
Go
74 lines
2.2 KiB
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package runner
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.com/gitea/runner/act/common"
|
|
"gitea.com/gitea/runner/internal/pkg/action"
|
|
"gitea.com/gitea/runner/internal/pkg/action/checkout"
|
|
|
|
"gitea.dev/actionslib/pkg/model"
|
|
)
|
|
|
|
var builtinActions = map[string]func(context.Context, *action.Context) error{
|
|
"checkout": checkout.Main,
|
|
}
|
|
|
|
type stepActionBuiltin struct {
|
|
Step *model.Step
|
|
RunContext *RunContext
|
|
run func(context.Context, *action.Context) error
|
|
env map[string]string
|
|
}
|
|
|
|
func (sab *stepActionBuiltin) pre() common.Executor { return common.NewPipelineExecutor() }
|
|
|
|
func (sab *stepActionBuiltin) main() common.Executor {
|
|
sab.env = map[string]string{}
|
|
return runStepExecutor(sab, stepStageMain, func(ctx context.Context) error {
|
|
if common.Dryrun(ctx) {
|
|
return nil
|
|
}
|
|
|
|
printRunActionHeader(ctx, sab.Step, sab.env, sab.RunContext)
|
|
rawLogger := common.Logger(ctx).WithField(rawOutputField, true)
|
|
defer rawLogger.Infof("::endgroup::")
|
|
|
|
rc := sab.RunContext
|
|
rc.ApplyExtraPath(ctx, &sab.env)
|
|
return sab.run(ctx, &action.Context{
|
|
Container: rc.JobContainer,
|
|
Github: rc.getGithubContext(ctx),
|
|
Inputs: sab.Step.With,
|
|
HostWorkdir: rc.Config.Workdir,
|
|
Workspace: rc.JobContainer.ToContainerPath(rc.Config.Workdir),
|
|
BindWorkdir: rc.Config.BindWorkdir,
|
|
NoSkipCheckout: rc.Config.NoSkipCheckout,
|
|
UseGitIgnore: rc.Config.UseGitIgnore,
|
|
InsecureSkipTLS: rc.Config.InsecureSkipTLS,
|
|
ClientCertFile: rc.Config.ClientCertFile,
|
|
ClientKeyFile: rc.Config.ClientKeyFile,
|
|
Env: sab.env,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (sab *stepActionBuiltin) post() common.Executor { return common.NewPipelineExecutor() }
|
|
|
|
func (sab *stepActionBuiltin) getRunContext() *RunContext { return sab.RunContext }
|
|
|
|
func (sab *stepActionBuiltin) getGithubContext(ctx context.Context) *model.GithubContext {
|
|
return sab.RunContext.getGithubContext(ctx)
|
|
}
|
|
|
|
func (sab *stepActionBuiltin) getStepModel() *model.Step { return sab.Step }
|
|
|
|
func (sab *stepActionBuiltin) getEnv() *map[string]string { return &sab.env }
|
|
|
|
func (sab *stepActionBuiltin) getIfExpression(_ context.Context, _ stepStage) string {
|
|
return sab.Step.If.Value
|
|
}
|