From 2267cca2e03874a7975298a6e1e330e25f8cadd5 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 18 Nov 2026 11:41:52 +0100 Subject: [PATCH 1/4] enable push to dockerhub --- .github/workflows/docker-build.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 70d416b09..92502cbca 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -3,6 +3,8 @@ name: Docker build push: branches: - master + tags: + - "v*" pull_request: branches: - master @@ -22,16 +24,23 @@ jobs: uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build Docker image (no push) + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + - name: Build and push Docker image uses: docker/build-push-action@v6 with: context: docker file: docker/Dockerfile target: ${{ matrix.target }} - push: false + push: ${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }} # The Dockerfile downloads the sources from GitHub, so pin the exact commit under test build-args: | DOWNLOAD=${{ github.event.pull_request.head.sha || github.sha }} - tags: iotagent-json:${{ matrix.target }}-ci + tags: | + telefonicaid/iotagent-json:${{ matrix.target }}-latest + ${{ startsWith(github.ref, 'refs/tags/') && format('telefonicaid/iotagent-json:{0}-{1}', matrix.target, github.ref_name) || '' }} cache-from: type=gha,scope=${{ matrix.target }} cache-to: type=gha,mode=max,scope=${{ matrix.target }} From e2c6fc8f2b512f582db8a2fa4fac5a053869987f Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 18 Nov 2026 11:56:11 +0100 Subject: [PATCH 2/4] do not push slim --- .github/workflows/docker-build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 92502cbca..acc75dad1 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -26,6 +26,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 + if: ${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }} with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }} @@ -35,12 +36,12 @@ jobs: context: docker file: docker/Dockerfile target: ${{ matrix.target }} - push: ${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }} + push: ${{ matrix.target == 'slim' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }} # The Dockerfile downloads the sources from GitHub, so pin the exact commit under test build-args: | DOWNLOAD=${{ github.event.pull_request.head.sha || github.sha }} tags: | - telefonicaid/iotagent-json:${{ matrix.target }}-latest - ${{ startsWith(github.ref, 'refs/tags/') && format('telefonicaid/iotagent-json:{0}-{1}', matrix.target, github.ref_name) || '' }} + ${{ matrix.target == 'slim' && format('telefonicaid/iotagent-json:latest') || format('telefonicaid/iotagent-json:{0}-ci', matrix.target) }} + ${{ matrix.target == 'slim' && startsWith(github.ref, 'refs/tags/') && format('telefonicaid/iotagent-json:{0}', github.ref_name) || '' }} cache-from: type=gha,scope=${{ matrix.target }} cache-to: type=gha,mode=max,scope=${{ matrix.target }} From 671431ff816be793ea17cd2f50f5862e526559e2 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 20 Nov 2026 11:36:01 +0100 Subject: [PATCH 3/4] fix tag version format --- .github/workflows/docker-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index acc75dad1..1cc01c535 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -4,7 +4,7 @@ name: Docker build branches: - master tags: - - "v*" + - "[0-9.]+" pull_request: branches: - master @@ -26,7 +26,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 - if: ${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }} + if: ${{ github.event_name == 'push' }} with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }} @@ -36,12 +36,12 @@ jobs: context: docker file: docker/Dockerfile target: ${{ matrix.target }} - push: ${{ matrix.target == 'slim' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' }} + push: ${{ matrix.target == 'slim' && github.event_name == 'push' }} # The Dockerfile downloads the sources from GitHub, so pin the exact commit under test build-args: | DOWNLOAD=${{ github.event.pull_request.head.sha || github.sha }} tags: | - ${{ matrix.target == 'slim' && format('telefonicaid/iotagent-json:latest') || format('telefonicaid/iotagent-json:{0}-ci', matrix.target) }} + ${{ matrix.target == 'slim' && github.event_name == 'pull_request' && 'telefonicaid/iotagent-json:ci' || matrix.target == 'slim' && github.ref == 'refs/heads/master' && 'telefonicaid/iotagent-json:latest' || '' }} ${{ matrix.target == 'slim' && startsWith(github.ref, 'refs/tags/') && format('telefonicaid/iotagent-json:{0}', github.ref_name) || '' }} cache-from: type=gha,scope=${{ matrix.target }} cache-to: type=gha,mode=max,scope=${{ matrix.target }} From 6daac47d9fc3de94f835683da03d27c99f8c09cd Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 20 Nov 2026 11:38:16 +0100 Subject: [PATCH 4/4] add note about github actions --- docs/installationguide.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/installationguide.md b/docs/installationguide.md index fc8a32cb7..2e8c35e64 100644 --- a/docs/installationguide.md +++ b/docs/installationguide.md @@ -64,6 +64,11 @@ docker run -it --init -v :/opt/iotajson/new_config.j As an alternative, it is also possible to pass configuration using environmental variables, as explained in [Configuration with environment variables](#configuration-with-environment-variables) subsection. +The GitHub Actions build workflow publishes `telefonicaid/iotagent-json:latest` on pushes to `master` and publishes the +matching version tag for tags consisting only of digits and dots (the Docker Hub pattern `^[0-9.]+$`). Pull requests +build the image without publishing it. Publishing requires the repository secrets `DOCKER_HUB_USERNAME` and +`DOCKER_HUB_TOKEN`. + ### Usage In order to execute the JSON IoT Agent just execute the following command from the root folder: @@ -102,8 +107,8 @@ There are also some global configuration options: - **config.defaultTransport**: code of the MQTT transport that will be used to resolve incoming commands and lazy attributes in case a transport protocol could not be inferred for the device. - **compressTimestamp**: this flag enables the timestamp compression mechanism, described in the User Manual. -- **config.jexlTransformations**: allows users to extend the JEXL parser with custom extra transformations. - It must point to a Node.js module exporting a jexlTransformations object whose values are functions. +- **config.jexlTransformations**: allows users to extend the JEXL parser with custom extra transformations. It must + point to a Node.js module exporting a jexlTransformations object whose values are functions. #### MQTT configuration @@ -138,8 +143,8 @@ These are the currently available MQTT configuration options: order versions) or without the slash. See [discussion](https://github.com/telefonicaid/iotagent-node-lib/issues/866). - **clean**: this flag is by default true, set to false to receive QoS 1 and 2 messages while offline. -- **clientId**: string ID which identifies client in mqtt broker. By default is using a string composed by a fixed prefix - `iotajson_` and a random suffix, i.e. `iotajson_43bf8a3a`. +- **clientId**: string ID which identifies client in mqtt broker. By default is using a string composed by a fixed + prefix `iotajson_` and a random suffix, i.e. `iotajson_43bf8a3a`. - **subscribeBatchSize**: Maximum number of topics per SUBSCRIBE packet (default is null; no batching—all topics sent at once). Useful for AWS IoT Core, which enforces a limit of 8 topics per SUBSCRIBE packet. When set to a number, the IOTA automatically splits subscriptions into multiple packets of this size. @@ -180,12 +185,12 @@ in the `config.iota` set are described in the The ones relating global configuration described in the following table. -| Environment variable | Configuration attribute | -| :--------------------- | :---------------------- | -| IOTA_CONFIG_RETRIEVAL | configRetrieval | -| IOTA_DEFAULT_KEY | defaultKey | -| IOTA_DEFAULT_TRANSPORT | defaultTransport | -| IOTA_EXTRA_JEXL_TRANSFORMATIONS_PATH | jexlTransformations | +| Environment variable | Configuration attribute | +| :----------------------------------- | :---------------------- | +| IOTA_CONFIG_RETRIEVAL | configRetrieval | +| IOTA_DEFAULT_KEY | defaultKey | +| IOTA_DEFAULT_TRANSPORT | defaultTransport | +| IOTA_EXTRA_JEXL_TRANSFORMATIONS_PATH | jexlTransformations | The ones relating specific JSON bindings are described in the following table.