You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
provide private variables for all tasks in a given taskfile #306
I'm using a variable NAMESPACE in all my Taskfiles to define the namespace of the Taskfile; that is useful when I want to call a task from the same Taskfile.
version: '3'shopt: [globstar, expand_aliases]includes:
auth: ./auth.ymlcommon: ./common.ymlports: ./ports.ymlvars:
# Namespace for this taskfileNAMESPACE: '{{.NAMESPACE | default "registry"}}'# Special variablesT: '{{.TASK_EXE}}'WORKING_DIR: '{{.USER_WORKING_DIR}}'tasks:
detect:
desc: Detect the operating systemdir: '{{.WORKING_DIR}}'cmds:
- | # Debug output to stderr (won't affect the return value) if [ "{{.DEBUG}}" = "true" ]; then echo "DEBUG: Running detect-os, uname=$(uname)" >&2 fi if [ "$(uname)" = "Darwin" ]; then echo "macos" elif [ "$(uname)" = "Linux" ]; then echo "linux" else echo "unsupported" ficheck-config:
desc: Check Docker daemon configuration for registry compatibilitydir: '{{.WORKING_DIR}}'vars:
TASK_SILENT: "{{if .CLI_SILENT}}--silent{{end}}"TASK_ARGS: "{{.TASK_SILENT | catLines}}"T: '{{.TASK_EXE}} {{.TASK_ARGS}}'cmds:
- |- # Source error handling functions {{.FUNCS.debug}} {{.FUNCS.error}} {{.FUNCS.warn}} {{.FUNCS.info}} {{.FUNCS.success}} {{.FUNCS.check_command}} # Capture OS detection output with logging OS_CMD="{{.T}} {{.NAMESPACE}}:detect"
But that doesn't work correctly when with every include of a Taskfile the variable like NAMESPACE gets a new value. Because a Taskfile shares with all its included Taskfiles the variables, no Taskfile has its own variable space.
Activity
andreynering commentedon Mar 22, 2020
Hi @138over,
It's possible that this will be fixed in v3 though #218.
For now, I'd say this is just not supported and I advice using different variable names.
tobiashochguertel commentedon Aug 27, 2025
This is not yet implemented or?
I'm using a variable
NAMESPACEin all my Taskfiles to define the namespace of the Taskfile; that is useful when I want to call a task from the same Taskfile.But that doesn't work correctly when with every include of a Taskfile the variable like
NAMESPACEgets a new value. Because a Taskfile shares with all its included Taskfiles the variables, no Taskfile has its own variable space.trulede commentedon Feb 8, 2026
There is a PR where you can offer feedback #2659