ci: add the plugin integration workflow and CodeQL - #102
Open
somethingwithproof wants to merge 3 commits into
Open
ci: add the plugin integration workflow and CodeQL#102somethingwithproof wants to merge 3 commits into
somethingwithproof wants to merge 3 commits into
Conversation
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>
Contributor
There was a problem hiding this comment.
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.ymlwith 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.ymlto run CodeQL forjavascript-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.cnfwill not expand~when it comes from a variable/env value, so thesemysql $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 thelocalhostuser entry in MySQL auth tables. Use an explicit$HOMEpath 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 installis being executed viasudo, 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.
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The plugin had no workflows, only issue and pull request templates. Five sibling plugins carry
plugin-ci-workflow.ymland two carrycodeql.yml; this follows that shape..github/dependabot.ymlis untouched. #92 merged its version and this branch adds only the two workflow files.Three jobs
integration-testis the house pattern: real Cacti, MySQL, Apache, install throughplugin_manage.php, run the poller. The gpsmap-specific part adds a Device with coordinates and a matching Map Template before polling, then assertsall.xml,all.kmlandall-top.htmlexist and thatall.xmlcontains 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.phpexits 1 on an unknown id, and there is nohost_templatewith id 0.syntax-floorlints at PHP 8.0, the floorcompat = 1.2.15implies. The house matrix starts at 8.1, so it would not catch syntax the declared minimum cannot run.unit-testruns the standalone suite and the coverage gate, guarded withif [ -f ]so this can land ahead of the branches that add them.CodeQL
Analyses
javascript-typescriptonly, 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.ymlin the siblings pins,plugin-ci-workflow.ymldoes not. This pins throughout.