App: [$250] Race condition with the CP Staging label

Coming from https://github.com/Expensify/App/pull/7255

Problem

There exists a race condition when the CP Staging is applied to a pull request after it’s merged. Both of the following are possible:

  1. When the merged pull request is fetched here, it already has the CP Staging label, and is deployed to staging.
  2. When the merged pull request is fetched in the location listed above, it does not have the CP Staging label, and is not deployed to staging.

In both scenarios, a comment that looks like this will be left on the pull request:

image

Why this is important

In the second scenario, this is confusing because the expected behavior/whether or not the pull request was CP’d to staging is unclear.

Solution

Update the warnCPLabel.yml workflow to tailor its comment based on whether or not the CP Staging label was applied to the pull request when it was already merged.

  • If the pull request not yet merged, keep the same comment.
  • If the pull request is already merged, use the following comment:
    1. Find the preDeploy.yml workflow run for the pull request.

    2. List jobs for that workflow run and find the skipDeploy job.

    3. If the conclusion of that job is not resolved, poll the API until it is resolved.

    4. If the conclusion is success or something else, use the following comment:


      ⚠️ Heads up! ⚠️ Since the CP Staging label was applied after this PR was merged, it was not CP’d to staging. If you need it to be deployed to staging, tag a member of @Expensify/mobile-deployers to CP it manually.


    5. If the conclusion is skipped, use the following comment:


      ⚠️ Heads up! ⚠️ The CP Staging label was applied after the PR was merged. This leads to unpredictable behavior. In this case this PR will be deployed to staging, but to guarantee this in the future be sure to apply the CP Staging before merging the pull request.


Upwork Automation - Do Not Edit

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 29 (17 by maintainers)

Most upvoted comments

@cead22 taking this internal given the age of the issue as discussed here. Please try to move this forward with urgency so that we can get WAQ done!

@mollfpr sorry for the confusion. This should be Internal.