Skip to content

Use Task to Setup Enviroment Variables #91

@mmattes

Description

@mmattes

Hi,

it took me a while to figure out how I can use tasks to set Enviroment Variables which can be used during the whole deployment. I first tried the following

Deploy {

    By Task Set-Enviroment {        
     	$Env:Enviroment = "Dev"
        $Env:InstPath = "C:\Web\Precompiled\$Env:Enviroment.Website"        
        Tagged Dev
    }
    By Noop Test {
    	FromSource dist
    	To $Env:InstPath
    	DependingOn Set-Enviroment
    }
}

unfortunately this did not work out "By Noop Test" did not know anything about my enviroment variables. What worked out for me is to put the Enviroment variable within the task into the FromSource part like that:

Deploy {

    By Task Set-Enviroment {        
    	FromSource {
    		$Env:Enviroment = "Dev"
        	$Env:InstPath = "C:\Web\Precompiled\$Env:Enviroment.Website"        	
    	}     	
        Tagged Dev
    }
    By Noop Test {
    	FromSource dist
    	To $Env:InstPath
    	DependingOn Set-Enviroment
    }
}

The documentation does not say anything about that. I would like to complete the documentation but I dont know how it acutally is intended to be working? Is my approach by putting it into the FromSource correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions