Skip to content

[$250] Race condition with the CP Staging label #7284

@roryabraham

Description

@roryabraham

Coming from #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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ImprovementItem broken or needs improvement.InternalRequires API changes or must be handled by Expensify staffReviewingHas a PR in review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions