Commit ead60fe8 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add config help from the cmdline with --help-config

parent bb06ab6c
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ usage() {

	Options:
	  -h --help         Print this message and exit
	     --help-config  Print a message explaining the configuration file format
	  -u --url          The co-ordinator's URL
	  -d --description  A description for the GitLab UI (defaults to NAME)

@@ -26,10 +27,39 @@ usage() {
	END
}

config_help() {
	cat <<-'END'
	The configuration file is a sourced Bash script at
	/etc/gitlab-runner/registration.conf

	Variables:
	  COORDINATOR_URL  A GitLab instance URL. This can be overridden from the
	                   command line.
	                   Example: https://gitlab.example.com/

	  NAME             A name pattern containing a printf-style '%' token.
	                   This will be used with an auto-generated index value to
	                   generate a name when none is provided in the command line.
	                   Default: "${HOSTNAME}/%02i"

	  MAX_INDEX        When looking for a free name using NAME, stop once this
	                   value is reached. This places a safe limit on the search,
	                   which is 99 by default. You should not need to increase
	                   this unless there are A LOT of runners to be started.
	                   Default: 99

	  DESCRIPTION      A description for the co-ordinator other than the
	                   computed value of NAME. Note that setting this will cause
	                   all registered runners without an explicit description
	                   from the command line to have the same description.
	END
}

offset=0
while [[ $# -gt 0 ]]; do
	case "$1" in
		-h|--help) usage; exit 0 ;;
		--help-config) config_help; exit 0 ;;
		-d|--description) DESCRIPTION=${2:$offset}; shift ;;
		-u|--url|--coordinator-url) COORDINATOR_URL=${2:$offset}; shift ;;