Early AccessPrebuilds are currently in early access. If you’re interested in trying this feature, please contact us.
Prerequisites
- Organization administrator permissions
- An existing project with at least one environment class configured
- Prebuilds feature enabled for your organization (contact us for early access)
- AWS Enterprise runner or Ona Cloud (GCP support coming soon)
Enabling Prebuilds
1. Navigate to Project Settings
- Go to your organization dashboard at https://app.gitpod.io
- Select your project from the projects list
- Click on the project to open its settings
2. Configure Prebuild Settings
In the project settings, you’ll find the prebuild configuration section where you can:- Enable prebuilds for the project
- Select environment classes for which prebuilds should be created
- Configure the schedule for automatic prebuild creation
- Set timeout for prebuild execution (only configurable through the CLI right now)
- The daily schedule stops running
- New environments will no longer use existing prebuild snapshots
- Existing prebuild snapshots remain until they expire (7 days)
3. Select Environment Classes
Choose which environment classes should have prebuilds created:- Check the boxes next to the environment classes you want to prebuild
- Prebuilds will be created for each selected class on the configured schedule
- Consider your team’s usage patterns when selecting classes
4. Configure the Schedule
Set up when prebuilds should run automatically:- Daily schedule: Choose the hour (UTC) when prebuilds should trigger
- Recommended timing: Schedule prebuilds during off-hours (e.g., 2 AM UTC) so fresh prebuilds are ready when your team starts work
5. Set Timeout (Via CLI)
Configure how long prebuilds can run before timing out using the Gitpod CLI:- Default: 1 hour
- Minimum: 5 minutes
- Maximum: 2 hours
Configuring Your Dev Container for Prebuilds
To get the most out of prebuilds, structure your Dev Container configuration appropriately:Commands That Run During Prebuilds
Place time-consuming setup tasks in these lifecycle hooks:Commands That Run After Prebuilds
Place user-specific or session-specific commands here:Configuring Automations for Prebuilds
You can also configure automation tasks to run during prebuilds by adding theprebuild trigger:
prebuild trigger will execute during prebuild creation, alongside your Dev Container lifecycle commands.
Note: Organization and project secrets are available to automation tasks during prebuilds, but user secrets are not. Ensure any credentials needed for prebuild tasks are configured at the organization or project level.
Manually Triggering a Prebuild
In addition to scheduled prebuilds, you can manually trigger prebuilds:Via Web UI
- Navigate to your project settings
- Click the Prebuild button in the top right corner
- Testing prebuild configuration changes
- Creating a fresh prebuild after significant code changes
- Preparing prebuilds before scheduled time
Via CLI
You can also trigger prebuilds for specific environment classes using the CLI:Verifying Your Setup
After enabling prebuilds, test your configuration to ensure everything works correctly:- Trigger a manual prebuild to verify it completes successfully
- Check the prebuild logs for any errors or warnings
- Create a new environment and confirm it starts from the prebuild
- Verify the schedule is set correctly for your timezone
Best Practices
Optimizing for Speed and Cost
Only install dependencies necessary for development. Schedule prebuilds during off-hours (e.g., 2 AM UTC) so fresh prebuilds are ready when your team starts work. Start by enabling prebuilds for one or two commonly used environment classes, then expand based on usage patterns and cost considerations.Structuring Your Commands
Place stable, time-consuming operations in prebuild commands: dependency installation, database seeding, and asset downloads. ReservepostCreateCommand for dynamic operations like starting dev servers or user-specific setup. Ensure all commands are idempotent so they can run multiple times safely.
Managing Secrets
Use organization secrets for shared credentials needed during builds, and project secrets for project-specific credentials. Remember that user secrets aren’t available during prebuilds, so ensure any required credentials are configured at the organization or project level.Troubleshooting Common Issues
Prebuild fails to complete: Check logs for error messages, verify secrets are configured correctly, and ensure commands don’t require user interaction. If builds consistently timeout, increase the timeout using the CLI. Environment doesn’t use prebuild: Verify a successful prebuild exists for the environment class, check it’s less than 7 days old, and ensure the environment class matches exactly. Prebuild succeeds but environment has issues: Some commands may need to run per-environment rather than in the prebuild. Move user-specific or session-specific commands topostCreateCommand, and verify file permissions are correct after the snapshot.
For more detailed troubleshooting guidance, see Managing Prebuilds.