Skip to content

Conversation

@michellemcdaniel
Copy link
Contributor

To double check:

Copy link
Member

@missymessa missymessa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM shipit

@michellemcdaniel michellemcdaniel added the auto-merge Automatically merge PR once CI passes. label Mar 31, 2021
@ghost
Copy link

ghost commented Mar 31, 2021

Hello @adiaaida!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 12 minutes, a condition that will be fulfilled in about 21 seconds. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Copy link
Member

@chcosta chcosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is useful. It's also one of those things that, in hindsight, or if someone understood how Arcade worked, it would be pretty obvious. ie, $ci is the universal Arcade flag for "do stuff as if you're ci", and telemetry is only applicable for ci. Anybody using this stuff or writing scripts for Arcade should understand that aspect of Arcade. But, maybe it helps to connect the dots for folks. LGTM

@missymessa
Copy link
Member

I guess this is useful. It's also one of those things that, in hindsight, or if someone understood how Arcade worked, it would be pretty obvious. ie, $ci is the universal Arcade flag for "do stuff as if you're ci", and telemetry is only applicable for ci. Anybody using this stuff or writing scripts for Arcade should understand that aspect of Arcade. But, maybe it helps to connect the dots for folks. LGTM

It wasn't obvious for me when I was attempting to use this functionality in Arcade Validation. I don't see the harm in including this information in the docs for folks who don't know.


Repos with custom scripts can add telemetry categorization by using Arcade's logging functions which are available in their repo via dependency flow of the `eng/common` scripts.

Please note: for scripts that call the logging functions to properly report back to AzDO, you must set `$ci=$true`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should they just SET it? or should they be correctly determining if they are being run in a CI context using some mechanism (presumably some mechanism that can be shared).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point that I'm trying to get across to users is that, in order for logging to prepend the vso logging headers (or whatever we want to call them), $ci must be $true. How they set that/determine that they are in a $ci environment is up to the user.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically, it's a flag that gets passed to build.cmd (or build.ps1). ie, in CI you'd say "build.cmd -ci" and on your local dev box you'd just say "build.cmd". Of course, locally you could still use "build.cmd -ci". The thinking (I believe) being that adding "ci" changes behavior and we want to be very intentional about when behavior changes vs just having a thing that magically gets set and a dev not understanding why running the exact same command locally vs in ci causes different behavior. I think that there's competing desires at play, 1) to have a thing that just does the right thing always (regardless of context, and 2) to have a thing that is understandable (non-magical). This also means that devs working on Arcade need to have the same mindset and be aware of the "ci" flag.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This documention feels misleading. To me, as someone who doesn't know better, this documentation just says to ALWAYS set it to true. It doesn't say "set it to true in the correct circumstances", it just says set it to true if I want correct behavior.

Set it to false if I don't want proper reporting? Why would I not want proper behavior? The contrapositive doesn't make any sense here, so the documentation is confusing.

It feels like this documention only helps if you already know the answer. To me, as an ignorant person, this is very confusing, and would probably cause me to just add $ci = $True #do proper reporting to the top of every powershell file I wrote.

Copy link
Member

@chcosta chcosta Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nobody should have to set $ci = true. If they're following Arcade guidance (defined elsewhere), then this is transparent and just works. They use the proscribed entry point of build.cmd, and things are fine. Some times people (mostly us), write scripts that use Arcade stuff, but separate from the traditional Arcade system. ie, Arcade was originally intended for our customers (corefx, runtime, aspnet, roslyn, sdk, fsharp, etc...), we find some of the pieces useful (like telemetry), and tend to grab just those pieces and it takes extra care to make sure that behavior is still preserved. This doc was intended for repos adding telemetry to their existing Arcade builds and to help them transition to adding telemetry to their builds (for CI council). For that audience, a valid Arcade build is the pre-req and things should work.

Copy link
Contributor Author

@michellemcdaniel michellemcdaniel Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the point of this comment was that, when writing new scripts that will run in ci, but not through build.ps1 or whatever, something, somewhere needs to set $ci to true, whether that be a switch to the script being written, or baked in the script or what have you. See: https://github.com/dotnet/arcade/blob/main/eng/common/sdk-task.ps1#L13, as an example (there are more). sdk-task.ps1 isn't run in the build, but it uses the logging functions. So it sets $ci to true in the script. This also came up in arcade-validation where a script was using Write-PipelineTelemetryError, but no error was being reported, because nothing was setting $ci to true. The point of this guidance is about enabling logging in ci for scripts that want to use the logging functions, which is our guidance to folks who are writing scripts (use these functions we provide to you). Not everyone can be assumed to know that these logging functions only exhibit the expected behavior if $ci is true (not even people on our team), and therefore they need to make sure that they get that set to true. Hence this doc update.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everyone can be assumed to know that these logging functions only exhibit the expected behavior if $ci is true (not even people on our team), and therefore they need to make sure that they get that set to true. Hence this doc update.

Agreed. Let's document our tribal knowledge because folks who are here aren't going to remember everything, or even have interacted with Arcade enough to know this. If we get new folks on the team (or new customers who want to use this functionality), we'll need to share this information with them, and easier to have it written down than try to remember and impart tribal knowledge to them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to recap... I have no problem with providing more information and I've already approved this PR. But... I do think there's some remaining confusion

This doc was intended for Arcade customer's, not for the engineering team or others trying to just use the Telemetry piece for some other purpose.

The scenarios you described are very clearly not the mainstream scenarios for Arcade and are instances where Telemetry was forced on to another thing.

I feel like this PR, and most of the motivation, are because of some perceived tribal knowledge that is missing and needs to be added to this doc. To Chad's point, adding the comment here, kind of muddies the waters because an audience (not the intended audience) is providing additional information but without additional context, and that leads one to believe that you should always add ci = true. Perhaps a link to the note about build.cmd vs cibuild.cmd would help? That would at least highlight that a pre-req to updating the Arcade scripts, is understanding Arcade's principles (I don't intend that as a judgement or any negative sentiment towards anybody). Either that, or a different doc entirely, or maybe even just a big note at the top of the telemetry scripts.

Regardless, I'm ok with the comment being added to the doc, and we can delete it if it causes confusion.

blah blah blah anyways. Thanks for the effort to keep the docs updated!

@ghost ghost merged commit e3f5723 into dotnet:main Mar 31, 2021
akoeplinger pushed a commit to akoeplinger/arcade that referenced this pull request Apr 12, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Automatically merge PR once CI passes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants