mirror of
https://gitea.com/gitea/act_runner.git
synced 2025-06-15 11:07:13 +02:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
7c71c94366 | |||
49d2cb0cb5 | |||
85626b6bbd | |||
35400f76fa |
@ -72,6 +72,7 @@ builds:
|
|||||||
hooks:
|
hooks:
|
||||||
post:
|
post:
|
||||||
- cmd: tar -cJf {{ .Path }}.xz {{ .Path }}
|
- cmd: tar -cJf {{ .Path }}.xz {{ .Path }}
|
||||||
|
dir: ./dist/
|
||||||
env:
|
env:
|
||||||
- XZ_OPT=-9
|
- XZ_OPT=-9
|
||||||
- cmd: sh .goreleaser.checksum.sh {{ .Path }}
|
- cmd: sh .goreleaser.checksum.sh {{ .Path }}
|
||||||
|
26
README.md
26
README.md
@ -91,5 +91,29 @@ You can specify the configuration file path with `-c`/`--config` argument.
|
|||||||
### Run a docker container
|
### Run a docker container
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -e GITEA_INSTANCE_URL=http://192.168.8.18:3000 -e GITEA_RUNNER_REGISTRATION_TOKEN=<runner_token> -v /var/run/docker.sock:/var/run/docker.sock --name my_runner gitea/act_runner:nightly
|
docker run -e GITEA_INSTANCE_URL=http://192.168.8.18:3000 -e GITEA_RUNNER_REGISTRATION_TOKEN=<runner_token> -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/data:/data --name my_runner gitea/act_runner:nightly
|
||||||
|
```
|
||||||
|
|
||||||
|
The `/data` directory inside the docker container contains the runner API keys after registration.
|
||||||
|
It must be persisted, otherwise the runner would try to register again, using the same, now defunct registration token.
|
||||||
|
|
||||||
|
### Running in docker-compose
|
||||||
|
|
||||||
|
```yml
|
||||||
|
...
|
||||||
|
gitea:
|
||||||
|
image: gitea/gitea
|
||||||
|
...
|
||||||
|
|
||||||
|
runner:
|
||||||
|
image: gitea/act_runner
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
- gitea
|
||||||
|
volumes:
|
||||||
|
- ./data/act_runner:/data
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
environment:
|
||||||
|
- GITEA_INSTANCE_URL=<instance url>
|
||||||
|
- GITEA_RUNNER_REGISTRATION_TOKEN=<registration token>
|
||||||
```
|
```
|
||||||
|
@ -166,9 +166,9 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report.
|
|||||||
}
|
}
|
||||||
|
|
||||||
runnerConfig := &runner.Config{
|
runnerConfig := &runner.Config{
|
||||||
// On Linux, Workdir will be like "/<owner>/<repo>"
|
// On Linux, Workdir will be like "/<parent_directory>/<owner>/<repo>"
|
||||||
// On Windows, Workdir will be like "\<owner>\<repo>"
|
// On Windows, Workdir will be like "\<parent_directory>\<owner>\<repo>"
|
||||||
Workdir: filepath.FromSlash(string(filepath.Separator) + preset.Repository),
|
Workdir: filepath.FromSlash(fmt.Sprintf("/%s/%s", r.cfg.Container.WorkdirParent, preset.Repository)),
|
||||||
BindWorkdir: false,
|
BindWorkdir: false,
|
||||||
|
|
||||||
ReuseContainers: false,
|
ReuseContainers: false,
|
||||||
@ -190,6 +190,7 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report.
|
|||||||
Privileged: r.cfg.Container.Privileged,
|
Privileged: r.cfg.Container.Privileged,
|
||||||
DefaultActionInstance: taskContext["gitea_default_actions_url"].GetStringValue(),
|
DefaultActionInstance: taskContext["gitea_default_actions_url"].GetStringValue(),
|
||||||
PlatformPicker: r.labels.PickPlatform,
|
PlatformPicker: r.labels.PickPlatform,
|
||||||
|
Vars: task.Vars,
|
||||||
}
|
}
|
||||||
|
|
||||||
rr, err := runner.New(runnerConfig)
|
rr, err := runner.New(runnerConfig)
|
||||||
|
@ -48,3 +48,6 @@ container:
|
|||||||
privileged: false
|
privileged: false
|
||||||
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
|
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
|
||||||
options:
|
options:
|
||||||
|
# The parent directory of a job's working directory.
|
||||||
|
# If it's empty, /workspace will be used.
|
||||||
|
workdir_parent:
|
||||||
|
@ -37,6 +37,7 @@ type Config struct {
|
|||||||
NetworkMode string `yaml:"network_mode"`
|
NetworkMode string `yaml:"network_mode"`
|
||||||
Privileged bool `yaml:"privileged"`
|
Privileged bool `yaml:"privileged"`
|
||||||
Options string `yaml:"options"`
|
Options string `yaml:"options"`
|
||||||
|
WorkdirParent string `yaml:"workdir_parent"`
|
||||||
} `yaml:"container"`
|
} `yaml:"container"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +95,9 @@ func LoadDefault(file string) (*Config, error) {
|
|||||||
if cfg.Container.NetworkMode == "" {
|
if cfg.Container.NetworkMode == "" {
|
||||||
cfg.Container.NetworkMode = "bridge"
|
cfg.Container.NetworkMode = "bridge"
|
||||||
}
|
}
|
||||||
|
if cfg.Container.WorkdirParent == "" {
|
||||||
|
cfg.Container.WorkdirParent = "workspace"
|
||||||
|
}
|
||||||
if cfg.Runner.FetchTimeout <= 0 {
|
if cfg.Runner.FetchTimeout <= 0 {
|
||||||
cfg.Runner.FetchTimeout = 5 * time.Second
|
cfg.Runner.FetchTimeout = 5 * time.Second
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user