Skip to content

Commit

Permalink
Improve build pipeline and documentation text (#38)
Browse files Browse the repository at this point in the history
- Use super-linter environment file to have better consistency between
  GitHub CI pipeline and the instructions in LINT.md
- Use correct wording for ACAP applications
- Add comments to linter configuration files

Signed-off-by: Joakim Roubert <joakimr@axis.com>
  • Loading branch information
joakimr-axis authored Dec 1, 2023
1 parent 66d83af commit 311d990
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 54 deletions.
8 changes: 8 additions & 0 deletions .github/super-linter.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
LINTER_RULES_PATH=/
VALIDATE_ALL_CODEBASE=true
IGNORE_GITIGNORED_FILES=true
VALIDATE_CLANG_FORMAT=true
VALIDATE_DOCKERFILE_HADOLINT=true
VALIDATE_JSON=true
VALIDATE_MARKDOWN=true
VALIDATE_YAML=true
14 changes: 4 additions & 10 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@ jobs:
with:
fetch-depth: 0

- name: Setup Environment
run: cat .github/super-linter.env >> "$GITHUB_ENV"

- name: Lint Code Base
uses: github/super-linter/slim@v5
uses: super-linter/super-linter/slim@v5
env:
LINTER_RULES_PATH: /
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
IGNORE_GITIGNORED_FILES: true
VALIDATE_CLANG_FORMAT: true
VALIDATE_DOCKERFILE_HADOLINT: true
VALIDATE_JSON: true
VALIDATE_MARKDOWN: true
VALIDATE_YAML: true
2 changes: 2 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
# Line length
MD013:
line_length: 100
# First line in a file should be a top-level heading
MD041: false
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at oss-conduct@axis.com. All
reported by contacting the project team at <oss-conduct@axis.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ git clone https://github.com/<your username>/modbus-acap.git
### Create your feature branch

```sh
git checkout -b <branch name>
git switch -c <branch name>
```

### Lint code after adding changes
Expand Down
14 changes: 5 additions & 9 deletions LINT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Lint of code base

This repo uses the
[super-linter](https://github.com/github/super-linter)
[super-linter](https://github.com/super-linter/super-linter)
to check the code base syntax and format on different file types.

## Linters in GitHub Action
Expand All @@ -21,13 +21,8 @@ which is possible since it is available as a container. Using
docker run --rm \
-v "$PWD":/tmp/lint \
-e RUN_LOCAL=true \
-e LINTER_RULES_PATH=/ \
-e VALIDATE_CLANG_FORMAT=true \
-e VALIDATE_DOCKERFILE_HADOLINT=true \
-e VALIDATE_JSON=true \
-e VALIDATE_MARKDOWN=true \
-e VALIDATE_YAML=true \
github/super-linter:slim-v4
--env-file .github/super-linter.env \
ghcr.io/super-linter/super-linter:slim-v5
```

## Run super-linter interactively
Expand All @@ -39,8 +34,9 @@ with Docker:
docker run -it --rm \
-v "$PWD":/tmp/lint \
-w /tmp/lint \
--env-file .github/super-linter.env \
--entrypoint /bin/bash \
github/super-linter:slim-v4
ghcr.io/super-linter/super-linter:slim-v5
```

Then from the container terminal, the following commands can lint the the code
Expand Down
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ application that exports events from
[AXIS Object Analytics](https://www.axis.com/products/axis-object-analytics)
(AOA) over
[Modbus](https://en.wikipedia.org/wiki/Modbus) using
[libmodbus](https://libmodbus.org/). The ACAP can be run in either server or
client mode, meaning two Axis devices can be used to showcase it.
[libmodbus](https://libmodbus.org/). The application can be run in either server
or client mode, meaning two Axis devices can be used to showcase it.

![Architectural overview](images/acap_architecture.svg)

*The purpose of this repo is to serve as boilerplate code and keep things
simple, hence it uses basic Modbus/TCP without TLS and such.*
> [!NOTE]
> The purpose of this repo is to serve as boilerplate code and keep
> things simple, hence it uses basic Modbus/TCP without TLS and such.
## Build

Expand Down Expand Up @@ -63,16 +64,16 @@ DOCKER_BUILDKIT=1 docker build --build-arg ARCH=aarch64 -o type=local,dest=. .

### Manual installation and configuration

Upload the ACAP file (the file with the `.eap` extension for the camera's
architecture) through the camera's web UI: *Apps->Add app*
Upload the ACAP application file (the file with the `.eap` extension for the
camera's architecture) through the camera's web UI: *Apps->Add app*

The parameter settings are found in the three vertical dots menu:

![Web UI Screenshot](images/web_ui_open_param_settings.png)

![Web UI Screenshot](images/web_ui_param_settings.png)

Select if the ACAP should run in Server or Client mode and what AOA scenario's
Select if the application should run in Server or Client mode and what AOA scenario's
events it should subscribe to (default: Scenario 1). If you run in Client
mode, also make sure you have set the right hostname/IP address for the Modbus
server you want to send the events to.
Expand All @@ -81,8 +82,8 @@ server you want to send the events to.

Use the camera's
[applications/upload.cgi](https://www.axis.com/vapix-library/subjects/t10102231/section/t10036126/display?section=t10036126-t10010609)
to upload the ACAP file (the file with the `.eap` extension for the camera's
architecture):
to upload the ACAP application file (the file with the `.eap` extension for the
camera's architecture):

```sh
curl -k --anyauth -u root:<password> \
Expand All @@ -101,7 +102,7 @@ curl -k --anyauth -u root:<password> \

Use the camera's
[param.cgi](https://www.axis.com/vapix-library/subjects/t10175981/section/t10036014/display)
to list and set the ACAP's parameters:
to list and set the application's parameters:

The call

Expand All @@ -127,8 +128,8 @@ curl -k --anyauth -u root:<password> \

## Usage

The ACAP can be run in either client mode or server mode (default), configured
with the application parameter `Mode`:
The application can be run in either client mode or server mode (default),
configured with the application parameter `Mode`:

In client mode, it will subscribe to
[AXIS Object Analytics](https://www.axis.com/products/axis-object-analytics)
Expand All @@ -140,9 +141,10 @@ parameter `Server`.
In server mode, it will listen for incoming TCP requests and print incoming
AOA status updates to the application log.

***NB!** The default Modbus/TCP port 502 requires running as a privileged user.
In order to run as a non-privileged user, this ACAP only allows ports in the
non-privileged range 1024–65535.*
> [!IMPORTANT]
> The default Modbus/TCP port 502 requires running as a privileged user.
> In order to run as a non-privileged user, this ACAP only allows ports in
> the non-privileged range 1024–65535.
## License

Expand Down
22 changes: 4 additions & 18 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"labels": ["dependencies"],
"packageRules": [
{
"updateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
}
],
"rebaseWhen": "behind-base-branch",
"vulnerabilityAlerts": {
"labels": ["security"]
},
"stabilityDays": 3,
"prCreation": "not-pending",
"dependencyDashboard": false
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}

0 comments on commit 311d990

Please sign in to comment.