C
C#13mo ago
Ikarmus

ADO YAML - output variables troubleshoot

Hi, I have pipeline, which compiles my app and publishes artifacts to azure, then I want to drop them to GitHub Releases. The problem is the necessity to use artifact names (due to compilation of android and windows app in the same pipeline) kinda like on provided image, ofc without debugs The problem is about exporting output variables (compilled artifact names) to other stages Compilation and Azure drop:
- publish: $(Build.SourcesDirectory)/SMCEBI_Navigator/bin
displayName: Publish full compiled app
artifact: '$(Build.BuildNumber)_${{ parameters.framework }}'

- pwsh: Write-Host "##vso[task.setvariable variable=outputArtifactName;isOutput=true]$(Build.BuildNumber)_${{ parameters.framework }}"
displayName: Export artifact name to pipeline

- pwsh: Write-Host $(properties.outputArtifactName)
displayName: Echo outputted name
- publish: $(Build.SourcesDirectory)/SMCEBI_Navigator/bin
displayName: Publish full compiled app
artifact: '$(Build.BuildNumber)_${{ parameters.framework }}'

- pwsh: Write-Host "##vso[task.setvariable variable=outputArtifactName;isOutput=true]$(Build.BuildNumber)_${{ parameters.framework }}"
displayName: Export artifact name to pipeline

- pwsh: Write-Host $(properties.outputArtifactName)
displayName: Echo outputted name
GitHub Release job:
- pwsh: Write-Host $(outputArtifactName)
displayName: Export artifact name to pipeline

- pwsh: Write-Host $(parameters.artifactName)
displayName: Parameters name

- download: current
displayName: Download artifact $(parameters.artifactName)
artifact: $(parameters.artifactName)

- task: GitHubRelease@1
inputs:
repositoryName: $(Build.Repository.Name)
target: $(Build.SourceVersion)
tagSource: userSpecifiedTag
tag: $(currentVersionName)
gitHubConnection: GitHub_ikarmus2001
action: create
assets: $(Pipeline.Workspace)
isDraft: true
- pwsh: Write-Host $(outputArtifactName)
displayName: Export artifact name to pipeline

- pwsh: Write-Host $(parameters.artifactName)
displayName: Parameters name

- download: current
displayName: Download artifact $(parameters.artifactName)
artifact: $(parameters.artifactName)

- task: GitHubRelease@1
inputs:
repositoryName: $(Build.Repository.Name)
target: $(Build.SourceVersion)
tagSource: userSpecifiedTag
tag: $(currentVersionName)
gitHubConnection: GitHub_ikarmus2001
action: create
assets: $(Pipeline.Workspace)
isDraft: true
Pipeline itself:
variables:
- name: WindowsArtifactName
value: ''

stages:
- template: templates/appCompilation.yml
parameters:
outputArtifactName: $(WindowsArtifactName)

- stage: Deployment
jobs:
- template: templates/GithubReleaseJob.yml
parameters:
artifactName: $[WindowsArtifactName]
variables:
- name: WindowsArtifactName
value: ''

stages:
- template: templates/appCompilation.yml
parameters:
outputArtifactName: $(WindowsArtifactName)

- stage: Deployment
jobs:
- template: templates/GithubReleaseJob.yml
parameters:
artifactName: $[WindowsArtifactName]
No description
4 Replies
Ikarmus
IkarmusOP13mo ago
Both template jobs (compilation and github release) has parameters as follows:
parameters:
- name: artifactName
type: string
parameters:
- name: artifactName
type: string
parameters:
- name: outputArtifactName
type: string
parameters:
- name: outputArtifactName
type: string
Ikarmus
IkarmusOP13mo ago
What am I doing wrong? I was reading some questions on stack, ms docs ( setvariable, Outputting variables ) , but can't figure out what is wrong here. If any more info is needed, I will be very happy to provide it
Stack Overflow
Azure Devops - passing variables between job templates
Normal (non-template) jobs in Azure DevOps yaml support inter-job variable passing as follows: jobs: - job: A steps: - script: "echo ##vso[task.setvariable variable=skipsubsequent;isOutput=true]
Define variables - Azure Pipelines
Variables are name-value pairs defined by you for use in a pipeline. You can use variables as inputs to tasks and in your scripts.
Logging commands - Azure Pipelines
How scripts can request work from the agent
Ikarmus
IkarmusOP13mo ago
$help
MODiX
MODiX13mo ago
How to get the best help catpog Make a post in #help or one of the topic channels under Development. Avoid askingcatthinking Can anybody help catthinking Has anyone used catthinking Why doesn't my code work? C# is a big area! No one knows they can help unless you tell them about the small area you're trying to work in. Explain what you are doing, and potentially why for as much context as possible. Avoid screenshots where possible, share code directly in Discord. Type $code into chat to learn how to post code. See https://www.nohello.net and https://dontasktoask.com if you want common help chat room etiquette. Sorry, I couldn't find help related to "commands".
Want results from more Discord servers?
Add your server