0

I wish to read a variable value_deploy_path from another step but it simply prints nothing.


name: CICD_develop
on:
  push:
    branches:
      - "*"

jobs:

  SETVARS:

    runs-on: 'windows-latest'

    steps:

      - name: Get env data from web.SetParameters.xml

        id: retrivevalue

        env:
          STORE_SERVER: ${{ env.storeserver }}

        run: |

          $xmlPath = "\\$env:STORE_SERVER\D$\Jenkins\Inventory\web.Set.xml"

          $key_deploy_path = "deploy_path"

          $value_deploy_path = (Select-Xml -Literalpath $xmlPath -XPath "//setParameter[@name='$key_deploy_path']").Node.Value
          Write-Host "The value for key '$key_deploy_path' is $value_deploy_path"
          echo "##vso[task.setvariable variable=value_deploy_path;isOutput=true]$value_deploy_path"    #Set output variable
          echo "Within: ${{ steps.retrivevalue.outputs.value_deploy_path }}"

      - name: print one myvalue_deploy_path from web.SetParamters.xml

        run: |
          echo "${{ steps.retrivevalue.outputs.value_deploy_path }}"
         

      - name: print myvalue_deploy_path from web.SetParamters.xml
        run: |
          $rvalue = ${{ steps.retrivevalue.outputs.value_deploy_path }}
          Write-Host "The retrived value is: $rvalue"

Output:

The value for key '$key_deploy_path' is D:\\myfolder

Within:


The retrived value is:

Unfortunately, all the print does not print the value except for Write-Host "The value for key '$key_deploy_path' is $value_deploy_path" I. E D:\\myfolder

Can you please suggest why and how can I get the value of value_deploy_path in a different step?

Ashar
  • 2,942
  • 10
  • 58
  • 122
  • Does this answer your question? [Value not set using $GITHUB\_OUTPUT](https://stackoverflow.com/questions/74443940/value-not-set-using-github-output) – Azeem May 11 '23 at 06:27

0 Answers0