Skip to content

@W-9625690@: Added github action to run heartbeat script against production plugin. - #478

Merged
jfeingold35 merged 6 commits into
devfrom
d/W-9625690-b
Jul 23, 2021
Merged

@W-9625690@: Added github action to run heartbeat script against production plugin.#478
jfeingold35 merged 6 commits into
devfrom
d/W-9625690-b

Conversation

@jfeingold35

Copy link
Copy Markdown
Contributor

My testing was done in a separate PR, #471, configured to run the script on command instead of on a schedule, and to send alerts to my personal PagerDuty service.

This is a link to a run where everything ran properly and no alerts were created.

This is a link to a run where the first attempt to install sfdx was replaced with exit 1, forcing that attempt to fail. The second attempt succeeds, the test proceeds as normal, and no alerts are created.

This is a link to a run where all three attempts to install sfdx were replaced with exit 1, forcing that step to fail, and here's a screenshot of the alerts that were created.
Screen Shot 2021-07-22 at 1 38 36 PM (2)

This is a link to a run where only smoke-test.cmd has been changed to always throw an error, and here's a screenshot of the alert that was created.
Screen Shot 2021-07-22 at 1 58 58 PM (2)

This is a link to a run where only smoke-test.sh has been changed to always throw an error, and here's a screenshot of the alert that was created.
Screen Shot 2021-07-22 at 2 03 58 PM (2)

This is a link to a run after I started storing the smoke-test-results folder as an artifact. The jobs' artifacts have distinct names, and the Linux artifact only has one of the result files since it fails on the second scanner:run command.

Comment thread .github/workflows/production-heartbeat.yml Outdated
if: ${{ failure() }}
shell: bash
env:
SFDX_STATUS: ${{ steps.sfdx_install.outcome == 'success' }}

@jbartolotta-sfdc jbartolotta-sfdc Jul 23, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this output the steps.sfdx_install.outcome instead of converting to a boolean? That would provide more granularity on types of failures.

If we did this, we would want to change line 64 to be status: instead of succeeded:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The granularity won't necessarily increase, because the possible states are "success", "failure", "cancelled", and "skipped". Steps that don't execute because a previous step failed will get the status "skipped", which feels like a misnomer to me but whatever.
Still, good point that the status can be a string now. I'll make that change.

- name: Install SFDX
id: sfdx_install
# Sleep for 5 seconds between attempts, since it's possible that problems are network-related.
run: npm install -g sfdx-cli || (sleep 5 && npm install -g sfdx-cli) || (sleep 5 && npm install -g sfdx-cli)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would be good to increase the timeout on the second sleep.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. What if we did an increasing backoff strategy, where the first timeout was 600 seconds (10 minutes), and then the second was 1800 seconds (30 minutes)? Or something similar but with different numbers?

- name: Install Scanner Plugin
id: scanner_install
# Sleep for 5 seconds between attempts, since it's possible that problems are network-related.
run: sfdx plugins:install @salesforce/sfdx-scanner || (sleep 5 && sfdx plugins:install @salesforce/sfdx-scanner) || (sleep 5 && sfdx plugins:install @salesforce/sfdx-scanner)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's discuss at standup. I think we might want a different retry philosophy for code that we are directly testing versus code that we depend on.

call %EXE_NAME% scanner:rule:remove --path test\test-jars\apex\testjar1.jar --force || exit /b 1
echo "==== List the rules a final time, to make sure nothing broke ===="
call %EXE_NAME% scanner:rule:list || exit /b 1 No newline at end of file
call %EXE_NAME% scanner:rule:list || exit /b 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just curious, any idea why the newline changed? There is nothing obvious in the script that I could see.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did the edits to the smoke test scripts manually this time, because regenerating the files can mess with the permissions and I didn't want to deal with that for such a simple change. I think the IDE manually added the newline at the end. It does that sometimes.

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.

2 participants