How to report build progress to TFS vNext from within a powershell script?











up vote
0
down vote

favorite












My vNext build contains very few steps - I just setup a few settings and call the main Powershell build script, which internally invokes msbuild, but it also does other things too.



I know that vNext comes with a distributed msbuild logger that allows msbuild to report events up to vNext to be displayed in the step Timeline.



Can this be done for arbitrary logic, not just msbuild?



EDIT 1



My philosophy to writing vNext (or Octopus) project is to minimize the number of steps. This is because these steps are code, but neither vNext nor Octopus provide the environment I expect to get when writing code, specifically:




  1. Version Control


    • Technically vNext has it, but for me VCS implies easy diffing with the other versions. vNext diff is full of irrelevant crap. Still light years better than Octopus, which has none.



  2. Code Review

  3. Associated Work Items (why did X made change Y?)

  4. Debugging


For me these are essential and that is why I tend to have one master build script. I do delegate stuff to vNext (Octopus) - like publishing artifacts and tests or getting sources. But the code that runs on the particular machine locally is my Powershell script.










share|improve this question
























  • you want build progress (not status)? how would powershell know progress of something its invoking?
    – 4c74356b41
    Nov 11 at 6:54












  • Why not to seprate the steps to few powershell tasks + mdbuild task? one ps task for very few things is not the best way to use vNext build.
    – Shayki Abramczyk
    Nov 11 at 8:23










  • I provide explanation why I do not have many steps.
    – mark
    Nov 11 at 19:06















up vote
0
down vote

favorite












My vNext build contains very few steps - I just setup a few settings and call the main Powershell build script, which internally invokes msbuild, but it also does other things too.



I know that vNext comes with a distributed msbuild logger that allows msbuild to report events up to vNext to be displayed in the step Timeline.



Can this be done for arbitrary logic, not just msbuild?



EDIT 1



My philosophy to writing vNext (or Octopus) project is to minimize the number of steps. This is because these steps are code, but neither vNext nor Octopus provide the environment I expect to get when writing code, specifically:




  1. Version Control


    • Technically vNext has it, but for me VCS implies easy diffing with the other versions. vNext diff is full of irrelevant crap. Still light years better than Octopus, which has none.



  2. Code Review

  3. Associated Work Items (why did X made change Y?)

  4. Debugging


For me these are essential and that is why I tend to have one master build script. I do delegate stuff to vNext (Octopus) - like publishing artifacts and tests or getting sources. But the code that runs on the particular machine locally is my Powershell script.










share|improve this question
























  • you want build progress (not status)? how would powershell know progress of something its invoking?
    – 4c74356b41
    Nov 11 at 6:54












  • Why not to seprate the steps to few powershell tasks + mdbuild task? one ps task for very few things is not the best way to use vNext build.
    – Shayki Abramczyk
    Nov 11 at 8:23










  • I provide explanation why I do not have many steps.
    – mark
    Nov 11 at 19:06













up vote
0
down vote

favorite









up vote
0
down vote

favorite











My vNext build contains very few steps - I just setup a few settings and call the main Powershell build script, which internally invokes msbuild, but it also does other things too.



I know that vNext comes with a distributed msbuild logger that allows msbuild to report events up to vNext to be displayed in the step Timeline.



Can this be done for arbitrary logic, not just msbuild?



EDIT 1



My philosophy to writing vNext (or Octopus) project is to minimize the number of steps. This is because these steps are code, but neither vNext nor Octopus provide the environment I expect to get when writing code, specifically:




  1. Version Control


    • Technically vNext has it, but for me VCS implies easy diffing with the other versions. vNext diff is full of irrelevant crap. Still light years better than Octopus, which has none.



  2. Code Review

  3. Associated Work Items (why did X made change Y?)

  4. Debugging


For me these are essential and that is why I tend to have one master build script. I do delegate stuff to vNext (Octopus) - like publishing artifacts and tests or getting sources. But the code that runs on the particular machine locally is my Powershell script.










share|improve this question















My vNext build contains very few steps - I just setup a few settings and call the main Powershell build script, which internally invokes msbuild, but it also does other things too.



I know that vNext comes with a distributed msbuild logger that allows msbuild to report events up to vNext to be displayed in the step Timeline.



Can this be done for arbitrary logic, not just msbuild?



EDIT 1



My philosophy to writing vNext (or Octopus) project is to minimize the number of steps. This is because these steps are code, but neither vNext nor Octopus provide the environment I expect to get when writing code, specifically:




  1. Version Control


    • Technically vNext has it, but for me VCS implies easy diffing with the other versions. vNext diff is full of irrelevant crap. Still light years better than Octopus, which has none.



  2. Code Review

  3. Associated Work Items (why did X made change Y?)

  4. Debugging


For me these are essential and that is why I tend to have one master build script. I do delegate stuff to vNext (Octopus) - like publishing artifacts and tests or getting sources. But the code that runs on the particular machine locally is my Powershell script.







powershell tfs msbuild azure-devops vnext






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 19:06

























asked Nov 11 at 0:40









mark

19.1k55184370




19.1k55184370












  • you want build progress (not status)? how would powershell know progress of something its invoking?
    – 4c74356b41
    Nov 11 at 6:54












  • Why not to seprate the steps to few powershell tasks + mdbuild task? one ps task for very few things is not the best way to use vNext build.
    – Shayki Abramczyk
    Nov 11 at 8:23










  • I provide explanation why I do not have many steps.
    – mark
    Nov 11 at 19:06


















  • you want build progress (not status)? how would powershell know progress of something its invoking?
    – 4c74356b41
    Nov 11 at 6:54












  • Why not to seprate the steps to few powershell tasks + mdbuild task? one ps task for very few things is not the best way to use vNext build.
    – Shayki Abramczyk
    Nov 11 at 8:23










  • I provide explanation why I do not have many steps.
    – mark
    Nov 11 at 19:06
















you want build progress (not status)? how would powershell know progress of something its invoking?
– 4c74356b41
Nov 11 at 6:54






you want build progress (not status)? how would powershell know progress of something its invoking?
– 4c74356b41
Nov 11 at 6:54














Why not to seprate the steps to few powershell tasks + mdbuild task? one ps task for very few things is not the best way to use vNext build.
– Shayki Abramczyk
Nov 11 at 8:23




Why not to seprate the steps to few powershell tasks + mdbuild task? one ps task for very few things is not the best way to use vNext build.
– Shayki Abramczyk
Nov 11 at 8:23












I provide explanation why I do not have many steps.
– mark
Nov 11 at 19:06




I provide explanation why I do not have many steps.
– mark
Nov 11 at 19:06












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










I agree with the comments suggesting that you split the build pipeline process into multiple steps/tasks to better see and log overall status. That said, there is a way to report progress back to the build timeline. You can use the ##vso[task.setprogress] command documented on the Azure Pipeline Tasks Logging Commands page. The following will print the progress percentage in the log/console as well as display the percentage next to the step name in the timeline:



$myArray = @(1..10)
foreach ($item in $myArray) {
$simplePercentage = (($myArray.IndexOf($item)/$myArray.Length)*100)
Write-Output ("Current Percentage: $simplePercentage")
Write-Output ('##vso[task.setprogress value={0};]{1}' -f $simplePercentage, 'My Sample Task')
Start-Sleep -Seconds 3
}


You can split your Powershell script/functions into whatever overall percentage and then use that logging command to report the sections' progress.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244812%2fhow-to-report-build-progress-to-tfs-vnext-from-within-a-powershell-script%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    I agree with the comments suggesting that you split the build pipeline process into multiple steps/tasks to better see and log overall status. That said, there is a way to report progress back to the build timeline. You can use the ##vso[task.setprogress] command documented on the Azure Pipeline Tasks Logging Commands page. The following will print the progress percentage in the log/console as well as display the percentage next to the step name in the timeline:



    $myArray = @(1..10)
    foreach ($item in $myArray) {
    $simplePercentage = (($myArray.IndexOf($item)/$myArray.Length)*100)
    Write-Output ("Current Percentage: $simplePercentage")
    Write-Output ('##vso[task.setprogress value={0};]{1}' -f $simplePercentage, 'My Sample Task')
    Start-Sleep -Seconds 3
    }


    You can split your Powershell script/functions into whatever overall percentage and then use that logging command to report the sections' progress.






    share|improve this answer

























      up vote
      1
      down vote



      accepted










      I agree with the comments suggesting that you split the build pipeline process into multiple steps/tasks to better see and log overall status. That said, there is a way to report progress back to the build timeline. You can use the ##vso[task.setprogress] command documented on the Azure Pipeline Tasks Logging Commands page. The following will print the progress percentage in the log/console as well as display the percentage next to the step name in the timeline:



      $myArray = @(1..10)
      foreach ($item in $myArray) {
      $simplePercentage = (($myArray.IndexOf($item)/$myArray.Length)*100)
      Write-Output ("Current Percentage: $simplePercentage")
      Write-Output ('##vso[task.setprogress value={0};]{1}' -f $simplePercentage, 'My Sample Task')
      Start-Sleep -Seconds 3
      }


      You can split your Powershell script/functions into whatever overall percentage and then use that logging command to report the sections' progress.






      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        I agree with the comments suggesting that you split the build pipeline process into multiple steps/tasks to better see and log overall status. That said, there is a way to report progress back to the build timeline. You can use the ##vso[task.setprogress] command documented on the Azure Pipeline Tasks Logging Commands page. The following will print the progress percentage in the log/console as well as display the percentage next to the step name in the timeline:



        $myArray = @(1..10)
        foreach ($item in $myArray) {
        $simplePercentage = (($myArray.IndexOf($item)/$myArray.Length)*100)
        Write-Output ("Current Percentage: $simplePercentage")
        Write-Output ('##vso[task.setprogress value={0};]{1}' -f $simplePercentage, 'My Sample Task')
        Start-Sleep -Seconds 3
        }


        You can split your Powershell script/functions into whatever overall percentage and then use that logging command to report the sections' progress.






        share|improve this answer












        I agree with the comments suggesting that you split the build pipeline process into multiple steps/tasks to better see and log overall status. That said, there is a way to report progress back to the build timeline. You can use the ##vso[task.setprogress] command documented on the Azure Pipeline Tasks Logging Commands page. The following will print the progress percentage in the log/console as well as display the percentage next to the step name in the timeline:



        $myArray = @(1..10)
        foreach ($item in $myArray) {
        $simplePercentage = (($myArray.IndexOf($item)/$myArray.Length)*100)
        Write-Output ("Current Percentage: $simplePercentage")
        Write-Output ('##vso[task.setprogress value={0};]{1}' -f $simplePercentage, 'My Sample Task')
        Start-Sleep -Seconds 3
        }


        You can split your Powershell script/functions into whatever overall percentage and then use that logging command to report the sections' progress.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 8:42









        Michael

        1,1191716




        1,1191716






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244812%2fhow-to-report-build-progress-to-tfs-vnext-from-within-a-powershell-script%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Full-time equivalent

            さくらももこ

            13 indicted, 8 arrested in Calif. drug cartel investigation