Use node 20 by default (#526)

Because Octokit requires Node 18 or higher now.

See https://github.com/octokit/octokit.js/#fetch-missing .

However, for existing runners, users should manually modify `labels` in the `.runner` file or `runner.labels` in the `config.yaml` file to update. Don't forget to restart.

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/526
Reviewed-by: sillyguodong <sillyguodong@noreply.gitea.com>
This commit is contained in:
Jason Song
2024-03-29 03:03:26 +00:00
parent 1760899d27
commit 94c45acf6b
5 changed files with 16 additions and 12 deletions

View File

@ -90,11 +90,16 @@ 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:16-bullseye",
"ubuntu-22.04:docker://node:16-bullseye", // There's no node:16-bookworm yet
"ubuntu-20.04:docker://node:16-bullseye",
"ubuntu-18.04:docker://node:16-buster",
"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",
}
type registerInputs struct {
@ -179,7 +184,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, ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster,linux_arm:host)")
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)")
return StageInputLabels
}
return StageWaitingForRegistration
@ -243,7 +248,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, ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster,linux_arm:host):")
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):")
case StageWaitingForRegistration:
log.Infoln("Waiting for registration...")
}