2021-07-29

variable set in azure pipeline gets corrupted when read in template

variable big_var_01 defined with value '3q4w#V$X3q4w#V$X' by following azure pipeline yaml file gets corrupted to become value '3q4w#V#V' when read back in azure pipeline template

cat parent_scott.yaml



variables:
- name: big_var_01
  value: $


parameters:
  - name: big_var_01
    displayName: "this var wants to get written to then read by templates"
    type: string
    default: '3q4w#V$X3q4w#V$X'


# CI Triggers
trigger:
  branches:
    exclude:
      - '*'

pool:
  vmImage: 'ubuntu-latest'

# Release Stages
stages:

- template: child_scott_one.yaml

following azure pipeline template variable big_var_01 is read back however its value is corrupted and does not match above assignment

cat child_scott_one.yaml 


# Release Stages
stages:
- stage: A
  jobs:
  - job: JA
    steps:
    - script: |
        echo "here is big_var_01  -->$(big_var_01)<-- "

        local_var_01=$(big_var_01)

        echo
        echo "here is local_var_01  -->$local_var_01<-- "
        echo
        echo "length of local_var_01 is ${#local_var_01}"
        echo


      name: DetermineResult

see run of above pipeline

https://dev.azure.com/sekhemrekhutawysobekhotep/public_project/_build/results?buildId=525&view=logs&j=54e3124b-25ae-54f7-b0df-b26e1988012b&t=52fad91f-d6ac-51fb-b63d-00fda7898bb6&l=13

see code at https://github.com/sekhemrekhutawysobekhotep/shared_variables_across_templates

How to make the string variable big_var_01 get treated as a literal evidently its somehow getting evaluated and thus corrupted ... above code is a simplification of my actual azure pipeline where I get same variable corruption issue even when setting up a Key Value secret with value 3q4w#V$X3q4w#V$X which gets corrupted when read back in a pipeline template



from Recent Questions - Stack Overflow https://ift.tt/3ydklGW
https://ift.tt/eA8V8J

No comments:

Post a Comment