Configuring Preview Environments
There are two ways to configure Preview Environments using Okteto Cloud for your GitHub repositories. This page will be covering the easier of the two methods, that is, using the Okteto Cloud Dashboard. If you want more control and configuration options for your Preview Environments, GitHub Actions are the way to go. Before proceeding with the steps here, please ensure you've gone through the Prerequisites section.
Note that this method is not applicable for users of Okteto Self-Hosted or Okteto for Teams. Please checkout GitHub Actions for configuring Preview Environments in those cases.
Step 1: Log into Okteto Cloud
The first step is going to Okteto Cloud and logging in. Once you log in, head over to the Preview Environments section using the sidebar menu.
In this guide, we will set up Preview Environments for a fork of the movies-preview-environments repository. Head to that repository and create a fork of it under your GitHub account. Feel free to follow along with some other repository in your GitHub account once you've configured it.
Step 2: Add Your Repository
Click on the "Add a repository" button on the dashboard. If you're doing this for the first time, you'll have to install and authorize Okteto Cloud on the GitHub organization/account having the repository you want to configure the Preview Environments for. You can read more about what permissions Okteto Cloud requests and why over here.
Please note that you can only install Okteto Cloud for repositories belonging to your own GitHub account. Only org admins can install Okteto Cloud in the case of repositories part of a GitHub organization. Non-admin users will have the option of sending a request to install Okteto Cloud to admins through GitHub.
Once you do that, you should see your repository appear in the list.
Select it and click the "Add" button. Additionally, you can also configure variables to configure your preview environment. These variables work just like the built-in environment variables.
Step 3: Make a Pull Request
That's right, this was all the configuration you needed to do! Head over to your repository now and make a pull request. After you make a pull request, Okteto will add the application endpoints to it as a comment once the Preview Environment has been deployed.
Sharing this with team members is the best way to get their attention for reviews 😛
You should also be able to see the pull request details along with the endpoints on the Okteto Cloud Dashboard.
You've successfully configured Preview Environments for your GitHub repository and witnessed the magic of Okteto. However, this is only a part of what Okteto can do for your team's development workflow. You can take the next step towards enhancing your dev experience by looking at Okteto's Development Environments.