Hi,
I have config like below, but as part of step I need to store one string value in step and use it in next job.
but I read documentation that each run runs on own shell , I saw export to bash as work around but I am using windows executor… so it wont be option
version: 2.1
jobs:
self-hosted-agent-test:
machine: true
resource_class: xxxxxxx/devops-self-hosted-agent
steps:
- checkout
- run:
command: az login --service-principal -u $xxxxxx -p $xxxxx --tenant $xxxx
- run:
command: az group create --location $xxxxx --name $xxxxxxxx
- run:
command: az storage account create --name $xxxxxxxx --resource-group $xxxxxxx --location $xxxxx --sku Standard_LRS
- run:
command: az storage container create --name xxxxxx --account-name $xxxxxxxx
- run:
command: Connect-AzAccount --service-principal -u $xxx -p $xxx --tenant $xxxx
- run:
shell: powershell.exe
command: $key=(Get-AzStorageAccountKey -ResourceGroupName $xxxxxxxxx -AccountName $xxxxxxx)[0].Value
self-hosted-agent-test1:
machine: true
resource_class: xxxxxxx/devops-self-hosted-agent
steps:
- checkout
- run:
name: Storage key persistance check
command: Write-Host $key
workflows:
my-workflow:
jobs:
- self-hosted-agent-test:
context:
- abcd
- self-hosted-agent-test1
Now I need to use $key value in job self-hosted-agent-job1 but its not working , in fact i wanted that job 1 $key should be added as env variable in existing context named “abcd” but i read somewhere that is not possible
Please suggest.