Automattic / woocommerce-services

WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
GNU General Public License v2.0
105 stars 20 forks source link

Action workflow: Prevent "E2E port 8084 kill step" to break flow on exitcode 1 #2739

Closed kallehauge closed 1 month ago

kallehauge commented 1 month ago

Description

When trying to run our GitHub Action workflows locally via act, I get the following error which prevents the next step(s) from being executed.

[E2E Tests/Build Container and Run E2E Tests]   ❓  ::group::Kill webserver running on port 8084
[E2E Tests/Build Container and Run E2E Tests]   ❌  Failure - Main Kill process running on port 8084 to unblock it
[E2E Tests/Build Container and Run E2E Tests] exitcode '1': failure
[E2E Tests/Build Container and Run E2E Tests] 🏁  Job failed
Error: Job 'Build Container and Run E2E Tests' failed

Suggested changes

The issue is that fuser tries to kill anything that already runs on port 8084 (which we want to use for the website to run our E2E tests on). If nothing is running on that specific port, then we get exitcode: 1 back which just means "nothing to shut down".

TL;DR: Code 1 means that we're ready to proceed to next step since the port is available, so we need to update our bash code to accept "code 1" (we do this by catching code 1 and returning code 0), but still "throw" all other error codes to prevent false positives from our change.

fuser exit code meanings:

Related issue(s)

Steps to reproduce & screenshots/GIFs

Checklist

kallehauge commented 1 month ago

I'm merging the PR since our automated tests are still completing, and I'm getting ✅ Success - Main Kill process running on port 8084 to unblock it locally.