Skip to content

Commit

Permalink
Merge pull request #349 from mtconnect/docker_image_workflow_builds
Browse files Browse the repository at this point in the history
Docker image workflow builds
  • Loading branch information
wsobel authored Oct 19, 2023
2 parents 777f4de + cb8e6ae commit cd0abd5
Show file tree
Hide file tree
Showing 41 changed files with 152,321 additions and 374 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ env:
# when to run workflow
on:
# # run on push or pull request events for the master branch
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
push:
paths-ignore: ["**/*.md", "LICENSE.txt", ".gitignore"]
branches: [ "main", "main-dev" ]
tags:
- "v*.*.*"

# allows you to run this workflow manually from the actions tab
workflow_dispatch:
Expand All @@ -35,6 +36,13 @@ jobs:
build:
# the type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: docker/alpine/Dockerfile
name: agent
- dockerfile: demo/Dockerfile.alpine
name: demo

# steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -46,30 +54,30 @@ jobs:
# the QEMU emulator lets us build for arm processors also
# see https://github.com/docker/setup-qemu-action
- name: Set up QEMU emulator
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

# see https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# see https://github.com/docker/build-push-action
- name: Build image and push to DockerHub
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
file: ${{ matrix.dockerfile }}
platforms: ${{ env.PLATFORMS }}

# docker hub user/repo:tag
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/agent:latest
${{ secrets.DOCKERHUB_USERNAME }}/agent:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.name }}:${{ github.ref_name }}
# push to docker hub
push: true
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(AGENT_VERSION_MAJOR 2)
set(AGENT_VERSION_MINOR 2)
set(AGENT_VERSION_PATCH 0)
set(AGENT_VERSION_BUILD 9)
set(AGENT_VERSION_BUILD 10)
set(AGENT_VERSION_RC "")

# This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent
Expand Down
167 changes: 93 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,31 @@ Configuration Parameters

*Default*: false

* `JsonVersion` - JSON Printer format. Old format: 1, new format: 2

*Default*: 2

* `SchemaVersion` - Change the schema version to a different version number.

*Default*: 2.0

* `MaxAssets` - The maximum number of assets the agent can hold in its buffer. The
number is the actual count, not an exponent.

*Default*: 1024

* `MonitorConfigFiles` - Monitor agent.cfg and Devices.xml files and restart agent if they change.

*Default*: false

* `MinimumConfigReloadAge` - The minimum age of a config file before an agent reload is triggered (seconds).

*Default*: 15

* `Pretty` - Pretty print the output with indententation

*Default*: false

* `PidFile` - UNIX only. The full path of the file that contains the
process id of the daemon. This is not supported in Windows.

Expand All @@ -609,96 +634,90 @@ Configuration Parameters

*Default*: MTConnect Agent

* `Port` - The port number the agent binds to for requests.

*Default*: 5000

* `ServerIp` - The server IP Address to bind to. Can be used to select the interface in IPV4 or IPV6.

*Default*: 0.0.0.0

* `AllowPut` - Allow HTTP PUT or POST of data item values or assets.
* `SuppressIPAddress` - Suppress the Adapter IP Address and port when creating the Agent Device ids and names. This applies to all adapters.

*Default*: false

* `AllowPutFrom` - Allow HTTP PUT or POST from a specific host or
list of hosts. Lists are comma (,) separated and the host names will
be validated by translating them into IP addresses.

*Default*: none
* `WorkerThreads` - The number of operating system threads dedicated to the Agent

* `JsonVersion` - JSON Printer format. Old format: 1, new format: 2
*Default*: 1

#### Adapter General Configuration

*Default*: 2
These can be overridden on a per-adapter basis

* `LegacyTimeout` - The default length of time an adapter can be silent before it
is disconnected. This is only for legacy adapters that do not support heartbeats.
* `ConversionRequired` - Global default for data item units conversion in the agent.
Assumes the adapter has already done unit conversion.

*Default*: 600
*Default*: true

* `EnableSourceDeviceModels` - Allow adapters and data sources to supply Device
configuration

* `ReconnectInterval` - The amount of time between adapter reconnection attempts.
This is useful for implementation of high performance adapters where availability
needs to be tracked in near-real-time. Time is specified in milliseconds (ms).

*Default*: 10000

*Default*: false

* `IgnoreTimestamps` - Overwrite timestamps with the agent time. This will correct
clock drift but will not give as accurate relative time since it will not take into
consideration network latencies. This can be overridden on a per adapter basis.

*Default*: false

* `LegacyTimeout` - The default length of time an adapter can be silent before it
is disconnected. This is only for legacy adapters that do not support heartbeats.

*Default*: 600

* `PreserveUUID` - Do not overwrite the UUID with the UUID from the adapter, preserve
the UUID in the Devices.xml file. This can be overridden on a per adapter basis.

*Default*: true

* `SchemaVersion` - Change the schema version to a different version number.

*Default*: 2.0

* `ConversionRequired` - Global default for data item units conversion in the agent.
Assumes the adapter has already done unit conversion.
* `ReconnectInterval` - The amount of time between adapter reconnection attempts.
This is useful for implementation of high performance adapters where availability
needs to be tracked in near-real-time. Time is specified in milliseconds (ms).

*Default*: 10000

* `ShdrVersion` - Specifies the SHDR protocol version used by the adapter. When greater than one (1),
allows multiple complex observations, like `Condition` and `Message` on the same line. If it equials one (1),
then any observation requiring more than a key/value pair need to be on separate lines. This is the default for all adapters.

*Default*: true
*Default*: 1
* `UpcaseDataItemValue` - Always converts the value of the data items to upper case.

*Default*: true

* `MaxAssets` - The maximum number of assets the agent can hold in its buffer. The
number is the actual count, not an exponent.
#### REST Service Configuration

*Default*: 1024

* `MonitorConfigFiles` - Monitor agent.cfg and Devices.xml files and restart agent if they change.
* `AllowPut` - Allow HTTP PUT or POST of data item values or assets.

*Default*: false

* `MinimumConfigReloadAge` - The minimum age of a config file before an agent reload is triggered (seconds).

*Default*: 15

* `Pretty` - Pretty print the output with indententation
* `AllowPutFrom` - Allow HTTP PUT or POST from a specific host or
list of hosts. Lists are comma (,) separated and the host names will
be validated by translating them into IP addresses.

*Default*: false
*Default*: none

* `HttpHeaders` - Additional headers to add to the HTTP Response for CORS Security

* `ShdrVersion` - Specifies the SHDR protocol version used by the adapter. When greater than one (1), allows multiple complex observations, like `Condition` and `Message` on the same line. If it equials one (1), then any observation requiring more than a key/value pair need to be on separate lines. This is the default for all adapters.
> Example: ```
> HttpHeaders {
> Access-Control-Allow-Origin = *
> Access-Control-Allow-Methods = GET
> Access-Control-Allow-Headers = Content-Type
> }```
*Default*: 1

* `SuppressIPAddress` - Suppress the Adapter IP Address and port when creating the Agent Device ids and names. This applies to all adapters.
* `Port` - The port number the agent binds to for requests.

*Default*: false
*Default*: 5000

* `ServerIp` - The server IP Address to bind to. Can be used to select the interface in IPV4 or IPV6.

* `WorkerThreads` - The number of operating system threads dedicated to the Agent
*Default*: 0.0.0.0

*Default*: 1

* `EnableSourceDeviceModels` -

*Default*: false

#### Configuration Pameters for TLS (https) Support ####

The following parameters must be present to enable https requests. If there is no password on the certificate, `TlsCertificatePassword` may be omitted.
Expand All @@ -707,31 +726,35 @@ The following parameters must be present to enable https requests. If there is n

*Default*: *NULL*

* `TlsPrivateKey` - The name of the file containing the private key for the certificate
* `TlsCertificatePassword` - The password used when creating the certificate. If none was supplied, do not use.

*Default*: *NULL*

* `TlsDHKey` - The name of the file containing the Diffie–Hellman key
* `TlsClientCAs` - For `TlsVerifyClientCertificate`, specifies a file that contains additional certificate authorities for verification

*Default*: *NULL*

* `TlsCertificatePassword` - The password used when creating the certificate. If none was supplied, do not use.
* `TlsDHKey` - The name of the file containing the Diffie–Hellman key

*Default*: *NULL*

* `TlsOnly` - Only allow secure connections, http requests will be rejected

*Default*: false

* `TlsPrivateKey` - The name of the file containing the private key for the certificate

*Default*: *NULL*

* `TlsVerifyClientCertificate` - Request and verify the client certificate against root authorities

*Default*: false

* `TlsClientCAs` - For `TlsVerifyClientCertificate`, specifies a file that contains additional certificate authorities for verification
### MQTT Configuration

* `MqttCaCert` - CA Certificate for MQTT TLS connection to the MTT Broker

*Default*: *NULL*

### MQTT Configuration

* `MqttHost` - IP Address or name of the MQTT Broker

Expand All @@ -741,10 +764,6 @@ The following parameters must be present to enable https requests. If there is n

*Default*: 1883

* `MqttCaCert` - CA Certificate for MQTT TLS connection to the MTT Broker

*Default*: *NULL*

* `MqttTls` - TLS Certificate for secure connection to the MQTT Broker

*Default*: *NULL*
Expand Down Expand Up @@ -785,6 +804,14 @@ Sinks {
}
```

* `AssetTopic` - Prefix for the Assets

*Default*: `MTConnect/Asset/[device]`

* `CurrentTopic` - Prefix for the Current

*Default*: `MTConnect/Current/[device]`

* `ProbeTopic` or `DeviceTopic` - Prefix for the Device Model topic

> Note: The `[device]` will be replace with the uuid of each device. Other patterns can be created,
Expand All @@ -793,18 +820,10 @@ Sinks {
*Default*: `MTConnect/Probe/[device]`

* `CurrentTopic` - Prefix for the Current

*Default*: `MTConnect/Current/[device]`

* `SampleTopic` - Prefix for the Sample

*Default*: `MTConnect/Current/[device]`

* `AssetTopic` - Prefix for the Assets

*Default*: `MTConnect/Asset/[device]`

* `MqttCurrentInterval` - The frequency to publish currents. Acts like a keyframe in a video stream.

*Default*: 10000ms
Expand Down
4 changes: 3 additions & 1 deletion agent_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ target_clangtidy_setup(agent_lib)

include(../cmake/document.cmake)
if (AGENT_WITH_DOCS AND DOXYGEN_FOUND)
doxygen_add_docs(docs ../README.md ${AGENT_SOURCES})
file(GLOB _tests ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/*.cpp)
doxygen_add_docs(docs README.md ${AGENT_SOURCES} ${_tests}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.." )
install(DIRECTORY "${PROJECT_BINARY_DIR}/Documentation/" DESTINATION "Documentation")
endif()

Expand Down
1 change: 1 addition & 0 deletions cmake/document.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ if (DOXYGEN_FOUND)
set(DOXYGEN_INCLUDE_PATH "${CONAN_INCLUDE_DIRS}")
set(DOXYGEN_HTML_COLORSTYLE "AUTO_DARK")
set(DOXYGEN_MAX_DOT_GRAPH_DEPTH 3)
set(DOXYGEN_GENERATE_TESTLIST YES)
endif()
25 changes: 25 additions & 0 deletions conan/cmake/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sources:
"3.19.8":
url: https://github.com/Kitware/CMake/releases/download/v3.19.8/cmake-3.19.8.tar.gz
sha256: 09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369
"3.20.6":
url: https://github.com/Kitware/CMake/releases/download/v3.20.6/cmake-3.20.6.tar.gz
sha256: a0bd485e1a38dd13c0baec89d5f4adbf61c7fd32fddb38eabc69a75bc0b65d72
"3.21.7":
url: https://github.com/Kitware/CMake/releases/download/v3.21.7/cmake-3.21.7.tar.gz
sha256: 3523c4a5afc61ac3d7c92835301cdf092129c9b672a6ee17e68c92e928c1375a
"3.22.6":
url: https://github.com/Kitware/CMake/releases/download/v3.22.6/cmake-3.22.6.tar.gz
sha256: 73933163670ea4ea95c231549007b0c7243282293506a2cf4443714826ad5ec3
"3.23.5":
url: "https://github.com/Kitware/CMake/releases/download/v3.23.5/cmake-3.23.5.tar.gz"
sha256: "f2944cde7a140b992ba5ccea2009a987a92413762250de22ebbace2319a0f47d"
"3.24.3":
url: "https://github.com/Kitware/CMake/releases/download/v3.24.3/cmake-3.24.3.tar.gz"
sha256: "b53aa10fa82bff84ccdb59065927b72d3bee49f4d86261249fc0984b3b367291"
"3.25.2":
url: "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2.tar.gz"
sha256: "c026f22cb931dd532f648f087d587f07a1843c6e66a3dfca4fb0ea21944ed33c"
"3.26.4":
url: "https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4.tar.gz"
sha256: "313b6880c291bd4fe31c0aa51d6e62659282a521e695f30d5cc0d25abbd5c208"
Loading

0 comments on commit cd0abd5

Please sign in to comment.