Skip to content

Instantly share code, notes, and snippets.

@dvgitit
Last active March 10, 2023 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvgitit/7554e02c75815ac155b3ceb2c283996c to your computer and use it in GitHub Desktop.
Save dvgitit/7554e02c75815ac155b3ceb2c283996c to your computer and use it in GitHub Desktop.
taskfile USER_WORKING_DIRECTORY test

Steps to reproduce

git clone https://gist.github.com/dvgitit/7554e02c75815ac155b3ceb2c283996c test_uwd
cd test_uwd
chmod -R +x *.sh
./create_test_scenario.sh
cd test/test_uwd
./test.sh

directory ../../config/home is unexpected.

mkdir -p config/taskfile/ansible
mkdir -p test/test_uwd
cat<<EOT>config/Taskfile.yaml
---
version: '3'
env:
ENV: testing
includes:
ansible:
taskfile: ./taskfile/ansible/Taskfile.ansible.yaml
EOT
cat<<EOT>config/taskfile/ansible/Taskfile.ansible.yaml
---
version: '3'
vars:
GREETING: ansible
MYDIR: '{{.USER_WORKING_DIR}}'
MY_CURRENT_PWD: $PWD
tasks:
test:
dir: '{{.USER_WORKING_DIR}}'
cmds:
- echo USER_WORKING_DIR='{{.USER_WORKING_DIR}}'
- echo MYDIR='{{.MYDIR}}'
- echo ROOT_DIR='{{.ROOT_DIR}}'
- echo TASKFILE_DIR='{{.TASKFILE_DIR}}'
EOT
cat<<EOT>test/test_uwd/test.sh
task -v -t ../../config/Taskfile.yaml ansible:test
EOT
chmod +x test/test_uwd/test.sh
@dvgitit
Copy link
Author

dvgitit commented Mar 10, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment