Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e553426
warpbuild remote builders
guptaankit015 May 20, 2025
17dd0c4
warpbuild remote builders
guptaankit015 May 20, 2025
b5b0ff8
warpbuild remote builders
guptaankit015 May 20, 2025
a277aa0
warpbuild remote builders
guptaankit015 May 20, 2025
bda98bd
Merge pull request #1 from WarpBuilds/feat/warpbuild-remote-builder
guptaankit015 May 20, 2025
d51044f
fix readme references
guptaankit015 May 26, 2025
54dcee7
Merge pull request #2 from WarpBuilds/fix/readme
guptaankit015 May 26, 2025
b1cddd6
teardown request changes
Jun 18, 2025
e67bee5
Merge pull request #6 from WarpBuilds/feat/builder-v2
guptaankit015 Jun 18, 2025
71f3862
request context added to assign
Jun 19, 2025
c91c698
key generation changed
Jun 19, 2025
fd4b3b0
Merge pull request #7 from WarpBuilds/feat/request-context
guptaankit015 Jun 19, 2025
e86d55f
teardown retry added
guptaankit015 Oct 9, 2025
a477862
Merge pull request #10 from WarpBuilds/fix/teardown-retry
guptaankit015 Oct 9, 2025
a252059
Merge upstream docker/bake-action master
PrashantRaj18198 Oct 10, 2025
19b7937
rebuild
guptaankit015 Oct 23, 2025
c1eb45d
debug wf changes
guptaankit015 Oct 23, 2025
fa52a33
Merge pull request #11 from WarpBuilds/feat/sync-20251010
guptaankit015 Oct 23, 2025
c735e9b
chore(deps): Bump js-yaml from 3.14.1 to 3.14.2 (#13)
dependabot[bot] Dec 1, 2025
002b390
chore(deps): Bump tar from 7.5.1 to 7.5.2 (#12)
dependabot[bot] Dec 1, 2025
67bb13f
sync 1
abhijit-hota Dec 1, 2025
b2e2d41
yarn update
abhijit-hota Dec 1, 2025
ef8d837
build again
abhijit-hota Dec 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Debug WarpBuild Docker Bake Action

on:
push:
branches:
- feat/warpbuild-remote-builder
workflow_dispatch:

env:
WARPBUILD_API_DOMAIN: "https://api.dev.warpbuild.dev"

jobs:
test-multi-warp:
name: Debug Run ${{ matrix.run_number }}
runs-on: warpdev-ubuntu-latest-x64-8x
strategy:
matrix:
run_number: [1,2,3]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Bake all targets
uses: ./
with:
files: ./__tests__/bake.hcl
profile-name: benchmark-builder-dispatch


27 changes: 27 additions & 0 deletions .github/workflows/release-new-action-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release new action version

on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true

env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
permissions:
contents: write

jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
environment:
name: releaseNewActionVersion
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.2.2
with:
source-tag: ${{ env.TAG_NAME }}
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,22 @@ on:

jobs:
bake:
runs-on: ubuntu-latest
runs-on: warp-ubuntu-latest-x64-4x
steps:
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
uses: docker/bake-action@v6
uses: Warpbuilds/bake-action@v6
with:
push: true
set: |
*.tags=user/app:latest
profile-name: super-fast-builder
```

Be careful because **any file mutation in the steps that precede the build step
Expand All @@ -80,12 +78,13 @@ to the default Git context:
```yaml
-
name: Build and push
uses: docker/bake-action@v6
uses: Warpbuilds/bake-action@v6
with:
source: "{{defaultContext}}:mysubdir"
push: true
set: |
*.tags=user/app:latest
profile-name: super-fast-builder
```

Building from the current repository automatically uses the `GITHUB_TOKEN`
Expand Down Expand Up @@ -119,7 +118,7 @@ on:

jobs:
bake:
runs-on: ubuntu-latest
runs-on: warp-ubuntu-latest-x64-4x
steps:
-
name: Checkout
Expand All @@ -130,17 +129,15 @@ jobs:
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
uses: docker/bake-action@v6
uses: Warpbuilds/bake-action@v6
with:
source: .
push: true
set: |
*.tags=user/app:latest
profile-name: super-fast-builder
```

## Summaries
Expand Down Expand Up @@ -214,6 +211,9 @@ The following inputs can be used as `step.with` keys
| `set` | List | List of [targets values to override](https://docs.docker.com/engine/reference/commandline/buildx_bake/#set) (e.g., `targetpattern.key=value`) |
| `targets` | List/CSV | List of bake targets (`default` target used if empty) |
| `github-token` | String | API token used to authenticate to a Git repository for [remote definitions](https://docs.docker.com/build/bake/remote-definition/) (default `${{ github.token }}`) |
| `profile-name` | String | The profile name to use for the WarpBuild Docker Builders |
| `api-key` | String | The API key for the WarpBuild API. This is not required in case of using WarpBuild runners |
| `timeout` | String | The timeout(in ms) to wait for the Docker Builders to be ready. By default, it is 10 minutes |

### outputs

Expand Down
28 changes: 28 additions & 0 deletions __tests__/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG BUILD_TYPE=quick

FROM ubuntu:22.04 as base
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*

# Quick build stage
FROM base as quick
RUN echo "This is a quick build" > /build-info.txt

# Heavy build stage
FROM base as heavy
# Simulate heavy build by installing more packages and running some commands
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
RUN echo "This is a heavy build" > /build-info.txt
# Simulate some heavy processing
RUN dd if=/dev/zero of=/tmp/largefile bs=1M count=100
RUN rm /tmp/largefile

# Final stage
FROM ${BUILD_TYPE}
CMD ["cat", "/build-info.txt"]
35 changes: 35 additions & 0 deletions __tests__/bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
variable "RUN_NUMBER" {
default = "1"
}

group "default" {
targets = ["quick-image", "heavy-image"]
}

target "quick-image" {
context = "__tests__"
dockerfile = "./Dockerfile"
tags = ["quick-image-run-${RUN_NUMBER}"]
platforms = ["linux/amd64"]
output = ["type=docker"]
profiles = ["dev-eph"]
args = {
BUILD_TYPE = "quick"
}
}

target "heavy-image" {
context = "__tests__"
dockerfile = "./Dockerfile"
tags = ["heavy-image-run-${RUN_NUMBER}"]
platforms = ["linux/amd64"]
output = ["type=docker"]
profiles = ["dev-eph"]
args = {
BUILD_TYPE = "heavy"
}
# Add more build steps or dependencies to make it take longer
contexts = {
quick-image = "target:quick-image"
}
}
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ inputs:
description: "API token used to authenticate to a Git repository for remote definitions"
default: ${{ github.token }}
required: false

api-key:
description: "The API key for the WarpBuild API. This is not required in case of using WarpBuild runners"
required: false
profile-name:
description: "The profile name to use for the WarpBuild Docker Builders"
required: true
timeout:
description: "The timeout(in ms) to wait for the Docker Builders to be ready. By default, it is 10 minutes"
required: false
default: "600000"

outputs:
metadata:
Expand Down
54 changes: 21 additions & 33 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

24 changes: 15 additions & 9 deletions src/context.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as core from '@actions/core';
import * as handlebars from 'handlebars';

import {Bake} from '@docker/actions-toolkit/lib/buildx/bake';
import {Build} from '@docker/actions-toolkit/lib/buildx/build';
import {Context} from '@docker/actions-toolkit/lib/context';
import {GitHub} from '@docker/actions-toolkit/lib/github';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
import {Util} from '@docker/actions-toolkit/lib/util';
import { Bake } from '@docker/actions-toolkit/lib/buildx/bake';
import { Build } from '@docker/actions-toolkit/lib/buildx/build';
import { Context } from '@docker/actions-toolkit/lib/context';
import { GitHub } from '@docker/actions-toolkit/lib/github';
import { Toolkit } from '@docker/actions-toolkit/lib/toolkit';
import { Util } from '@docker/actions-toolkit/lib/util';

import {BakeDefinition} from '@docker/actions-toolkit/lib/types/buildx/bake';
import { BakeDefinition } from '@docker/actions-toolkit/lib/types/buildx/bake';

export interface Inputs {
builder: string;
Expand All @@ -26,6 +26,9 @@ export interface Inputs {
set: string[];
targets: string[];
'github-token': string;
apiKey: string;
profileName: string;
timeout: string;
}

export async function getInputs(): Promise<Inputs> {
Expand All @@ -42,9 +45,12 @@ export async function getInputs(): Promise<Inputs> {
provenance: Build.getProvenanceInput('provenance'),
push: core.getBooleanInput('push'),
sbom: core.getInput('sbom'),
set: Util.getInputList('set', {ignoreComma: true, quote: false}),
set: Util.getInputList('set', { ignoreComma: true, quote: false }),
targets: Util.getInputList('targets'),
'github-token': core.getInput('github-token')
'github-token': core.getInput('github-token'),
apiKey: core.getInput('api-key'),
profileName: core.getInput('profile-name'),
timeout: core.getInput('timeout')
};
}

Expand Down
34 changes: 34 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import {UploadArtifactResponse} from '@docker/actions-toolkit/lib/types/github';

import * as context from './context';
import * as stateHelper from './state-helper';
import {WarpBuildRemoteBuilders} from './warpbuild';

let remoteBuilders: WarpBuildRemoteBuilders;

actionsToolkit.run(
// main
Expand All @@ -30,6 +33,17 @@ actionsToolkit.run(
core.debug(`inputs: ${JSON.stringify(inputs)}`);

const toolkit = new Toolkit();
const parsedTimeout = parseInt(inputs.timeout);
remoteBuilders = new WarpBuildRemoteBuilders({
apiKey: inputs.apiKey,
profileName: inputs.profileName,
timeout: parsedTimeout
});

// We don't need to wait for the builder assignment to complete here
// because the setupBuilders() method will wait for it if needed
remoteBuilders.assignBuilder();

const gitAuthToken = process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs['github-token'];

await core.group(`GitHub Actions runtime token ACs`, async () => {
Expand Down Expand Up @@ -85,6 +99,8 @@ actionsToolkit.run(
await toolkit.buildx.printVersion();
});

await remoteBuilders.setupBuilders();

let builder: BuilderInfo;
await core.group(`Builder info`, async () => {
builder = await toolkit.builder.inspect(inputs.builder);
Expand Down Expand Up @@ -226,6 +242,10 @@ actionsToolkit.run(
if (err) {
throw err;
}

if (remoteBuilders) {
remoteBuilders.saveState();
}
},
// post
async () => {
Expand Down Expand Up @@ -272,6 +292,20 @@ actionsToolkit.run(
fs.rmSync(stateHelper.tmpDir, {recursive: true});
});
}

const inputs: context.Inputs = await context.getInputs();
const parsedTimeout = parseInt(inputs.timeout);

remoteBuilders = new WarpBuildRemoteBuilders({
apiKey: inputs.apiKey,
profileName: inputs.profileName,
timeout: parsedTimeout
});

remoteBuilders.loadState();
await remoteBuilders.removeBuilderInstances();
await remoteBuilders.removeBuilderConfiguration();
await remoteBuilders.removeCertDirs();
}
);

Expand Down
Loading