Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
92c344e
fix: add @vercel/ncc to catalog for consistency
paulbalaji Dec 17, 2025
58b235a
feat: add standalone rebalancer Docker image and workflow
paulbalaji Dec 5, 2025
5910a19
feat: optimize rebalancer Docker image with ncc bundling
paulbalaji Dec 8, 2025
41ba86c
fix: use GitHub registry by default instead of baked-in clone
paulbalaji Dec 8, 2025
f5290b6
chore: optimize builder stage with Alpine and pinned Foundry
paulbalaji Dec 8, 2025
17fd7ec
Revert "chore: optimize builder stage with Alpine and pinned Foundry"
paulbalaji Dec 8, 2025
e289583
chore: only comment on PRs with rebalancer or workflow changes
paulbalaji Dec 8, 2025
f6ee225
chore: remove .registryrc dependency from rebalancer workflow
paulbalaji Dec 8, 2025
f416423
fixes
paulbalaji Dec 8, 2025
dba7be4
fix: update rebalancer Dockerfile for pnpm migration
paulbalaji Dec 15, 2025
d782e96
fix: update lockfile and add patches to Dockerfile
paulbalaji Dec 15, 2025
e10cee9
fix: use pnpm instead of yarn in prepack script
paulbalaji Dec 15, 2025
aa72d8b
refactor: use corepack for pnpm installation in Dockerfile
paulbalaji Dec 15, 2025
ba776cf
fix: add jq back for starknet-core build dependency
paulbalaji Dec 15, 2025
e4b1072
feat: add REGISTRY_URI and REGISTRY_COMMIT env var support for rebala…
paulbalaji Dec 16, 2025
8dc0f69
refactor: simplify registry config to use URL-embedded commit
paulbalaji Dec 16, 2025
cffea35
fix: update deploy script to use registryUri with embedded commit
paulbalaji Dec 16, 2025
3c37876
fix: use catalog: reference for @vercel/ncc in rebalancer
paulbalaji Dec 17, 2025
fadb5a6
fix: exit non-zero on ncc post-bundle errors
paulbalaji Dec 18, 2025
79fe4c3
Merge remote-tracking branch 'origin/main' into pbio/rebalancer-docke…
paulbalaji Dec 22, 2025
20270db
pin foundry version in rebalancer dockerfile
paulbalaji Dec 22, 2025
427a06d
fix: use bash for pipefail in rebalancer dockerfile
paulbalaji Dec 22, 2025
054a3d9
refine rebalancer workflow triggers
paulbalaji Dec 22, 2025
c07ea1d
greptile
paulbalaji Dec 29, 2025
bed40c7
CR: andrey
paulbalaji Dec 29, 2025
a5fbb1d
Merge remote-tracking branch 'origin/main' into pbio/rebalancer-docke…
paulbalaji Dec 29, 2025
da843dc
update rebalancer tag
paulbalaji Dec 29, 2025
ae1ee2a
pino logging fix
paulbalaji Dec 29, 2025
863e99c
improve rebalancer entrypoint error log
paulbalaji Dec 29, 2025
be84fc0
fix(utils): isFile uses statSync instead of lstatSync
paulbalaji Dec 29, 2025
5d127c2
refactor(rebalancer): use ConfigMap for config instead of baked-in file
paulbalaji Dec 29, 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
125 changes: 125 additions & 0 deletions .github/workflows/rebalancer-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Build and Push Rebalancer Image to GCR
on:
push:
branches: [main]
tags:
- '**'
pull_request:
paths:
- 'typescript/rebalancer/**'
- '.github/workflows/rebalancer-docker.yml'
workflow_dispatch:
inputs:
include_arm64:
description: 'Include arm64 in the build'
required: false
default: 'false'

concurrency:
group: build-push-rebalancer-${{ github.ref }}
cancel-in-progress: true

jobs:
check-env:
runs-on: ubuntu-latest
outputs:
gcloud-service-key: ${{ steps.gcloud-service-key.outputs.defined }}
steps:
- id: gcloud-service-key
env:
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }}
if: "${{ env.GCLOUD_SERVICE_KEY != '' }}"
run: echo "defined=true" >> $GITHUB_OUTPUT

build-and-push-to-gcr:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
pull-requests: write

needs: [check-env]
if: needs.check-env.outputs.gcloud-service-key == 'true'

steps:
- name: Generate GitHub App Token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.HYPER_GONK_APP_ID }}
private-key: ${{ secrets.HYPER_GONK_PRIVATE_KEY }}

- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
fetch-depth: 0

- name: Generate tag data
id: taggen
run: |
echo "TAG_DATE=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
echo "TAG_SHA=$(echo '${{ github.event.pull_request.head.sha || github.sha }}' | cut -b 1-7)" >> $GITHUB_OUTPUT

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
gcr.io/abacus-labs-dev/hyperlane-rebalancer
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,value=${{ steps.taggen.outputs.TAG_SHA }}-${{ steps.taggen.outputs.TAG_DATE }}

- name: Set up Depot CLI
uses: depot/setup-action@v1

- name: Login to GCR
uses: docker/login-action@v3
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCLOUD_SERVICE_KEY }}

- name: Determine platforms
id: determine-platforms
run: |
if [ "${{ github.event.inputs.include_arm64 }}" == "true" ]; then
echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
else
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
fi

- name: Get Foundry version
id: foundry-version
run: |
FOUNDRY_VERSION=$(cat solidity/.foundryrc)
echo "FOUNDRY_VERSION=$FOUNDRY_VERSION" >> $GITHUB_OUTPUT

- name: Build and push
id: build
uses: depot/build-push-action@v1
with:
project: 3cpjhx94qv
context: ./
file: ./typescript/rebalancer/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ steps.determine-platforms.outputs.platforms }}
build-args: |
FOUNDRY_VERSION=${{ steps.foundry-version.outputs.FOUNDRY_VERSION }}
SERVICE_VERSION=${{ steps.taggen.outputs.TAG_SHA }}-${{ steps.taggen.outputs.TAG_DATE }}

- name: Comment image tags on PR
if: github.event_name == 'pull_request'
uses: ./.github/actions/docker-image-comment
with:
comment_tag: rebalancer-docker-image
image_name: Rebalancer Docker Image
emoji: ♻️
image_tags: ${{ steps.meta.outputs.tags }}
pr_number: ${{ github.event.pull_request.number }}
github_token: ${{ steps.generate-token.outputs.token }}
job_status: ${{ job.status }}
8 changes: 7 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ catalog:
typescript: 5.8.3
tsx: ^4.19.1
ts-node: ^10.9.2
'@vercel/ncc': ^0.38.3

# Linting
eslint: ^9.31.0
Expand Down
2 changes: 1 addition & 1 deletion typescript/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@types/yargs": "catalog:",
"@typescript-eslint/eslint-plugin": "catalog:",
"@typescript-eslint/parser": "catalog:",
"@vercel/ncc": "^0.38.3",
"@vercel/ncc": "catalog:",
"ansi-escapes": "^7.0.0",
"asn1.js": "catalog:",
"bignumber.js": "catalog:",
Expand Down
1 change: 1 addition & 0 deletions typescript/cli/scripts/ncc.post-bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async function prepend() {
}
} catch (err) {
console.error('Error processing output file:', err);
process.exit(1);
}
}

Expand Down
37 changes: 18 additions & 19 deletions typescript/infra/helm/rebalancer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,31 @@ The rebalancer container
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: IfNotPresent
env:
- name: INSTALL_GCP_LOGGER_CLI
value: "true"
- name: LOG_FORMAT
value: json
- name: REGISTRY_COMMIT
value: {{ .Values.hyperlane.registryCommit }}
- name: LOG_LEVEL
value: info
{{- if .Values.hyperlane.registryUri }}
- name: REGISTRY_URI
value: {{ .Values.hyperlane.registryUri }}
{{- end }}
- name: HYP_KEY
value: $(REBALANCER_KEY)
- name: COINGECKO_API_KEY
value: $(COINGECKO_API_KEY)
args:
- "pnpm"
- "-C"
- "typescript/cli"
- "hyperlane"
- "warp"
- "rebalancer"
- "--checkFrequency"
- "60000"
- "--withMetrics"
- "true"
- "--configFile"
- "{{ .Values.hyperlane.rebalancerConfigFile }}"
- "--registry"
- "/hyperlane-registry"
- name: REBALANCER_CONFIG_FILE
value: "/config/rebalancer-config.yaml"
- name: CHECK_FREQUENCY
value: "60000"
- name: WITH_METRICS
value: "true"
- name: MONITOR_ONLY
value: "false"
envFrom:
- secretRef:
name: {{ include "hyperlane.fullname" . }}-secret
volumeMounts:
- name: config
mountPath: /config
readOnly: true
{{- end }}
9 changes: 9 additions & 0 deletions typescript/infra/helm/rebalancer/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "hyperlane.fullname" . }}-config
labels:
{{- include "hyperlane.labels" . | nindent 4 }}
data:
rebalancer-config.yaml: |
{{ .Values.hyperlane.rebalancerConfig | indent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ spec:
spec:
containers:
{{- include "hyperlane.rebalancer.container" . | indent 6 }}
volumes:
- name: config
configMap:
name: {{ include "hyperlane.fullname" . }}-config

6 changes: 3 additions & 3 deletions typescript/infra/helm/rebalancer/values.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
image:
repository: gcr.io/abacus-labs-dev/hyperlane-monorepo
repository: gcr.io/abacus-labs-dev/hyperlane-rebalancer
tag:
hyperlane:
runEnv:
context: hyperlane
registryCommit: ''
rebalancerConfigFile: ''
registryUri: ''
rebalancerConfig: ''
withMetrics: true
nameOverride: ''
fullnameOverride: ''
Expand Down
21 changes: 17 additions & 4 deletions typescript/infra/src/rebalancer/helm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import fs from 'fs';
import path from 'path';
import { fromZodError } from 'zod-validation-error';

import { DEFAULT_GITHUB_REGISTRY } from '@hyperlane-xyz/registry';
import {
type RebalancerConfigFileInput,
RebalancerConfigSchema,
Expand All @@ -22,6 +24,8 @@ export class RebalancerHelmManager extends HelmManager {
'./helm/rebalancer',
);

private rebalancerConfigContent: string = '';

constructor(
readonly warpRouteId: string,
readonly environment: DeployEnvironment,
Expand Down Expand Up @@ -66,24 +70,33 @@ export class RebalancerHelmManager extends HelmManager {
if (isObjEmpty(chains)) {
throw new Error('No chains configured');
}

// Store the config file content for helm values
this.rebalancerConfigContent = fs.readFileSync(
rebalancerConfigFile,
'utf8',
);
}

get namespace() {
return this.environment;
}

async helmValues() {
// Build registry URI with commit embedded in /tree/{commit} format
const registryUri = `${DEFAULT_GITHUB_REGISTRY}/tree/${this.registryCommit}`;

return {
image: {
repository: 'gcr.io/abacus-labs-dev/hyperlane-monorepo',
tag: '8da6852-20251215-172511',
repository: 'gcr.io/abacus-labs-dev/hyperlane-rebalancer',
tag: 'be84fc0-20251229-194426',
},
withMetrics: this.withMetrics,
fullnameOverride: this.helmReleaseName,
hyperlane: {
runEnv: this.environment,
registryCommit: this.registryCommit,
rebalancerConfigFile: this.rebalancerConfigFile,
registryUri,
rebalancerConfig: this.rebalancerConfigContent,
withMetrics: this.withMetrics,
},
};
Expand Down
1 change: 1 addition & 0 deletions typescript/rebalancer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env
dist
cache
bundle
Loading
Loading