Allowlist for task can take multiple hosts
This commit is contained in:
parent
101fa77894
commit
0887bd839f
|
@ -35,9 +35,9 @@ forgebuild looks up your ~/.forgebuild/ folder to find tasks to run. A task `t`
|
|||
A task may also have the following optional files:
|
||||
|
||||
- t.branch: checkout the specified branch on the repository
|
||||
- t.host: only run the task on a specific host, see [multihost setup](#multihost-setup)
|
||||
- t.hosts: only run the task on a newline-separated list of hosts, see [multihost setup](#multihost-setup)
|
||||
|
||||
**TLDR**: a task `t` needs `t` (executable) and `t.source`, and accepts `t.branch` and `t.host`
|
||||
**TLDR**: a task `t` needs `t` (executable) and `t.source`, and accepts `t.branch` and `t.hosts`
|
||||
|
||||
## Running tasks
|
||||
|
||||
|
@ -63,7 +63,7 @@ Any task receives the `$GITBUILDCONF` environment variable pointing to this repo
|
|||
|
||||
The distinctive feature of `forgebuild.sh` is the host-based configuration system. If a folder matching `$HOSTNAME` is found in your `~/.forgebuild/`, this folder will be passed to the task as `$GITBUILDCONF`, instead of the default configuration folder. If no host-specific configuration is found, the default configuration is used as explained previously.
|
||||
|
||||
Additionally, tasks can be configured to always/never run on a specific host. To run a task `t` on a single host, place a `t.host` file containing the target `$HOSTNAME` in `~/.forgebuild/`. To ignore a task on a specific host, place an empty `t.ignore` file in `~/.forgebuild/$HOSTNAME/`.
|
||||
Additionally, tasks can be configured to always/never run on a specific host. To run a task `t` on a defined list of hosts, place a `t.hosts` file containing a hostname per line in `~/.forgebuild/`. To ignore a task on a specific host, place an empty `t.ignore` file in `~/.forgebuild/$HOSTNAME/`.
|
||||
|
||||
For an example of a multi-host setup, you can check out [my own ~/.forgebuild](https://tildegit.org/southerntofu/my-git-build).
|
||||
|
||||
|
|
|
@ -176,10 +176,9 @@ for p_name in ${PROJECTS[*]}; do
|
|||
export i18n_task="$p_name"
|
||||
debug start_proc
|
||||
# Check if task should run on host
|
||||
if [ -f $BASEDIR/$p_name.host ]; then
|
||||
for_host="$(cat $BASEDIR/$p_name.host)"
|
||||
if [[ "$for_host" != "$HOSTNAME" ]]; then
|
||||
# The task is specifically configured for a different host, ignore
|
||||
if [ -f $BASEDIR/$p_name.hosts ]; then
|
||||
if ! grep "^\s*$HOSTNAME\s*$" $BASEDIR/$p_name.hosts > /dev/null; then
|
||||
# The task is specifically configured for different hosts, ignore
|
||||
export i18n_host="$for_host"
|
||||
debug skipped
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue