Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to environment do not persist across tasks #1743

Open
tj-smith47 opened this issue Aug 8, 2024 · 1 comment
Open

Changes to environment do not persist across tasks #1743

tj-smith47 opened this issue Aug 8, 2024 · 1 comment
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@tj-smith47
Copy link

tj-smith47 commented Aug 8, 2024

This is something of a hybrid bug report / feature request.

I use go-task at my company to curate sets of local development setup & maintenance flows. The issue I'm facing is that when I have a task that runs a list of commands or tasks, the expected change in the environment from previous items in that list are not always available to the consecutive commands. Things like writing to a file are persistent, but things where you authenticate to a service in one step, and then make use of your authenticated status to do something else does not persist.

I fully understand that I can split up the tasks in the list into 2 separate tasks, and I'm expressing interest in not having to do so. The point of task is to take mult-step processes and elegantly merge & simplify them. To that end I believe this is a valid request.

Here's an example. I have a task - task init - that among other things will download, install, and setup gcloud and kubectl. Then after authentication, it attempts to read a secret from one of the contexts it just authenticated to that it needs for the upcoming task in the list, but it cannot access it. There are additional, dependent tasks that run after the step that fails, and many similar dependent operations in the list as well. Right now, the only way we can get all tasks in the list completed is by advising developers to re-run the task until all tasks are successful, which creates a user experience wherein failure is expected.

That feels icky.

Here's where maybe this turns into a feature request. I'm assuming this limitation may have something to do with the shell and/or session tasks are executed in? If I'm incorrect, please school me - this is an amazing product and I'd love to learn as much as I can. But if so, it would relate to to issue #1736 - allowing the user to decide which shell a cmd runs in by default. While this would be a powerful feature however, I get the feeling it would not be a comprehensive solution. Let me give another example:

Say I have a task in task init that writes to a user's ~/.zshrc file, and I want the new content loaded into the environment for use in the next task that runs. To be fair - I could see how this situation could be dicey; while each item in the task list is a "separate" command, they are invoked via a single command through go-task. I am looking to understand if there have been any discussions around finding a way to execute each task as though they were individual commands in the user's natural shell and environment, wherein all changes from previous commands are persistent and available for use for the next task. If so, I'm curious to learn your findings / any limitations to doing this.

But most importantly, thank you 🙏 go-task has been an absolute game-changer for my company, and has resulted in a combination snowball-butterfly effect of time, productivity gained for all. Personally, I'll be using this tool wherever I can ❤️

  • Task version: 3.38.0
  • Operating system: MacOS 14.5 (23F79)
  • Experiments enabled: None
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Aug 8, 2024
@tj-smith47
Copy link
Author

Initially I struggled with how to describe what I see as the root problem going on here, but after a bit more research, I see a discussion around this and an attempt to implement was made a couple years ago: #643

In which case, my feature request would be to revisit investing in allowing all subtasks of a task to be run in a single shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

2 participants