Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 23 additions & 2 deletions .github/workflows/harness-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
deploy:
description: "Dispatch downstream deploy after the image is built"
type: boolean
default: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -39,13 +44,21 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Calculate branch tag
id: vars
shell: bash
run: |
BRANCH="${{ github.ref_name }}"
CLEANED_BRANCH_NAME=$(echo "$BRANCH" | tr '/' '-' | tr '[:upper:]' '[:lower:]')
echo "cleaned-branch-name=$CLEANED_BRANCH_NAME" >> "$GITHUB_OUTPUT"

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/conductor-oss/java-sdk/harness-worker
tags: |
type=raw,value=latest
type=raw,value=${{ steps.vars.outputs.cleaned-branch-name }}-latest,enable=${{ github.event_name != 'release' }}
type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }}

- name: Build and push
Expand All @@ -56,9 +69,17 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
# Registry-backed BuildKit cache. Unchanged layers are reused across
# runs so rebuilding the same commit (or one with only minor diffs)
# is near-instant. The `:buildcache` tag lives alongside the image
# but only stores layer blobs, not a runnable image.
cache-from: type=registry,ref=ghcr.io/conductor-oss/java-sdk/harness-worker:buildcache
cache-to: type=registry,ref=ghcr.io/conductor-oss/java-sdk/harness-worker:buildcache,mode=max

dispatch-deploy:
if: github.event_name == 'release'
if: |
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && inputs.deploy)
needs: build-and-push
runs-on: ubuntu-latest
permissions:
Expand Down
1 change: 1 addition & 0 deletions harness/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ repositories {

dependencies {
implementation project(':conductor-client')
implementation project(':conductor-client-metrics')
implementation project(':orkes-client')
implementation "ch.qos.logback:logback-classic:1.5.6"
}
4 changes: 2 additions & 2 deletions harness/manifests/configmap-gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ metadata:
labels:
app: java-sdk-harness-worker
data:
CONDUCTOR_SERVER_URL: "https://certification-gcp.orkesconductor.com/api"
CONDUCTOR_AUTH_KEY: "e6c1ac61-286b-11f1-be01-c682b5750c3a"
CONDUCTOR_SERVER_URL: "https://certification-gcp.orkesconductor.io/api"
CONDUCTOR_AUTH_KEY: "25b681c1-34ec-11f1-b07a-9601c7a63373"
7 changes: 6 additions & 1 deletion harness/manifests/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: harness
image: ghcr.io/conductor-oss/java-sdk/harness-worker:latest
image: ghcr.io/conductor-oss/java-sdk/harness-worker:main-latest
imagePullPolicy: Always
env:
# === CONDUCTOR CONNECTION (from per-cloud ConfigMap) ===
Expand Down Expand Up @@ -52,6 +52,11 @@ spec:
- name: HARNESS_POLL_INTERVAL_MS
value: "100"

ports:
- name: metrics
containerPort: 9991
protocol: TCP

resources:
requests:
memory: "256Mi"
Expand Down
13 changes: 11 additions & 2 deletions harness/src/main/java/io/orkes/conductor/harness/HarnessMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.netflix.conductor.client.http.MetadataClient;
import com.netflix.conductor.client.http.TaskClient;
import com.netflix.conductor.client.http.WorkflowClient;
import com.netflix.conductor.client.metrics.prometheus.PrometheusMetricsCollector;
import com.netflix.conductor.client.worker.Worker;
import com.netflix.conductor.common.metadata.tasks.TaskDef;
import com.netflix.conductor.common.metadata.tasks.TaskType;
Expand All @@ -47,7 +48,7 @@ public class HarnessMain {
{"java_worker_4", "deepcrawl", "5"},
};

public static void main(String[] args) throws InterruptedException {
public static void main(String[] args) throws Exception {
ConductorClient client = ApiClient.builder().useEnvVariables(true).readTimeout(10_000).connectTimeout(10_000)
.writeTimeout(10_000).build();

Expand All @@ -57,6 +58,11 @@ public static void main(String[] args) throws InterruptedException {

registerMetadata(client);

PrometheusMetricsCollector metricsCollector = new PrometheusMetricsCollector();
int metricsPort = envInt("HARNESS_METRICS_PORT", 9991);
metricsCollector.startServer(metricsPort, "/metrics");
log.info("Prometheus metrics server started on port {}", metricsPort);

List<Worker> workers = new ArrayList<>();
for (String[] entry : SIMULATED_WORKERS) {
workers.add(new SimulatedTaskWorker(entry[0], entry[1], Integer.parseInt(entry[2]), batchSize,
Expand All @@ -68,7 +74,10 @@ public static void main(String[] args) throws InterruptedException {
workers.stream().collect(Collectors.toMap(Worker::getTaskDefName, w -> batchSize));

TaskRunnerConfigurer configurer =
new TaskRunnerConfigurer.Builder(taskClient, workers).withTaskThreadCount(threadCounts).build();
new TaskRunnerConfigurer.Builder(taskClient, workers)
.withTaskThreadCount(threadCounts)
.withMetricsCollector(metricsCollector)
.build();
configurer.init();

WorkflowClient workflowClient = new WorkflowClient(client);
Expand Down
Loading