diff --git a/README.md b/README.md index 1cab764..c0ab45f 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ INFO Enter the runner token: fe884e8027dc292970d4e0303fe82b14xxxxxxxx INFO Enter the runner name (if set empty, use hostname: Test.local): -INFO Enter the runner labels, leave blank to use the default labels (comma-separated, for example, docker://node:20-bookworm,ubuntu-22.04:docker://node:20-bookworm,ubuntu-20.04:docker://node:20-bullseye,ubuntu-18.04:docker://node:20-buster): +INFO Enter the runner labels, leave blank to use the default labels (comma-separated, for example, ubuntu-latest:docker://gitea/runner-images:ubuntu-latest): -INFO Registering runner, name=Test.local, instance=http://192.168.8.8:3000/, labels=[ubuntu-latest:docker://node:20-bookworm ubuntu-22.04:docker://node:20-bookworm ubuntu-20.04:docker://node:20-bullseye ubuntu-18.04:docker://node:20-buster]. +INFO Registering runner, name=Test.local, instance=http://192.168.8.8:3000/, labels=[ubuntu-latest:docker://gitea/runner-images:ubuntu-latest ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04 ubuntu-20.04:docker://gitea/runner-images:ubuntu-20.04]. DEBU Successfully pinged the Gitea instance server INFO Runner registered successfully. ``` @@ -101,6 +101,8 @@ You can specify the configuration file path with `-c`/`--config` argument. ./act_runner -c config.yaml daemon # run with config file ``` +You can read the latest version of the configuration file online at [config.example.yaml](internal/pkg/config/config.example.yaml). + ### Example Deployments Check out the [examples](examples) directory for sample deployment types. diff --git a/internal/app/cmd/exec.go b/internal/app/cmd/exec.go index d479943..87ce683 100644 --- a/internal/app/cmd/exec.go +++ b/internal/app/cmd/exec.go @@ -484,7 +484,7 @@ func loadExecCmd(ctx context.Context) *cobra.Command { execCmd.PersistentFlags().BoolVarP(&execArg.noSkipCheckout, "no-skip-checkout", "", false, "Do not skip actions/checkout") execCmd.PersistentFlags().BoolVarP(&execArg.debug, "debug", "d", false, "enable debug log") execCmd.PersistentFlags().BoolVarP(&execArg.dryrun, "dryrun", "n", false, "dryrun mode") - execCmd.PersistentFlags().StringVarP(&execArg.image, "image", "i", "node:20-bookworm", "Docker image to use. Use \"-self-hosted\" to run directly on the host.") + execCmd.PersistentFlags().StringVarP(&execArg.image, "image", "i", "gitea/runner-images:ubuntu-latest", "Docker image to use. Use \"-self-hosted\" to run directly on the host.") execCmd.PersistentFlags().StringVarP(&execArg.network, "network", "", "", "Specify the network to which the container will connect") execCmd.PersistentFlags().StringVarP(&execArg.githubInstance, "gitea-instance", "", "", "Gitea instance to use.") diff --git a/internal/app/cmd/register.go b/internal/app/cmd/register.go index 8739aca..9353417 100644 --- a/internal/app/cmd/register.go +++ b/internal/app/cmd/register.go @@ -90,16 +90,10 @@ const ( StageExit ) -/* -ubuntu-18.04 -> bionic -> buster: https://git.launchpad.net/ubuntu/+source/base-files/tree/etc/debian_version?h=ubuntu/bionic -ubuntu-20.04 -> focal -> bullseye: https://git.launchpad.net/ubuntu/+source/base-files/tree/etc/debian_version?h=ubuntu/focal -ubuntu-22.04 -> jammy -> bookworm: https://git.launchpad.net/ubuntu/+source/base-files/tree/etc/debian_version?h=ubuntu/jammy -*/ var defaultLabels = []string{ - "ubuntu-latest:docker://node:20-bookworm", - "ubuntu-22.04:docker://node:20-bookworm", - "ubuntu-20.04:docker://node:20-bullseye", - "ubuntu-18.04:docker://node:20-buster", + "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest", + "ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04", + "ubuntu-20.04:docker://gitea/runner-images:ubuntu-20.04", } type registerInputs struct { @@ -184,7 +178,7 @@ func (r *registerInputs) assignToNext(stage registerStage, value string, cfg *co } if validateLabels(r.Labels) != nil { - log.Infoln("Invalid labels, please input again, leave blank to use the default labels (for example, docker://node:20-bookworm,ubuntu-22.04:docker://node:20-bookworm,ubuntu-20.04:docker://node:20-bullseye,ubuntu-18.04:docker://node:20-buster)") + log.Infoln("Invalid labels, please input again, leave blank to use the default labels (for example, ubuntu-latest:docker://gitea/runner-images:ubuntu-latest)") return StageInputLabels } return StageWaitingForRegistration @@ -248,7 +242,7 @@ func printStageHelp(stage registerStage) { hostname, _ := os.Hostname() log.Infof("Enter the runner name (if set empty, use hostname: %s):\n", hostname) case StageInputLabels: - log.Infoln("Enter the runner labels, leave blank to use the default labels (comma-separated, for example, docker://node:20-bookworm,ubuntu-22.04:docker://node:20-bookworm,ubuntu-20.04:docker://node:20-bullseye,ubuntu-18.04:docker://node:20-buster):") + log.Infoln("Enter the runner labels, leave blank to use the default labels (comma-separated, for example, ubuntu-latest:docker://gitea/runner-images:ubuntu-latest):") case StageWaitingForRegistration: log.Infoln("Waiting for registration...") } diff --git a/internal/pkg/config/config.example.yaml b/internal/pkg/config/config.example.yaml index a962e72..648db96 100644 --- a/internal/pkg/config/config.example.yaml +++ b/internal/pkg/config/config.example.yaml @@ -30,10 +30,14 @@ runner: # The interval for fetching the job from the Gitea instance. 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:20-bookworm", "ubuntu-22.04:docker://node:20-bookworm"] + # Like: "macos-arm64:host" or "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest" + # Find more images provided by Gitea at https://gitea.com/gitea/runner-images . # If it's empty when registering, it will ask for inputting labels. - # If it's empty when execute `deamon`, will use labels in `.runner` file. - labels: [] + # If it's empty when execute `daemon`, will use labels in `.runner` file. + labels: + - "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest" + - "ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04" + - "ubuntu-20.04:docker://gitea/runner-images:ubuntu-20.04" cache: # Enable cache server to use actions/cache. @@ -84,7 +88,7 @@ container: # If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work. docker_host: "" # Pull docker image(s) even if already present - force_pull: false + force_pull: true # Rebuild docker image(s) even if already present force_rebuild: false diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 8a5cade..f4b1078 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -29,7 +29,7 @@ type Runner struct { Insecure bool `yaml:"insecure"` // Insecure indicates whether the runner operates in an insecure mode. FetchTimeout time.Duration `yaml:"fetch_timeout"` // FetchTimeout specifies the timeout duration for fetching resources. FetchInterval time.Duration `yaml:"fetch_interval"` // FetchInterval specifies the interval duration for fetching resources. - Labels []string `yaml:"labels"` // Labels specifies the labels of the runner. Labels are declared on each startup + Labels []string `yaml:"labels"` // Labels specify the labels of the runner. Labels are declared on each startup } // Cache represents the configuration for caching. diff --git a/internal/pkg/labels/labels.go b/internal/pkg/labels/labels.go index fa97ff6..d6de373 100644 --- a/internal/pkg/labels/labels.go +++ b/internal/pkg/labels/labels.go @@ -79,7 +79,7 @@ func (l Labels) PickPlatform(runsOn []string) string { // So the runner receives a task with a label that the runner doesn't have, // it happens when the user have edited the label of the runner in the web UI. // TODO: it may be not correct, what if the runner is used as host mode only? - return "node:20-bookworm" + return "gitea/runner-images:ubuntu-latest" } func (l Labels) Names() []string {