Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple telemetry API call from main action #24

Merged
merged 9 commits into from
Mar 31, 2022
Merged

Conversation

TooManyBees
Copy link
Contributor

@TooManyBees TooManyBees commented Mar 23, 2022

addresses https://github.com/github/pages-engineering/issues/1044

Changes deploy-pages to not automatically emit telemetry from the src/pre.js file, both as a "pre" action and as a chained promise after the deploy completes. Instead, telemetry (from the same file) is only run when a new input emit_telemetry is truthy.

The matching PR to dotcom https://github.com/github/github/pull/213548 updates the dynamic workflow for jekyll page builds so that after the build, this action is invoked twice in parallel: once with emit_telemetry: true to make the telemetry API call, and once without to perform the deploy as usual (without any telemetry).

People who use a "bring-your-own-workflow" to pages builds should not notice or care about this new input.

I expect to publish this version of the action to v1 before we deploy any code to dotcom that changes the dynamic workflow, so this action is designed to work for both current and newer versions of the dynamic workflow. When the emit_telemetry input is completely missing, this action falls back to its current behavior; when the input is true or false, it adopts the new behavior that we want. Once the dotcom changes are deployed and we are confident in them, we can remove the fallback logic.

@TooManyBees TooManyBees force-pushed the decouple-telemetry branch 4 times, most recently from b688bb5 to 1058509 Compare March 29, 2022 13:44
It gets cast to a string! Eep!
main()
} else {
// If emit_telemetry is not set, that indicates an older version of the dynamic workflow that doesn't separate telemetry from deployment
main().then(() => require('./pre'))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to accomodate the time between tagging this release as v1 and switching over to the new version of the dynamic workflow. We should expect to remove this last condition after both this action and the dynamic workflow on dotcom are deployed and in use.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note that when we revise this in that future PR, we should also either:

  • set the default value of the emit_telemetry input to "false", and/or
  • reduce this section of the code to just use else { ... rather than else if (emitTelemetry === "false").

@TooManyBees TooManyBees marked this pull request as ready for review March 29, 2022 19:44
@TooManyBees TooManyBees requested a review from a team March 29, 2022 19:47
action.yml Show resolved Hide resolved
Copy link
Contributor

@JamesMGreene JamesMGreene left a comment

Choose a reason for hiding this comment

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

Only minor nits, no blockers here. 👍🏻

Curious question, though: in the future, do you think it would make sense to separate the ./pre script into its own separate Action to avoid any potential confusion? 🤷🏻‍♂️

main()
} else {
// If emit_telemetry is not set, that indicates an older version of the dynamic workflow that doesn't separate telemetry from deployment
main().then(() => require('./pre'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note that when we revise this in that future PR, we should also either:

  • set the default value of the emit_telemetry input to "false", and/or
  • reduce this section of the code to just use else { ... rather than else if (emitTelemetry === "false").

src/index.js Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
TooManyBees and others added 3 commits March 31, 2022 11:47
This has been an established pattern with Actions for a long time; we don't have to worry about it changing.

Co-authored-by: James M. Greene <[email protected]>
Co-authored-by: James M. Greene <[email protected]>
@TooManyBees TooManyBees merged commit eaf36f4 into main Mar 31, 2022
@TooManyBees TooManyBees deleted the decouple-telemetry branch March 31, 2022 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants