diff --git a/docs/automate.md b/docs/automate.md index c0255e986..adac2151a 100644 --- a/docs/automate.md +++ b/docs/automate.md @@ -26,6 +26,23 @@ Run as a one-liner. NOTE: replace with yourorg/yourrepo (repo level) or just you curl -s https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh | bash -s yourorg/yourrepo ``` +You can call the script with additional arguments: +```bash +# Usage: +# export RUNNER_CFG_PAT= +# ./create-latest-svc -s scope -g [ghe_domain] -n [name] -u [user] -l [labels] +# -s required scope: repo (:owner/:repo) or org (:organization) +# -g optional ghe_hostname: the fully qualified domain name of your GitHub Enterprise Server deployment +# -n optional name of the runner, defaults to hostname +# -u optional user svc will run as, defaults to current +# -l optional list of labels (split by comma) applied on the runner" +``` + +Use `--` to pass any number of optional named parameters: + +``` +curl -s https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh | bash -s -- -s myorg/myrepo -n myname -l label1,label2 +``` ### Why can't I use a container? The runner is installed as a service using `systemd` and `systemctl`. Docker does not support `systemd` for service configuration on a container. diff --git a/releaseNote.md b/releaseNote.md index d5d043a1f..3f5f5f9ea 100644 --- a/releaseNote.md +++ b/releaseNote.md @@ -2,13 +2,11 @@ ## Bugs -- Fixed a bug where composite actions did not respect `continue-on-error` (#1238) -- Fixed a bug where composite actions post steps did not have the correct step context (#1243) - +- Send Path when resolving actions so we can correctly validate Policy for Composite Actions (#1250) ## Misc -- Correctly finish Job when worker crashes with IO Exceptions (#1239) +- Allows flags instead of parameters when configuring the runner (#1220) ## Windows x64 We recommend configuring the runner in a root folder of the Windows drive (e.g. "C:\actions-runner"). This will help avoid issues related to service identity folder permissions and long file path restrictions on Windows. diff --git a/scripts/create-latest-svc.sh b/scripts/create-latest-svc.sh index dc008b83c..7f1cf96f4 100755 --- a/scripts/create-latest-svc.sh +++ b/scripts/create-latest-svc.sh @@ -2,36 +2,68 @@ set -e -# -# Downloads latest releases (not pre-release) runner -# Configures as a service -# -# Examples: -# RUNNER_CFG_PAT= ./create-latest-svc.sh myuser/myrepo my.ghe.deployment.net -# RUNNER_CFG_PAT= ./create-latest-svc.sh myorg my.ghe.deployment.net -# -# Usage: -# export RUNNER_CFG_PAT= -# ./create-latest-svc scope [ghe_domain] [name] [user] [labels] -# -# scope required repo (:owner/:repo) or org (:organization) -# ghe_domain optional the fully qualified domain name of your GitHub Enterprise Server deployment -# name optional defaults to hostname -# user optional user svc will run as. defaults to current -# labels optional list of labels (split by comma) applied on the runner -# # Notes: # PATS over envvars are more secure +# Downloads latest runner release (not pre-release) +# Configures it as a service more secure # Should be used on VMs and not containers # Works on OSX and Linux # Assumes x64 arch -# +# See EXAMPLES below -runner_scope=${1} -ghe_hostname=${2} -runner_name=${3:-$(hostname)} -svc_user=${4:-$USER} -labels=${5} +flags_found=false + +while getopts 's:g:n:u:l:' opt; do + flags_found=true + + case $opt in + s) + runner_scope=$OPTARG + ;; + g) + ghe_hostname=$OPTARG + ;; + n) + runner_name=$OPTARG + ;; + u) + svc_user=$OPTARG + ;; + l) + labels=$OPTARG + ;; + *) + echo " +Runner Service Installer +Examples: +RUNNER_CFG_PAT= ./create-latest-svc.sh myuser/myrepo my.ghe.deployment.net +RUNNER_CFG_PAT= ./create-latest-svc.sh -s myorg -u user_name -l label1,label2 +Usage: + export RUNNER_CFG_PAT= + ./create-latest-svc scope [ghe_domain] [name] [user] [labels] + -s required scope: repo (:owner/:repo) or org (:organization) + -g optional ghe_hostname: the fully qualified domain name of your GitHub Enterprise Server deployment + -n optional name of the runner, defaults to hostname + -u optional user svc will run as, defaults to current + -l optional list of labels (split by comma) applied on the runner" + exit 0 + ;; + esac +done + +shift "$((OPTIND - 1))" + +if ! "$flags_found"; then + runner_scope=${1} + ghe_hostname=${2} + runner_name=${3:-$(hostname)} + svc_user=${4:-$USER} + labels=${5} +fi + +# apply defaults +runner_name=${runner_name:-$(hostname)} +svc_user=${svc_user:-$USER} echo "Configuring runner @ ${runner_scope}" sudo echo @@ -142,7 +174,7 @@ echo echo "Configuring as a service ..." prefix="" if [ "${runner_plat}" == "linux" ]; then -prefix="sudo " + prefix="sudo " fi ${prefix}./svc.sh install ${svc_user} diff --git a/src/Runner.Worker/ActionManager.cs b/src/Runner.Worker/ActionManager.cs index 1b462438b..9bc6b8734 100644 --- a/src/Runner.Worker/ActionManager.cs +++ b/src/Runner.Worker/ActionManager.cs @@ -610,6 +610,7 @@ namespace GitHub.Runner.Worker { NameWithOwner = repositoryReference.Name, Ref = repositoryReference.Ref, + Path = repositoryReference.Path, }; }) .ToList(); diff --git a/src/Sdk/DTWebApi/WebApi/ActionReference.cs b/src/Sdk/DTWebApi/WebApi/ActionReference.cs index c6ea8a9ed..2c892b494 100644 --- a/src/Sdk/DTWebApi/WebApi/ActionReference.cs +++ b/src/Sdk/DTWebApi/WebApi/ActionReference.cs @@ -18,5 +18,12 @@ namespace GitHub.DistributedTask.WebApi get; set; } + + [DataMember] + public string Path + { + get; + set; + } } } diff --git a/src/runnerversion b/src/runnerversion index d11ab399e..bb559261d 100644 --- a/src/runnerversion +++ b/src/runnerversion @@ -1 +1 @@ -2.280.1 +2.280.2