ci icon indicating copy to clipboard operation
ci copied to clipboard

Add 'runCmdOutput' output to GitHub Action/AzDO Task when using 'runCmd' input

Open natescherer opened this issue 2 years ago • 9 comments

Hello! This PR adds an output 'runCmdOutput' to the GitHub action containing whatever is output by the command specified in the 'runCmd' input. It also includes a bonus fix for tests that are installing Go, as the detection method that was being used for finding the latest version of the Go installer broke when 1.19 was added to https://go.dev/dl/.

If you need me to make any updates or fixes, please let me know.

natescherer avatar Aug 19 '22 22:08 natescherer

Hi @natescherer - thanks for this PR!

I like the idea of being able to capture the output from the runCmd. My concern is how well it will handle large outputs (I've had runs with over 10k lines of output) - do you know whether there are any limits around the size of action output values?

stuartleeks avatar Aug 30 '22 07:08 stuartleeks

/test 5e5be8f

stuartleeks avatar Aug 30 '22 07:08 stuartleeks

:robot: pr-bot :robot:

:runner: Running tests: https://github.com/devcontainers/ci/actions/runs/2954257443

(in response to this comment from @stuartleeks)

github-actions[bot] avatar Aug 30 '22 07:08 github-actions[bot]

I just found this doc which says:

Outputs are Unicode strings, and can be a maximum of 1 MB. The total of all outputs in a workflow run can be a maximum of 50 MB.

I think it probably makes sense to limit the size of the runCmd output that is captured.

It would also be good to include the runCmdOutput for the Azure DevOps task, too :-)

stuartleeks avatar Aug 30 '22 07:08 stuartleeks

Redid the main commit as I realized I missed updating action.yml.

Updates for AzDO and output length coming shortly.

natescherer avatar Aug 30 '22 20:08 natescherer

Okay, that's limiting the GH Action output to < 1 MB done.

Also implemented runCmdOutput as an output variable for the AzDO task. I took my best crack at getting it right but, as far as I can tell, there's not really a way for me to test it myself?

I also limited its max output to 25k characters based on this, figuring that there could well be other large env vars in pipelines: https://stackoverflow.com/questions/56534338/what-is-the-maximum-length-of-a-variable-in-azure-pipelines

Let me know if there are any other changes needed!

natescherer avatar Aug 30 '22 21:08 natescherer

/test 32541c5

stuartleeks avatar Aug 31 '22 05:08 stuartleeks

:robot: pr-bot :robot:

:runner: Running tests: https://github.com/devcontainers/ci/actions/runs/2961497039

(in response to this comment from @stuartleeks)

github-actions[bot] avatar Aug 31 '22 05:08 github-actions[bot]

Not really sure why that's failing on the git check? I ran the build-local.sh before making the commit.

natescherer avatar Aug 31 '22 14:08 natescherer

Apologies - I think that there is a scenario where build-local.sh runs a second time and produces changes, but I've not managed to track down the cause. In the mean time, if you run again and push then I can re-run the build and it should get past that point.

Also, the golang installations were fixed in a PR that got merged earlier so it may make sense to drop those changes in this PR to avoid conflicts.

stuartleeks avatar Aug 31 '22 15:08 stuartleeks

Okay, I removed the commit with my golang fix, merged your latest commit, and added another commit after running build-local.sh again. Looks like all it did was change some double-quotes to single? Should be good to run the tests again.

natescherer avatar Sep 01 '22 14:09 natescherer

Great - thanks!

stuartleeks avatar Sep 01 '22 14:09 stuartleeks

/test 52b99e1

stuartleeks avatar Sep 01 '22 14:09 stuartleeks

:robot: pr-bot :robot:

:runner: Running tests: https://github.com/devcontainers/ci/actions/runs/2972645407

(in response to this comment from @stuartleeks)

github-actions[bot] avatar Sep 01 '22 14:09 github-actions[bot]

@natescherer - thanks again for the updates, tests are looking good. I see that the CLA check is showing that you haven't completed a CLA? I believe https://cla.microsoft.com/ is the link you need for that.

I've also added @chrmarti for a review 😄

stuartleeks avatar Sep 01 '22 19:09 stuartleeks

According to that site a bot is supposed to post a link in a PR comment for me to sign, but that appears to not have happened? I don't see a way to initiate it myself.

natescherer avatar Sep 01 '22 19:09 natescherer

According to that site a bot is supposed to post a link in a PR comment for me to sign, but that appears to not have happened? I don't see a way to initiate it myself.

@chrmarti - do you know how the CLA process usually works? Is there something missing in the setup for this repo?

stuartleeks avatar Sep 02 '22 14:09 stuartleeks

We only recently added the CLA configuration to the org. Maybe the bot only shows up on new PRs. @natescherer Could you try creating a new PR (with the same changes)?

chrmarti avatar Sep 02 '22 14:09 chrmarti

We only recently added the CLA configuration to the org. Maybe the bot only shows up on new PRs. @natescherer Could you try creating a new PR (with the same changes)?

You bet. Will do right now.

natescherer avatar Sep 02 '22 15:09 natescherer

#165

natescherer avatar Sep 02 '22 15:09 natescherer