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

[BUG]: Azure devops pipeline does not pass variables to stages #20689

Open
4 of 7 tasks
scholtz opened this issue Nov 25, 2024 · 2 comments
Open
4 of 7 tasks

[BUG]: Azure devops pipeline does not pass variables to stages #20689

scholtz opened this issue Nov 25, 2024 · 2 comments

Comments

@scholtz
Copy link

scholtz commented Nov 25, 2024

New issue checklist

Task name

No response

Task version

No response

Issue Description

We want to create variable in the build stage and use the variable in all deployment stages.

We are able to create variable in the first stage, and pass it to the dev environment. But we are not able to pass the variable from either build stage to the 3rd stage (test) nor from the deployment to dev stage to deployment to test stage.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

ubuntu

Relevant log output

2024-11-25T17:19:36.8830621Z echo "Received variable from Dev: "

Full task logs with system.debug enabled

[build-variable.txt](https://github.com/user-attachments/files/17906739/build-variable.txt)
[deploy-to-dev.txt](https://github.com/user-attachments/files/17906740/deploy-to-dev.txt)
[deploy-to-test.txt](https://github.com/user-attachments/files/17906741/deploy-to-test.txt)
  

Repro steps

trigger:
- none

stages:
- stage: Build
  displayName: Build Stage
  jobs:
  - job: BuildJob
    displayName: Build Job
    steps:
    - script: |
        echo "##vso[task.setvariable variable=myVar;isOutput=true]Hello from Build"
      name: OutputStep

- stage: DeployDev
  displayName: Deploy Dev Stage
  dependsOn: Build
  variables:
    myVarFromBuild: $[ stageDependencies.Build.BuildJob.outputs['OutputStep.myVar'] ]
  jobs:
  - deployment: DeployJob
    displayName: Deploy to Dev
    environment: "Dev"
    strategy:
      runOnce:
        deploy:
          steps:
          - script: |
              echo "Received variable from Build: $(myVarFromBuild)"
              echo "##vso[task.setvariable variable=myVarDev;isOutput=true]$(myVarFromBuild)"
            name: SetOutputForDev

- stage: DeployTest
  displayName: Deploy Test Stage
  dependsOn: DeployDev
  variables:
    myVarFromDev: $[ stageDependencies.DeployDev.DeployJob.outputs['SetOutputForDev.myVarDev'] ]
  jobs:
  - deployment: DeployJob
    displayName: Deploy to Test
    environment: "Test"
    strategy:
      runOnce:
        deploy:
          steps:
          - script: |
              echo "Received variable from Dev: $(myVarFromDev)"
@scholtz
Copy link
Author

scholtz commented Dec 2, 2024

Is there any timeline to fix this bug?

@hrnjan
Copy link

hrnjan commented Dec 2, 2024

We are also experiencing the same issue described here by @scholtz

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

No branches or pull requests

3 participants