### WarpBuild Build Push Action Workflow Example Source: https://www.warpbuild.com/docs/ci/docker-builders Example GitHub Actions workflow demonstrating the use of `Warpbuilds/build-push-action`. This configuration is suitable for both WarpBuild Runners and non-WarpBuild Runners, with an optional API key and timeout setting. ```yaml jobs: build: runs-on: warp-ubuntu-latest-x64-4x steps: - uses: actions/checkout@v3 - name: Build and push uses: Warpbuilds/build-push-action@v6 with: context: . push: true tags: user/app:latest profile-name: "super-fast-builder" api-key: ${{ secrets.WARPBUILD_API_KEY }} # Not required for WarpBuild Runners timeout: 600000 # The timeout(in ms) to wait for the Docker Builders to be ready. By default, it is 10 minutes ``` -------------------------------- ### WarpBuild Bake Action Workflow Example Source: https://www.warpbuild.com/docs/ci/docker-builders Example GitHub Actions workflow using `Warpbuilds/bake-action`. This setup supports both WarpBuild and non-WarpBuild Runners, includes an optional API key, and allows for a custom timeout. ```yaml jobs: build: runs-on: warp-ubuntu-latest-x64-4x steps: - uses: actions/checkout@v3 - name: Bake uses: Warpbuilds/bake-action@v6 with: context: . push: true set: | *.tags=user/app:latest profile-name: "super-fast-builder" api-key: ${{ secrets.WARPBUILD_API_KEY }} # Not required for WarpBuild Runners timeout: 600000 # The timeout(in ms) to wait for the Docker Builders to be ready. By default, it is 10 minutes ``` -------------------------------- ### Docker Build Push Action with Cache Options Source: https://www.warpbuild.com/docs/ci/docker-builders Example demonstrating the use of cache-from and cache-to options with the docker/build-push-action, specifying a custom cache URL. ```yaml - name: Older Docker WarpCache Backend - uses: docker/build-push-action@v6 - with: - context: . - push: false - tags: "alpine/warpcache:latest" - cache-from: type=gha,url=http://127.0.0.1:49160/ - cache-to: type=gha,url=http://127.0.0.1:49160/,mode=max + name: New WarpBuild Docker Builders + uses: Warpbuilds/docker-configure@v1 + with: + profile-name: "super-fast-builder" + name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: false + tags: "alpine/warpcache:latest" ``` -------------------------------- ### Install aria2 on Windows Source: https://www.warpbuild.com/docs/ci/byoc/custom-vm-images This script installs the aria2 download utility on a Windows machine. It downloads the latest release, extracts it, adds it to the system PATH, and cleans up temporary files. Ensure aria2 is accessible via the system PATH for faster artifact downloads. ```powershell New-Item -ItemType Directory -Path 'C:\Tools\aria2' -Force # Use: https://github.com/aria2/aria2/releases/latest to fetch the latest release and replace it Invoke-WebRequest -Uri 'https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip' -OutFile 'C:\Tools\aria2\aria2.zip' Expand-Archive -Path 'C:\Tools\aria2\aria2.zip' -DestinationPath 'C:\Tools\aria2' -Force Remove-Item 'C:\Tools\aria2\aria2.zip' -Force Move-Item -Path 'C:\Tools\aria2\aria2-1.37.0-win-64bit-build1\*' -Destination 'C:\Tools\aria2' -Force Remove-Item -Path 'C:\Tools\aria2\aria2-1.37.0-win-64bit-build1' -Recurse -Force [Environment]::SetEnvironmentVariable('Path', $Env:Path + ';C:\Tools\aria2', 'Machine') ``` -------------------------------- ### Combining Networking Addon with Snapshot Runners Source: https://www.warpbuild.com/docs/ci/features/networking This example shows how to combine the networking addon with snapshot functionality in a single `runs-on` label. This allows runners to both connect to Tailscale and utilize snapshot restore or creation. ```yaml jobs: build: # Network addon + snapshot restore runs-on: warp-ubuntu-latest-x64-4x;network.name=production-tailnet;snapshot.key=my-key test: # Network addon + snapshot create runs-on: warp-ubuntu-latest-x64-4x;network.name=production-tailnet;snapshot.enabled=true ``` -------------------------------- ### Create a runner Source: https://www.warpbuild.com/docs/ci/api-keys/automation Creates a new runner with specified configurations. This includes details like the runner's name, provider ID, and advanced configuration for BYOC (Bring Your Own Cloud) setups. ```APIDOC ## POST /api/v1/runners ### Description Creates a new runner with specified configurations. This includes details like the runner's name, provider ID, and advanced configuration for BYOC (Bring Your Own Cloud) setups. ### Method POST ### Endpoint /api/v1/runners ### Parameters #### Request Body - **name** (string) - Required - Name of the runner must be lowercase alphabets with hyphen as additional characters. - **provider_id** (string) - Required - Stack id of the runner. - **pool_size** (integer) - Optional - **configuration.image** (string) - Required - The image id from the runner images API. - **configuration.byoc_sku.role_arn** (string) - Optional - The instance role of the runner. - **configuration.byoc_sku.instance_types** (array) - Required - List of instance/machine types that are to be used when launching the runner. Make sure you provide a valid list here. For a list of valid image types it is recommended to use the UI. - **configuration.capacity_type** (string) - Optional - **configuration.sku** (string) - Optional - **configuration.storage.disk_type** (string) - Optional - **configuration.storage.tier** (string) - Optional - **configuration.storage.performance_tier** (string) - Optional - **configuration.storage.size** (integer) - Optional - **configuration.storage.throughput** (integer) - Optional - **configuration.storage.iops** (integer) - Optional - **configuration.byoc_sku.is_public** (boolean) - Optional - **configuration.byoc_sku.arch** (string) - Optional - **configuration.byoc_sku.network_tier** (string) - Optional ### Request Example ```json { "name": "warpdev-custom-example-2", "provider_id": "wrslzvbl322yttsc", "pool_size": 2, "configuration": { "capacity_type": "ondemand", "image": "wjwnpdjox8xeqsza", "sku": "", "storage": { "disk_type": "", "tier": "custom", "performance_tier": "", "size": 150, "throughput": 400, "iops": 6000 }, "byoc_sku": { "instance_types": ["c3.large", "c1.xlarge"], "is_public": true, "arch": "x64", "role_arn": "", "network_tier": "STANDARD" } } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the created runner. - **created_at** (string) - Timestamp when the runner was created. - **updated_at** (string) - Timestamp when the runner was last updated. - **name** (string) - The name of the runner. - **vcs_integration_id** (string) - The ID of the VCS integration associated with the runner. - **configuration** (object) - The configuration details of the runner. - **stock_runner_id** (string) - The ID of the stock runner, if applicable. - **organization_id** (string) - The ID of the organization the runner belongs to. - **labels** (array) - A list of labels associated with the runner. - **active** (boolean) - Indicates if the runner is currently active. - **provider_id** (string) - The provider ID of the runner. - **meta** (object) - Additional metadata about the runner. #### Response Example ```json { "id": "", "created_at": "2025-09-25T08:38:01.495654Z", "updated_at": "2025-09-25T08:38:01.495654Z", "name": "warpdev-custom-example-2", "vcs_integration_id": "", "configuration": { "sku": "", "byoc_sku": { "role_arn": "", "arch": "x64", "is_public": true, "instance_types": [ "c3.large", "c1.xlarge" ], "network_tier": "" }, "storage": { "tier": "custom", "size": 150, "iops": 5000, "throughput": 400, "disk_type": "", "performance_tier": "" }, "image": "wjwnpdjox8xeqsza", "capacity_type": "ondemand" }, "stock_runner_id": null, "organization_id": "", "labels": [ "warpdev-custom-example-2" ], "active": true, "provider_id": "wrslzvbl322yttsc", "meta": { "supports_snapshot": false } } ``` ``` -------------------------------- ### Running WarpBuild Cache Action in a Docker Container Source: https://www.warpbuild.com/docs/ci/features/caching This example shows how to configure a Docker container to use the WarpBuild cache action by passing the necessary verification token as an environment variable. ```yaml test-proxy-save: runs-on: warp-ubuntu-latest-x64-16x container: image: ubuntu:latest env: WARPBUILD_RUNNER_VERIFICATION_TOKEN: ${{ env.WARPBUILD_RUNNER_VERIFICATION_TOKEN }} ``` -------------------------------- ### Restore and Save Cache with Separate Actions Source: https://www.warpbuild.com/docs/ci/features/caching This example shows how to use separate WarpBuilds/cache/restore@v1 and WarpBuilds/cache/save@v1 actions for more granular control over cache operations. It uses 'restore-keys' for stale cache and a primary key for saving. ```yaml name: Caching Primes on: push jobs: build: runs-on: warp-ubuntu-latest-x64-4x steps: - uses: actions/checkout@v3 - name: Restore Cache Primes id: cache-primes-restore uses: WarpBuilds/cache/restore@v1 with: path: | path/to/dependencies some/other/dependencies key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - name: Install Dependencies if: steps.cache-primes-restore.outputs.cache-hit != 'true' run: /install.sh - name: Save Cache Primes id: cache-primes-save uses: WarpBuilds/cache/save@v1 with: path: | path/to/dependencies some/other/dependencies key: ${{ steps.cache-primes-restore.outputs.cache-primary-key }} ``` -------------------------------- ### Setup Interactive SSH Session on Failure Source: https://www.warpbuild.com/docs/ci/tools/action-debugger This configuration pauses the workflow execution and initiates an SSH session only when a previous step fails. ```yaml name: CI on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup interactive ssh session if: ${{ failure() }} uses: Warpbuilds/action-debugger@v1.3 ``` -------------------------------- ### Setup Interactive SSH Session with Custom Timeout Source: https://www.warpbuild.com/docs/ci/tools/action-debugger Sets up an interactive SSH session with a specified timeout of 15 minutes to automatically close the session and prevent unexpected costs. ```yaml name: CI on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup interactive ssh session uses: Warpbuilds/action-debugger@v1.3 timeout-minutes: 15 ``` -------------------------------- ### Create Runner API Call Source: https://www.warpbuild.com/docs/ci/api-keys/automation Example cURL command to create a new runner using the defined JSON configuration. Ensure the authorization token and content type are correctly set. ```bash curl -X POST 'https://api.warpbuild.com/api/v1/runners' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer wkey-xxxx' \ -H 'Content-Type: application/json' \ -d @create-runner.json ``` -------------------------------- ### Setup Interactive SSH Session with Access Control Source: https://www.warpbuild.com/docs/ci/tools/action-debugger This snippet sets up an interactive SSH session for debugging and limits access to the GitHub actor who triggered the action. ```yaml name: CI on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup interactive ssh session uses: Warpbuilds/action-debugger@v1.3 with: limit-access-to-actor: true ``` -------------------------------- ### GitHub Actions Workflow for Building AMI Source: https://www.warpbuild.com/docs/ci/byoc/custom-vm-images This workflow automates the process of building an Amazon Machine Image (AMI) using Packer. It checks out the repository, configures AWS credentials, sets up Packer, installs necessary plugins, validates the Packer template, and finally builds the AMI. ```yaml on: workflow_dispatch: push: branches: - main paths: - "packer/github-actions-ami/**" permissions: contents: read jobs: build-ami: runs-on: warp-ubuntu-2404-x64-4x steps: - name: Checkout repository uses: actions/checkout@v4 - name: Check execution user run: | echo "Workflow is running as user: $(whoami)" echo "User groups: $(groups)" echo "Home directory: $HOME" - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::ACCOUNT_ID:role/YOUR_ROLE_NAME role-session-name: GitHubAction-BuildCIAMI aws-region: us-east-1 - name: Set up Packer uses: hashicorp/setup-packer@v3 with: version: 1 - name: Install Packer plugins run: packer plugins install github.com/hashicorp/amazon - name: Validate Packer template run: packer validate packer/github-actions-ami/my-custom-ci.pkr.hcl - name: Build AMI with Packer run: packer build packer/github-actions-ami/my-custom-ci.pkr.hcl env: AWS_REGION: us-east-1 ``` -------------------------------- ### Define Tailscale ACL Tags Source: https://www.warpbuild.com/docs/ci/features/networking Example of a Tailscale ACL policy file defining tag owners and access rules for a CI environment. ```json { "tagOwners": { "tag:ci": ["autogroup:admin"] }, "acls": [ { "action": "accept", "src": ["tag:ci"], "dst": ["tag:internal-api:443"] } ] } ``` -------------------------------- ### CI Workflow with Custom Runner Source: https://www.warpbuild.com/docs/ci/byoc This example shows how to reference a custom runner ID in a GitHub Actions workflow file. Ensure the 'warp-custom-' prefix is included. ```yaml name: CI on: [push] jobs: build: # Use the full Runner ID (the "warp-custom-" prefix is required) runs-on: warp-custom-ci-stack-runner steps: - uses: actions/checkout@v3 - run: npm run build ``` -------------------------------- ### Restore and Save Cache with Single Action Source: https://www.warpbuild.com/docs/ci/features/caching This example demonstrates how to restore and save cache using a single WarpBuilds/cache@v1 action. It utilizes the 'cache-hit' output to conditionally run subsequent steps. ```yaml name: Caching Primes on: push jobs: build: runs-on: warp-ubuntu-latest-x64-4x steps: - uses: actions/checkout@v3 - name: Cache Primes id: cache-primes uses: WarpBuilds/cache@v1 with: path: prime-numbers key: ${{ runner.os }}-primes - name: Generate Prime Numbers if: steps.cache-primes.outputs.cache-hit != 'true' run: /generate-primes.sh -d prime-numbers - name: Use Prime Numbers run: /primes.sh -d prime-numbers ``` -------------------------------- ### Using an API Key with curl Source: https://www.warpbuild.com/docs/ci/api-keys Include the generated API key in the `Authorization` header when making requests to WarpBuild endpoints. This example shows how to fetch builder profiles. ```bash curl -X GET "https://api.warpbuild.com/api/v1/builder-profiles?page=1&per_page=20&name=test" \ -H "Authorization: Bearer " ``` -------------------------------- ### Configure Docker Build Push Action for WarpBuild Cache Source: https://www.warpbuild.com/docs/ci/features/caching This example shows how to configure the Docker Build Push Action to use WarpBuild Cache for Docker layer caching. It sets the `cache-from` and `cache-to` fields with the correct URL and type. ```yaml - name: Docker WarpCache Backend uses: docker/build-push-action@v6 with: context: . push: false tags: "alpine/warpcache:latest" cache-from: type=gha,url=http://127.0.0.1:49160/,version=1 cache-to: type=gha,url=http://127.0.0.1:49160/,mode=max,version=1 ``` -------------------------------- ### WarpBuild Cache Action Usage Source: https://www.warpbuild.com/docs/ci/features/caching Example of using the WarpBuilds/cache action to cache dependencies. It specifies the path to cache and constructs a cache key using runner OS, date output, and hashed lock files. ```yaml - uses: WarpBuilds/cache@v1 with: path: path/to/dependencies key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }} ``` -------------------------------- ### Setup Deterministic SSH URL with Named Session Source: https://www.warpbuild.com/docs/ci/tools/action-debugger Configures Action-Debugger to use a named session and API key for deterministic SSH URLs, ensuring the URL remains consistent across action runs. Requires `limit-access-to-actor` to be true. ```yaml name: CI on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup interactive ssh session uses: Warpbuilds/action-debugger@v1.3 with: limit-access-to-actor: true named-session-name: random-string-2345ab named-session-api-key: ``` -------------------------------- ### Replace actions/setup-go with WarpBuilds/setup-go Source: https://www.warpbuild.com/docs/ci/features/caching Illustrates upgrading from actions/setup-go to WarpBuilds/setup-go to utilize WarpBuild Cache for Go toolchain and dependency caching. ```yaml - uses: actions/setup-go@v5 + uses: WarpBuilds/setup-go@v6 with: go-version: '1.22' cache: true ``` -------------------------------- ### Get Date for Cache Key Source: https://www.warpbuild.com/docs/ci/features/caching This snippet demonstrates how to get the current UTC date in YYYYMMDD format and output it to a GitHub Actions output variable. This is commonly used to create unique cache keys. ```bash - name: Get Date id: get-date run: | echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT shell: bash ``` -------------------------------- ### Replace actions/setup-dotnet with WarpBuilds/setup-dotnet Source: https://www.warpbuild.com/docs/ci/features/caching Demonstrates switching from actions/setup-dotnet to WarpBuilds/setup-dotnet to enable WarpBuild Cache for .NET toolchain and NuGet package caching. ```yaml - uses: actions/setup-dotnet@v4 + uses: WarpBuilds/setup-dotnet@v4 with: dotnet-version: '8.0' cache: true cache-dependency-path: '**/packages.lock.json' ``` -------------------------------- ### Replace actions/setup-python with WarpBuilds/setup-python Source: https://www.warpbuild.com/docs/ci/features/caching Shows how to switch from actions/setup-python to WarpBuilds/setup-python for transparent caching of Python toolchain and pip dependencies using WarpBuild Cache. ```yaml - uses: actions/setup-python@v5 + uses: WarpBuilds/setup-python@v6 with: python-version: '3.12' cache: pip ``` -------------------------------- ### Replace actions/setup-node with WarpBuilds/setup-node Source: https://www.warpbuild.com/docs/ci/features/caching Demonstrates replacing the standard GitHub Actions setup-node action with WarpBuilds/setup-node to leverage WarpBuild Cache for Node.js toolchain and npm dependency caching. ```yaml - uses: actions/setup-node@v4 + uses: WarpBuilds/setup-node@v6 with: node-version: 20 cache: npm ``` -------------------------------- ### Get a runner Source: https://www.warpbuild.com/docs/ci/api-keys/automation Returns a single runner based on its id. ```APIDOC ## GET /api/v1/runners/{runner-id} ### Description Returns a single runner based on its id. ### Method GET ### Endpoint /api/v1/runners/{runner-id} ### Parameters #### Path Parameters - **runner-id** (string) - Required - The id for the runner. ### Response #### Success Response (200) - **runner** (object) - The runner object. The object structure is the same as the create endpoint. ### Request Example ```http GET https://api.warpbuild.com/api/v1/runners/runner-id-1 Accept: application/json Authorization: Bearer wkey-xxxx ``` ### Response Example ```json { "id": "runner-id-1", "name": "runner-1", "status": "online", "image_id": "wjwnpdjox8xeqsza" } ``` ``` -------------------------------- ### Get all stacks Source: https://www.warpbuild.com/docs/ci/api-keys/automation Retrieves a list of all available stacks, optionally filtered by kind. ```APIDOC ## GET /api/v1/stacks ### Description Retrieves a list of all available stacks, optionally filtered by kind. ### Method GET ### Endpoint /api/v1/stacks ### Parameters #### Query Parameters - **kind** (string) - Optional - Filter stacks by kind (e.g., 'ec2'). ### Response #### Success Response (200) - **stacks** (array) - A list of stack objects. - **id** (string) - The unique identifier for the stack. - **kind** (string) - The type of stack (e.g., 'ec2'). - **name** (string) - The name of the stack. ### Request Example ```http GET https://api.warpbuild.com/api/v1/stacks?kind=ec2 Accept: application/json Authorization: Bearer wkey-xxxx ``` ### Response Example ```json { "stacks": [ { "id": "wxxxxxx", "kind": "ec2", "name": "My EC2 Stack" } ] } ``` ``` -------------------------------- ### Replace actions/setup-java with WarpBuilds/setup-java Source: https://www.warpbuild.com/docs/ci/features/caching This snippet shows the transition from actions/setup-java to WarpBuilds/setup-java, enabling WarpBuild Cache for Java toolchain and Maven dependency caching. ```yaml - uses: actions/setup-java@v4 + uses: WarpBuilds/setup-java@v5 with: distribution: temurin java-version: '21' cache: maven ``` -------------------------------- ### Get Runner by ID Source: https://www.warpbuild.com/docs/ci/api-keys/automation Retrieves a single runner based on its unique ID. ```curl curl -X GET 'https://api.warpbuild.com/api/v1/runners/' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer wkey-xxxx' ``` -------------------------------- ### Replace goto-bus-stop/setup-zig with WarpBuilds/setup-zig Source: https://www.warpbuild.com/docs/ci/features/caching Illustrates the change from goto-bus-stop/setup-zig to WarpBuilds/setup-zig, allowing WarpBuild Cache to be used for Zig toolchain caching. ```yaml - uses: goto-bus-stop/setup-zig@v2 + uses: WarpBuilds/setup-zig@v2 with: version: 0.13.0 ``` -------------------------------- ### Get All Stacks Source: https://www.warpbuild.com/docs/ci/api-keys/automation Retrieves a list of all available stacks, optionally filtered by kind. ```curl curl -X GET 'https://api.warpbuild.com/api/v1/stacks?kind=ec2' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer wkey-xxxx' ``` -------------------------------- ### Get all runner images Source: https://www.warpbuild.com/docs/ci/api-keys/automation Retrieves a list of all runner images, with optional filtering parameters. ```APIDOC ## GET /api/v1/runner-images ### Description Retrieves a list of all runner images. The `alias` parameter is optional. It is recommended to use the other search parameters (type, page, per_page) to filter the results. ### Method GET ### Endpoint /api/v1/runner-images ### Parameters #### Query Parameters - **alias** (string) - Optional - Filter runner images by alias. - **type** (string) - Optional - Filter runner images by type (e.g., 'byoc_ami'). - **page** (integer) - Optional - The page number for pagination. - **per_page** (integer) - Optional - The number of items per page. ### Response #### Success Response (200) - **runner_images** (array) - A list of runner image objects. - **id** (string) - The unique identifier for the runner image. - **alias** (string) - The alias of the runner image. - **type** (string) - The type of the runner image. - **created_at** (string) - The timestamp when the runner image was created. ### Request Example ```http GET https://api.warpbuild.com/api/v1/runner-images?alias=&type=byoc_ami&page=1&per_page=10 Accept: application/json Authorization: Bearer wkey-xxxx ``` ### Response Example ```json { "runner_images": [ { "id": "wjwnpdjox8xeqsza", "alias": "my-custom-image", "type": "byoc_ami", "created_at": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### Get All Runner Images Source: https://www.warpbuild.com/docs/ci/api-keys/automation Retrieves a list of all runner images. Supports filtering by alias, type, and pagination. ```curl curl -X GET 'https://api.warpbuild.com/api/v1/runner-images?alias=&type=byoc_ami&page=1&per_page=10' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer wkey-xxxx' ``` -------------------------------- ### Replace ruby/setup-ruby with WarpBuilds/setup-ruby Source: https://www.warpbuild.com/docs/ci/features/caching Shows the replacement of ruby/setup-ruby with WarpBuilds/setup-ruby to integrate WarpBuild Cache for Ruby toolchain and Bundler dependency caching. ```yaml - uses: ruby/setup-ruby@v1 + uses: WarpBuilds/setup-ruby@v1.295.0 with: ruby-version: '3.3' bundler-cache: true ``` -------------------------------- ### Create a Service Account Source: https://www.warpbuild.com/docs/ci/byoc/gcp/service-account Creates a new service account named 'instance-sa' with a display name 'Instance Service Account'. This service account will be attached to GCE runners. ```bash gcloud iam service-accounts create "instance-sa" \ --display-name="Instance Service Account" \ ``` -------------------------------- ### Delete Runner API Call Source: https://www.warpbuild.com/docs/ci/api-keys/automation Example cURL command to delete an existing runner. This action is irreversible and requires the runner's ID. ```bash curl -X DELETE 'https://api.warpbuild.com/api/v1/runners/' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer wkey-xxxx' ``` -------------------------------- ### Create Cache Key with HashFiles Source: https://www.warpbuild.com/docs/ci/features/caching This snippet demonstrates creating a cache key using the `hashFiles` function to generate a new cache when dependency lock files change. ```yaml - uses: WarpBuilds/cache@v1 with: path: | path/to/dependencies some/other/dependencies key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} ``` -------------------------------- ### Create BYOC Runner Image Source: https://www.warpbuild.com/docs/ci/api-keys/automation Creates a new Bring Your Own Cloud (BYOC) runner image. Requires stack_id from the GET /api/v1/stacks endpoint. ```curl curl -X POST 'https://api.warpbuild.com/api/v1/runner-images' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer wkey-xxxx' \ -d @create-runner-image.json ``` ```json { "alias": "test1", "os": "linux", "arch": "x64", "stack_id": "wxxxxxx", "type": "byoc_ami", "warpbuild_image": { "image_uri": "ami-xxxxxx", "cloud_init_template": "" }, "settings": { "purge_image_versions_offset": 1 }, "byoc_ami": { "ami_id": "ami-xxxxxx", "root_device_name": "/dev/sda1" } } ``` -------------------------------- ### Create a new BYOC runner image Source: https://www.warpbuild.com/docs/ci/api-keys/automation Creates a new BYOC (Bring Your Own Cloud) runner image. You can fetch the `stack_id` from the `GET /api/v1/stacks` endpoint. ```APIDOC ## POST /api/v1/runner-images ### Description Creates a new BYOC (Bring Your Own Cloud) runner image. You can fetch the `stack_id` from the `GET /api/v1/stacks` endpoint. ### Method POST ### Endpoint /api/v1/runner-images ### Parameters #### Request Body - **alias** (string) - Required - The alias for the runner image. - **os** (string) - Required - The operating system of the runner image (e.g., 'linux'). - **arch** (string) - Required - The architecture of the runner image (e.g., 'x64'). - **stack_id** (string) - Required - The ID of the stack to associate with this runner image. - **type** (string) - Required - The type of the runner image (e.g., 'byoc_ami'). - **warpbuild_image** (object) - Optional - WarpBuild specific image details. - **image_uri** (string) - Required if `warpbuild_image` is present - The URI of the WarpBuild image. - **cloud_init_template** (string) - Optional - Cloud-init template for the WarpBuild image. - **settings** (object) - Optional - Settings for the runner image. - **purge_image_versions_offset** (integer) - Optional - Offset for purging image versions. - **byoc_ami** (object) - Required if type is 'byoc_ami' - BYOC AMI details. - **ami_id** (string) - Required - The AMI ID of the BYOC image. - **root_device_name** (string) - Required - The root device name for the BYOC AMI. ### Request Example ```json { "alias": "test1", "os": "linux", "arch": "x64", "stack_id": "wxxxxxx", "type": "byoc_ami", "warpbuild_image": { "image_uri": "ami-xxxxxx", "cloud_init_template": "" }, "settings": { "purge_image_versions_offset": 1 }, "byoc_ami": { "ami_id": "ami-xxxxxx", "root_device_name": "/dev/sda1" } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the newly created runner image. - **alias** (string) - The alias of the runner image. - **type** (string) - The type of the runner image. ### Response Example ```json { "id": "wjwnpdjox8xeqsza", "alias": "test1", "type": "byoc_ami" } ``` ``` -------------------------------- ### Set up Additional WarpBuild Builder Nodes Source: https://www.warpbuild.com/docs/ci/docker-builders Demonstrates how to extract IDs for additional builder instances when an assignment returns multiple builders. This allows setting up more nodes for parallel builds. ```bash # For a second builder BUILDER_ID_2=$(echo $RESPONSE | jq -r '.builder_instances[1].id') REQUEST_ID_2=$(echo $RESPONSE | jq -r '.builder_instances[1].request_id') ``` -------------------------------- ### Update a BYOC runner image Source: https://www.warpbuild.com/docs/ci/api-keys/automation Updates an existing BYOC runner image. You can fetch the `id` from the `GET /api/v1/runner-images` endpoint or as a response to the `POST /api/v1/runner-images` endpoint. ```APIDOC ## PUT /api/v1/runner-images/{id} ### Description Updates an existing BYOC runner image. You can fetch the `id` from the `GET /api/v1/runner-images` endpoint or as a response to the `POST /api/v1/runner-images` endpoint. ### Method PUT ### Endpoint /api/v1/runner-images/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the runner image to update. #### Request Body - **byoc_ami** (object) - Required - BYOC AMI details. - **ami_id** (string) - Required - The new AMI ID of the BYOC image. - **root_device_name** (string) - Required - The root device name for the BYOC AMI. - **id** (string) - Required - The ID of the runner image to update. - **settings** (object) - Optional - Settings for the runner image. - **purge_image_versions_offset** (integer) - Optional - Offset for purging image versions. ### Request Example ```json { "byoc_ami": { "ami_id": "ami-new-xxxxxx", "root_device_name": "/dev/sda1" }, "id": "wxxxxxx", "settings": { "purge_image_versions_offset": 1 } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the updated runner image. - **alias** (string) - The alias of the runner image. - **type** (string) - The type of the runner image. ### Response Example ```json { "id": "wxxxxxx", "alias": "updated-image", "type": "byoc_ami" } ``` ``` -------------------------------- ### Security Group with No Inbound Rules Source: https://www.warpbuild.com/docs/ci/byoc/aws/security Example JSON configuration for a security group with all outbound traffic allowed and no inbound rules. Use this for tighter controls on CI runners. ```json { "InboundRules": [], "OutboundRules": [ { "IpProtocol": "-1", "Destination": "0.0.0.0/0", "Description": "Allow all outbound" } ] } ``` -------------------------------- ### Create Docker Buildx Instance with WarpBuild Builder Source: https://www.warpbuild.com/docs/ci/docker-builders Creates a `buildx` instance configured to use a remote WarpBuild builder. It specifies the builder node, driver options, and connection details obtained from the API. ```bash docker buildx create --name "$BUILDER_NAME" \ --node "$BUILDER_ID" \ --driver remote \ --driver-opt "cacert=$CERT_DIR/ca.pem" \ --driver-opt "cert=$CERT_DIR/cert.pem" \ --driver-opt "key=$CERT_DIR/key.pem" \ --use \ tcp://$HOST ``` -------------------------------- ### Get WarpBuild Builder Profiles Source: https://www.warpbuild.com/docs/ci/docker-builders Retrieves a list of available builder profiles from the WarpBuild API. This is typically used to find the ID of a profile for cache reset operations. ```bash curl -s -H "Authorization: Bearer $WARPBUILD_API_KEY" \ https://api.warpbuild.com/api/v1/builder-profiles?per_page=30&page=1 ``` -------------------------------- ### Update Runner API Call Source: https://www.warpbuild.com/docs/ci/api-keys/automation Example cURL command to update an existing runner using the specified runner ID. The request body contains the updated runner configuration. ```bash curl -X PATCH 'https://api.warpbuild.com/api/v1/runners/' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer wkey-xxxx' \ -H 'Content-Type: application/json' \ -d @update-runner.json ``` -------------------------------- ### Configure gcloud Project Source: https://www.warpbuild.com/docs/ci/byoc/gcp/service-account Sets the active GCP project for subsequent gcloud commands. Replace with your actual project ID. ```bash gcloud config set project ``` -------------------------------- ### Enable Incremental Snapshot Runner Source: https://www.warpbuild.com/docs/ci/features/snapshot-runners This workflow enables incremental snapshots on feature branches. On the first run, it boots from the base image and creates a snapshot. Subsequent runs boot from the latest snapshot, incrementally building on the previous state, which is useful for caching build artifacts and dependencies. ```yaml jobs: build: runs-on: warp-ubuntu-latest-x64-2x;snapshot.key=my-project-snapshot steps: - name: Checkout code uses: actions/checkout@v5 # Your build and test steps here - name: Install dependencies run: npm ci - name: Build run: npm run build - name: Test run: npm test # Cleanup credentials before snapshotting - name: Cleanup credentials run: | rm -rf $HOME/.ssh $HOME/.aws git clean -ffdx - name: Save snapshot uses: WarpBuilds/snapshot-save@v1 with: alias: "my-project-snapshot" fail-on-error: true wait-timeout-minutes: 60 ``` -------------------------------- ### Create a BYOC Runner Configuration Source: https://www.warpbuild.com/docs/ci/api-keys/automation Defines the parameters for creating a Bring Your Own Cloud (BYOC) runner. Specify details like name, provider ID, image, instance types, and role ARN. ```json { "name": "warpdev-custom-example-2", "provider_id": "wrslzvbl322yttsc", "pool_size": 2, "configuration": { "capacity_type": "ondemand", "image": "wjwnpdjox8xeqsza", "sku": "", "storage": { "disk_type": "", "tier": "custom", "performance_tier": "", "size": 150, "throughput": 400, "iops": 6000 }, "byoc_sku": { "instance_types": ["c3.large", "c1.xlarge"], "is_public": true, "arch": "x64", "role_arn": "", "network_tier": "STANDARD" } } } ``` -------------------------------- ### Enable KVM Group Permissions for Android Emulators Source: https://www.warpbuild.com/docs/ci/common-issues Add this step before the emulator step in your CI job to ensure the emulator can access /dev/kvm, preventing fallback to slower software emulation. This is required for all GitHub-compatible runners. ```yaml - name: Enable KVM group perms run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ | sudo tee /etc/udev/rules.d/99-kvm4all.rules sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm ```