Giter VIP home page Giter VIP logo

Comments (11)

ericsciple avatar ericsciple commented on July 1, 2024 1

I briefly discussed with @vtbassmatt and understand the scenario better now. Makes sense. I'll discuss further with Matt, so we can nail down the details in a spec somewhere (not strictly yaml; the core expression functions are available in other parts of the system too)

from azure-pipelines-yaml.

echesakov avatar echesakov commented on July 1, 2024

/cc @sbomer @chcosta

from azure-pipelines-yaml.

vtbassmatt avatar vtbassmatt commented on July 1, 2024

@ericsciple this seems like a decent addition to the expression language. Unless we already have something that will satisfy their scenario? (See the link above.)

from azure-pipelines-yaml.

echesakov avatar echesakov commented on July 1, 2024

/cc @RussKeldorph

from azure-pipelines-yaml.

echesakov avatar echesakov commented on July 1, 2024

@ericsciple Thank you for considering to add this feature!

Can't wait to have this in any form in the language and remove ugly workaround introduced by dotnet/coreclr#22173

from azure-pipelines-yaml.

ericsciple avatar ericsciple commented on July 1, 2024

@vtbassmatt @echesakovMSFT @sbomer @chcosta what do you think about this proposed behavior:

Join function

  • Concatenates all elements in the right parameter array, separated by the left parameter string.
  • Min parameters: 2. Max parameters: 2
  • Each element in the array is converted to string. Complex objects are converted to empty string.
  • If the right parameter is not an array, the result is empty string.

Or would this behavior be better:

  • If the right parameter is not an array, the result is the right parameter converted to a string.

from azure-pipelines-yaml.

echesakov avatar echesakov commented on July 1, 2024

I like the second behavior for the right parameter. In this case, I can think about the function as the following two steps transformation:

  1. Convert the right parameter to an array of strings. If the original value is not an array, treat it as a singleton array (of one item).
  2. Join the resulting array of strings using the left parameter.

from azure-pipelines-yaml.

vtbassmatt avatar vtbassmatt commented on July 1, 2024

Yeah, now that you mention it, the silent conversion to an empty string would be confusing.

from azure-pipelines-yaml.

ericsciple avatar ericsciple commented on July 1, 2024

This will roll out with the m148 payload.

from azure-pipelines-yaml.

jontreynes avatar jontreynes commented on July 1, 2024

Is there any support to have an append to array. I see the support here converts an array to a string with a delimiter. However, the use case I'm looking for is to append to an array.

For example

- name: dependsOn
   default:
     - stage1
     - stage2
- name: additionalDependsOn   
    default: stage0
    
 result: ${{append(parameters.dependsOn, additionalDependsOn)}}
 
 # where result is an array [stage1, stage2, stage0]
     

from azure-pipelines-yaml.

jontreynes avatar jontreynes commented on July 1, 2024

Is there any support to have an append to array. I see the support here converts an array to a string with a delimiter. However, the use case I'm looking for is to append to an array.

For example

- name: dependsOn
   default:
     - stage1
     - stage2
- name: additionalDependsOn   
    default: stage0
    
 result: ${{append(parameters.dependsOn, additionalDependsOn)}}
 
 # where result is an array [stage1, stage2, stage0]
     

Update: I've added to feature requests here https://developercommunity.visualstudio.com/t/Function-to-append-to-a-yaml-Array/10166131?space=21&q=function+to+add+to+yaml+array&entry=myfeedback

from azure-pipelines-yaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.