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

Add environment setup support for tasks configuration #22374

Closed
Matumba2 opened this issue Mar 10, 2017 · 4 comments
Closed

Add environment setup support for tasks configuration #22374

Matumba2 opened this issue Mar 10, 2017 · 4 comments
Assignees
Labels
feature-request Request for new features or functionality tasks Task system issues
Milestone

Comments

@Matumba2
Copy link

Im using the tasks.json file to configure my grunt Tasks. Some of them expectect that a given environment variable is set, because they normally are executed with Jenkins where the used plugins for the job execution sets some environment variables I evaluate within the grunt tasks.

It would be awesome if it's possible to pass an array of environment variables, like it's possible with the command args, for example:

{
            "taskName": "myCustomGruntTask",
            "identifier": "myCustomGruntTask",
            "args": [""],

            // Set some environment variables here
            "env": [
                     { "PATH": "$PATH;Some value ..." },
                     { "BRANCH_NAME": "testBranch" },
                     .
                     .
                     .
             ]

            "isBuildCommand": true,
            "isWatching": false,
            "problemMatcher": [
                "$lessCompile",
                "$tsc", 
                "$jshint"
            ]
}
@Matumba2
Copy link
Author

Matumba2 commented Mar 10, 2017

Additional it would be nice if it would be possible to replace the part

{ "BRANCH_NAME": "testBranch" }

with something like

{ "BRANCH_NAME": "${git.currentBranch}" }

@ramya-rao-a ramya-rao-a added the tasks Task system issues label Mar 10, 2017
@cnshenj
Copy link

cnshenj commented Mar 11, 2017

Interestingly, the schema of tasks.json does have an options property which contains an env property. But it has no effect.

@dbaeumer dbaeumer added the feature-request Request for new features or functionality label Mar 13, 2017
@dbaeumer
Copy link
Member

This works if the task defines its own command and doesn't inherit the command from the global scope. Keep a feature request open to support this in a global use case as well.

@dbaeumer dbaeumer added this to the Backlog milestone Nov 9, 2017
@alexr00 alexr00 assigned alexr00 and unassigned dbaeumer Oct 7, 2019
@alexr00
Copy link
Member

alexr00 commented Oct 10, 2019

This works in tasks v2:

{
	"version": "2.0.0",
	"command": "echo %FOO%",
	"tasks": [
		{
			"type": "shell",
			"label": "echo the var",
			"options": {
				"env": {
					"FOO": "this is a foo"
				}
			}
		}
	]
}

Tasks v1 is not being developed. Closing since this is done!

@alexr00 alexr00 closed this as completed Oct 10, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality tasks Task system issues
Projects
None yet
Development

No branches or pull requests

5 participants