1
0
mirror of https://gitea.com/gitea/act_runner synced 2024-11-09 18:05:52 +01:00

fix: update container config

This commit is contained in:
Jason Song 2022-11-24 14:47:51 +08:00
parent 2354f5bb18
commit b3e7d6a62d
3 changed files with 10 additions and 5 deletions

2
go.mod

@ -77,4 +77,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace github.com/nektos/act => gitea.com/gitea/act v0.233.4
replace github.com/nektos/act => gitea.com/gitea/act v0.233.5

4
go.sum

@ -25,8 +25,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
code.gitea.io/bots-proto-go v0.1.0 h1:H+01Pcb7j6+l3TDj/0YFOJvPYbcKkzSBXg1qoGz/qc8=
code.gitea.io/bots-proto-go v0.1.0/go.mod h1:tZCdF4XQ1216T+JUHw2A091PA/QP3HLx7IXPv1l3v5c=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gitea.com/gitea/act v0.233.4 h1:ItqivoomnfTTeXZ/hqlSQFlgA0TBv40U3dbg0gYUYKk=
gitea.com/gitea/act v0.233.4/go.mod h1:QpHTbzW4rX/jfN9qnfPdPC5Us0JZPxfPeEaAv18VVrQ=
gitea.com/gitea/act v0.233.5 h1:XXJwuWC+J9XkWokCRg1s16Oc46aZ6gQ27MNd2C/RqHY=
gitea.com/gitea/act v0.233.5/go.mod h1:QpHTbzW4rX/jfN9qnfPdPC5Us0JZPxfPeEaAv18VVrQ=
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=

@ -191,6 +191,11 @@ func (t *Task) Run(ctx context.Context, task *runnerv1.Task) error {
return err
}
maxLifetime := 3 * time.Hour
if deadline, ok := ctx.Deadline(); ok {
maxLifetime = time.Until(deadline)
}
input := t.Input
config := &runner.Config{
Workdir: "/" + preset.Repository,
@ -217,8 +222,8 @@ func (t *Task) Run(ctx context.Context, task *runnerv1.Task) error {
NoSkipCheckout: true,
PresetGitHubContext: preset,
EventJSON: string(eventJSON),
ContainerNamePrefix: fmt.Sprintf("gitea-task-%d", task.Id),
ContainerMaxLifetime: 3 * time.Hour, // maybe should be specified by Gitea server
ContainerNamePrefix: fmt.Sprintf("GITEA-BOTS-TASK-%d", task.Id),
ContainerMaxLifetime: maxLifetime,
ContainerNetworkMode: input.containerNetworkMode,
DefaultActionInstance: dataContext["gitea_default_bots_url"].GetStringValue(),
PlatformPicker: t.platformPicker,