getlaminas.org icon indicating copy to clipboard operation
getlaminas.org copied to clipboard

Preview environments for maintainers

Open Xerkus opened this issue 1 year ago • 1 comments

Platform.sh provides a few development environments. It's GitHub integration can automatically create active development environments for Pull Requests, however it is not suitable for us for various reasons.

Instead we resort to a few static preview branches accessible at following URLs:

  • staging: https://staging-5em2ouy-2ja7ciew2nbkm.us-2.platformsh.site/
  • preview-1: https://preview-1-hy2vwsq-2ja7ciew2nbkm.us-2.platformsh.site/
  • preview-2: https://preview-2-7ovm55y-2ja7ciew2nbkm.us-2.platformsh.site/

staging branch is a default branch and a preview environment that does not allow force pushes. All changes must go there. master branch is a live site and it must only be pushed from staging branch and by Laminas people who have access to the platform.sh console.

preview-1 and preview-2 branches allow force pushes. Pull Requests should be force pushed to one of them if preview in a deployment environment is needed. GitHub cli tool is recommended for the convenient use of preview branches.

Quick setup instructions

Setup repository

Clone the repository:

gh repo clone laminas/getlaminas.org && cd getlaminas.org

Remote origin initially is pointing to laminas/getlaminas.org. It will change.

Tell gh to set laminas/getlaminas.org as a default repository for commands like gh pr list:

gh repo set-default

Now use gh to fork repository to your account and to update remotes: origin will be pointing to your fork while the existing origin pointing to laminas/getlaminas.org will be renamed to upstream :

gh repo fork --remote

Repository is now ready.

Push a PR to preview branch

Find a PR number or use gh to list opened PRs from the terminal:

gh pr list

Checkout the PR and push it to a preview branch:

gh pr checkout <pr number>
git push upstream --force HEAD:preview-1
or 
git push upstream --force HEAD:preview-2

Once platform synchronized the branch and finished the deployment it can be checked using the corresponding URL from above. This is a manual process. Repeat each time PR updates need to be checked in a preview environment.

Note that deployment status, build and runtime logs can only be checked by a Laminas member with access to platform.sh.

Xerkus avatar Sep 07 '24 15:09 Xerkus

So yeah, you noticed the issue when there are several PR's open and each one need feedback on a preview URL

arhimede avatar Sep 08 '24 18:09 arhimede