Skip to content

ci: add the plugin integration workflow and CodeQL - #102

Open
somethingwithproof wants to merge 3 commits into
Cacti:developfrom
somethingwithproof:ci/plugin-workflows
Open

ci: add the plugin integration workflow and CodeQL#102
somethingwithproof wants to merge 3 commits into
Cacti:developfrom
somethingwithproof:ci/plugin-workflows

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

The plugin had no workflows, only issue and pull request templates. Five sibling plugins carry plugin-ci-workflow.yml and two carry codeql.yml; this follows that shape.

.github/dependabot.yml is untouched. #92 merged its version and this branch adds only the two workflow files.

Three jobs

integration-test is the house pattern: real Cacti, MySQL, Apache, install through plugin_manage.php, run the poller. The gpsmap-specific part adds a Device with coordinates and a matching Map Template before polling, then asserts all.xml, all.kml and all-top.html exist and that all.xml contains markers. Without those rows the poller hook produces nothing, so a straight copy of a sibling workflow would pass while testing nothing.

The template id is read from the database rather than hardcoded. add_device.php exits 1 on an unknown id, and there is no host_template with id 0.

syntax-floor lints at PHP 8.0, the floor compat = 1.2.15 implies. The house matrix starts at 8.1, so it would not catch syntax the declared minimum cannot run.

unit-test runs the standalone suite and the coverage gate, guarded with if [ -f ] so this can land ahead of the branches that add them.

CodeQL

Analyses javascript-typescript only, matching the sibling plugins. That is correct rather than an oversight: CodeQL has no PHP analyser, so for a Cacti plugin it covers the JavaScript. The PHP is covered by the syntax and integration jobs.

Pinning

Every action is pinned to a full commit SHA with a version comment, and each SHA was resolved against the API rather than copied on trust. Note the house style is split: codeql.yml in the siblings pins, plugin-ci-workflow.yml does not. This pins throughout.

Matches the workflow the other Cacti plugins carry, plus a PHP 8.0 syntax job
at the floor the INFO compat implies.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Copilot AI lite review requested due to automatic review settings August 17, 2026 00:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the first GitHub Actions CI automation for the gpsmap plugin, aligning it with sibling plugin repos by introducing a pinned “house pattern” integration workflow plus a JS-focused CodeQL workflow.

Changes:

  • Introduces plugin-ci-workflow.yml with three jobs: PHP 8.0 syntax floor linting, guarded standalone unit/coverage execution, and a full Cacti/MySQL/Apache integration run that installs/enables the plugin and validates gpsmap artefact output.
  • Adds codeql.yml to run CodeQL for javascript-typescript (covering the plugin’s JS surface) on PRs/pushes/schedule.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/plugin-ci-workflow.yml Adds PHP syntax floor, guarded unit/coverage, and full Cacti integration testing workflow (all actions pinned).
.github/workflows/codeql.yml Adds pinned CodeQL analysis for JavaScript/TypeScript with concurrency and minimal permissions.
Suppressed comments (2)

.github/workflows/plugin-ci-workflow.yml:156

  • --defaults-file=~/.my.cnf will not expand ~ when it comes from a variable/env value, so these mysql $MYSQL_AUTH_USR ... invocations may ignore the config file. Also, the script grants privileges to 'cactiuser'@'localhost' but later connects over TCP (-h 127.0.0.1), which won’t match the localhost user entry in MySQL auth tables. Use an explicit $HOME path and grant to the same host pattern used by the container user (typically %).
    - name: Initialize Cacti Database
      env:
        MYSQL_AUTH_USR: '--defaults-file=~/.my.cnf'
      run: |
        mysql $MYSQL_AUTH_USR -e 'CREATE DATABASE IF NOT EXISTS cacti;'

.github/workflows/plugin-ci-workflow.yml:169

  • composer install is being executed via sudo, which runs Composer as root. Composer commonly warns or changes behavior (e.g., disabling plugins) when run as root, and it shouldn't be needed here because the workspace permissions were already adjusted.
        cd ${{ github.workspace }}/cacti
        if [ -f composer.json ]; then
          sudo composer install --prefer-dist --no-progress
        fi

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/plugin-ci-workflow.yml
Comment thread .github/workflows/plugin-ci-workflow.yml Outdated
Without credentials the ping is denied and the container can stay unhealthy,
so the job never starts.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof somethingwithproof added the enhancement New feature or request label Aug 17, 2026
Ubuntu carries no libapache2-mod-php8.1 package, so every integration job
failed at apt with exit 100 before reaching Cacti. The PHP the tests run under
comes from setup-php, not apt, so the version does not need pinning here.

Matches plugin_monitor, whose matrix passes.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants