From fb5364e1fa97fcf4d7bc2dad68de804626307bf6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:44:41 +0200 Subject: [PATCH] test the connector runtime in "real-life" (#478) * fix(deps): update dependency io.camunda:zeebe-bom to v8.6.3 * always check image on build * add another check step * added clean exit after successful start * timeout if something fails --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Lukas --- .github/workflows/build.yml | 10 ++++++-- docker/docker-compose.yml | 24 +++++++++++++++++-- runtime/pom.xml | 1 + .../community/connector/script/App.java | 4 ++++ runtime/src/main/resources/application.yaml | 5 +++- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 390a3ff..7306e97 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,8 +23,14 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build run: mvn verify -PcheckFormat -Pbuild-image -B - - name: check docker compose - run: docker compose -f docker/docker-compose.yml up + - uses: adambirds/docker-compose-action@v1.5.0 + name: start docker compose + with: + compose-file: "./docker/docker-compose.yml" + test-command: "java -jar runtime/target/script-connector-runtime.jar test" + - name: try to run connector runtime + run: java -jar runtime/target/script-connector-runtime.jar test + timeout-minutes: 1 - name: Publish Unit Test Results id: publish uses: EnricoMi/publish-unit-test-result-action@v2 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e939558..a9b8f07 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,5 +1,3 @@ -version: "2" - networks: zeebe_network: driver: bridge @@ -15,16 +13,30 @@ services: - "9600:9600" networks: - zeebe_network + healthcheck: + test: [ "CMD-SHELL", "timeout 10s bash -c ':> /dev/tcp/127.0.0.1/9600' || exit 1" ] + interval: 30s + timeout: 5s + retries: 5 + start_period: 30s script-connector-runtime: container_name: script-connector-runtime image: ghcr.io/camunda-community-hub/script-connector/runtime:latest environment: - ZEEBE_CLIENT_BROKER_GATEWAY-ADDRESS=zeebe:26500 - ZEEBE_CLIENT_SECURITY_PLAINTEXT=true + - management.endpoints.web.exposure.include=health + - management.endpoint.health.probes.enabled=true depends_on: - zeebe networks: - zeebe_network + healthcheck: + test: [ "CMD-SHELL", "curl -f http://localhost:8080/actuator/health/readiness" ] + interval: 30s + timeout: 1s + retries: 5 + start_period: 30s script-connector-bundled: container_name: script-connector-bundled image: camunda/connectors-bundle:8.6.2 @@ -35,10 +47,18 @@ services: - CAMUNDA_CONNECTOR_WEBHOOK_ENABLED=false - SPRING_MAIN_WEB-APPLICATION-TYPE=none - OPERATE_CLIENT_ENABLED=false + - management.endpoints.web.exposure.include=health + - management.endpoint.health.probes.enabled=true depends_on: - zeebe networks: - zeebe_network volumes: - ./../connector/target/script-connector-1.2.1-SNAPSHOT-shaded.jar:/opt/custom/script-connector.jar + healthcheck: + test: [ "CMD-SHELL", "curl -f http://localhost:8080/actuator/health/readiness" ] + interval: 30s + timeout: 1s + retries: 5 + start_period: 30s diff --git a/runtime/pom.xml b/runtime/pom.xml index 67604c3..150cf1a 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -28,6 +28,7 @@ + ${artifactId} org.springframework.boot diff --git a/runtime/src/main/java/io/camunda/community/connector/script/App.java b/runtime/src/main/java/io/camunda/community/connector/script/App.java index 3ecb93a..0fe7db7 100644 --- a/runtime/src/main/java/io/camunda/community/connector/script/App.java +++ b/runtime/src/main/java/io/camunda/community/connector/script/App.java @@ -1,5 +1,6 @@ package io.camunda.community.connector.script; +import java.util.Arrays; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -7,5 +8,8 @@ public class App { public static void main(String[] args) { SpringApplication.run(App.class, args); + if (Arrays.asList(args).contains("test")) { + System.exit(0); + } } } diff --git a/runtime/src/main/resources/application.yaml b/runtime/src/main/resources/application.yaml index f3d8fd1..884d3a1 100644 --- a/runtime/src/main/resources/application.yaml +++ b/runtime/src/main/resources/application.yaml @@ -4,4 +4,7 @@ camunda: enabled: false webhook: enabled: false - +zeebe: + client: + security: + plaintext: true