laravel-harbor
laravel-harbor copied to clipboard
Teardown shows 'FAIL ---> Site not found.', but the site exists
I noticed that there are undeleted preview sites in Forge. Immediately checking the execution logs of Actions shows: FAIL ---> Site not found.
preview-teardown.yml
:
name: preview-teardown
on:
pull_request:
branches: [dev]
types: [closed]
jobs:
harbor-teardown:
if: |
github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: kirschbaumdevelopment/laravel-test-runner:8.1
steps:
- name: Set FORGE_SUBDOMAIN_PATTERN if head_ref starts with 't'
if: startsWith(github.head_ref, 't')
run: echo "FORGE_SUBDOMAIN_PATTERN=/^(t\d{3,8})-(?:.*-.*)/i" >> $GITHUB_ENV
- name: Install Harbor
run: composer global require mehrancodes/laravel-harbor -q
- name: Start Teardown Preview Site
env:
FORGE_TOKEN: ${{ secrets.FORGE_API_TOKEN }}
FORGE_SERVER: ${{ secrets.FORGE_DEV_SERVER_ID }}
FORGE_GIT_REPOSITORY: ${{ github.repository }}
FORGE_GIT_BRANCH: ${{ github.head_ref }}
FORGE_DOMAIN: domain.com
run: |
harbor teardown
Please note that my laravel-harbor uses
FORGE_SUBDOMAIN_PATTERN
to determine the subdomain style based on the branch name:
- It prioritizes matching branch names like "t12345-a-b-c-d", and the domain will be: t12345.domain.com
- If the above branch name is not found, it directly uses the branch name as the domain: branch-name.domain.com
In the :Start Teardown Preview Site
step, when printing the environment variables, FORGE_SUBDOMAIN_PATTERN appears, indicating that the condition in the above step: Set FORGE_SUBDOMAIN_PATTERN if head_ref starts with 't'
is met. Therefore, a FORGE_SUBDOMAIN_PATTERN is inserted into GitHub's environment variables to ensure the correct subdomain can be found during the teardown phase.
So I simulated the content of this Pull Request locally and executed it using theact
tool. Surprisingly, it executed successfully!
I'm not sure if this is a bug related to the subdomain?