Want
an
AI
tool
for
automatic
design
reviews?
Learn
more

How to Get Previews for Every Pull Request Using Preevy + GitHub Actions + Google Cloud

How to Get Previews for Every Pull Request Using Preevy + GitHub Actions + Google Cloud

Context Switching Sucks

For software developers, context switching is a buzzkill. And context switching into past tasks is even worse.

Getting A DM from your PM that starts with “So, about the feature you worked on two weeks ago…” is never good news. It means not just pulling your head out of the code, and out of the flow - but out of the present, and into your past self. The person who designed “that feature”, and built it and tested it and fixed it, and knew all about its countless beautiful intricate details - your past self - is now two weeks gone. You’re going to have to conjure them, somehow. And you can expect extra work, because your past self was a moron who couldn’t code properly, and couldn’t document to save their life, and they built embarrassingly broken stuff which you have to fix right now.

But what if there was a way to get that message about the feature from two weeks ago, two weeks ago? If your past could get the feedback they need while they were still in context, your present self could keep their head in the code and in the flow.

Meet Livecycle - the fastest way for dev teams to collaborate

And this is where Livecycle comes in. We give developers tools to cut the feedback loop short. Livecycle enables you to share your work quickly and collect that precious feedback while you’re still in context.

At the heart of the Livecycle toolkit is Preevy - our open source tool that integrates into your CI pipeline to convert your pull requests into public or private preview environments, provisioned on your cloud provider or Kubernetes cluster.

These environments are shared with your team and they include our built-in commenting and collaboration tooling so that you can collect clear, actionable feedback.

Integrating Preevy into your CI pipeline is a great way to kick-start your review cycles as soon as the PR is ready, and avoid the buzzkill of delays and eventual context-switching.

The environments are collaborative by design, which democratizes the pull request and enables EVERYONE on the team (yes - even the less technical folks) to see the latest changes and comment on them as soon as they are ready for review.

(For the Docker for Desktop users among us, we’ve also built a Docker Desktop Extension so you can shift the review cycle even “farther left” and securely share your local containers while they are still on your machine. You can then push these local environments to the cloud for ongoing use/review as needed.)

How Preevy Works - The Birds Eye View

A quick peek under Preevy’s proverbial hood:

When running a CI build to create a preview environment for a Pull Request, the Preevy CLI provisions a cloud VM or a Kubernetes Pod on your provider, and in it runs a Docker Server which hosts your Docker Compose project containers.

The Preevy CLI also starts a companion container, the Preevy Agent, which creates a SSH connection to the Preevy Tunnel Server.

For every published port in your Docker Compose project, a SSH tunnel is created with its own HTTPS URL. When a HTTPS request arrives at the Tunnel Server, it gets routed to your specific service according to the hostname. If the service is defined as private, the Tunnel Server also handles authentication.

preevy architecture

To keep things simple in summary - once set up, Preevy will :

  • Provision an environment with the PR content to your cloud account
  • Share a comment with the URLs to access the environment on the PR so that other team members can begin reviewing the latest changes

Links to envs

Adding Preevy to your Pull/Merge Request Workflow

So now that you’re sufficiently convinced that PR previews are the way to go to streamline your workflows, you just need to get started. Since we designed Preevy to be flexible and easy to set up, without requiring any deep DevOps knowledge, you can make it happen in just a few steps.

We offer a wide range of support across cloud/storage providers (such as AWS, Google cloud, Microsoft Azure and Kubernetes) and CI/CD tools (such as GH Actions and Circle CI and more), so your specific setup will be one of many possible combinations.

As much as we love our docs, we’ve put together a few real-life examples, like this repo that shos you how to use Preevy + GitHub Actions + Google Cloud. It demonstrates deploying a Preevy environment per pull request and shows integration with GitHub deployments and environments.

Check out the Preevy + GitHub Actions + Google Cloud example repo here.

Conclusion

Hopefully this context and our example repo will help you to easily add preview environments to your own PR workflow.

If you have any further questions about how to get the most out of Preevy, we invite you to:

Livecycle

Livecycle

December 25, 2023