Fistron docs

fistron.io

Connect Jenkins

Fistron reads Jenkins and never writes to it: no build is started, changed or deleted. It reads the builds of the jobs you allow, their test reports (the JUnit plugin’s) and their console logs. A Jenkins inside your network is read by an agent in the same network; the agent connects to the control plane outbound only, so Jenkins is never exposed.

Before you start

Configure the agent

  1. Open Agents, then the agent’s Configuration, and add the Jenkins section with the jobs Fistron may read, by their full names (folders and name, as Jenkins shows them) (Set an agent’s configuration in the control plane); an agent that keeps its own file (without control_plane_config) has it in its fistron.toml:

    [acquisition.jenkins]
    base_url = "https://ci.example.com"
    user_env = "FISTRON_JENKINS_USER"
    token_env = "FISTRON_JENKINS_TOKEN"
    jobs = ["shop/main", "shop/nightly acceptance"]
    # ca_pem = """-----BEGIN CERTIFICATE----- ..."""   # a private CA, its PEM

    To allow every job of a folder, list the folder with /* (the jobs directly in it) or /** (the jobs anywhere below it, subfolders too), for example jobs = ["shop/**"]. jobs = ["**"] allows every job of the Jenkins; then the Jenkins user’s permissions decide what Fistron reads.

  2. Put the user and the token into the agent’s environment file (for example agent.env), never into fistron.toml and never into the control plane:

    FISTRON_JENKINS_USER=fistron-reader
    FISTRON_JENKINS_TOKEN=<the API token>
  3. Restart the agent once, for the variables. A later change of the jobs in the configuration needs no restart: the next work uses it.

Collect a job’s history

  1. Open the project’s Schedules page.
  2. Add a schedule of the operation history-collect with the platform jenkins and the job’s full name as the repository, for example shop/nightly acceptance.
  3. Schedule the core’s flaky operation after it for the flaky quarantine (Handle flaky tests and quarantine).

Analyze a failed build

Start case-import with the build’s URL (for example https://ci.example.com/job/shop/job/main/42/) and then analyze on the case, from the project’s Work page (Find out why a CI job failed). The build must be finished and failed or unstable.

Read the build’s artifacts too

A pipeline often archives the logs that explain a failure (the server’s and the clients’ logs, a debug archive) beside its console log. Name them in [acquisition.jenkins], on the agent’s Configuration page or in its file, so the RCA reads them:

artifacts = ["results/**/*.log", "results/**/spacewalk-debug*"]
artifact_members = ["**/*.log", "**/salt/*"]   # of an archive; default: *.log, *.txt, *.out

** stands for any directories, * for any name within one. An archive that matches is read in memory and only its files that artifact_members names are kept; nothing else of the build is read. The limits (max_artifacts, max_artifact_bytes, max_archive_bytes, max_artifacts_bytes) and what was left out are in jenkins.md. The files the RCA reads may go to its model like the console log: name only what your data class allows.

A pipeline that keeps its logs in its workspace and archives none (e.g. its testsuite’s results/<build>/logs, each node’s /var/log packed as <host>-logs.tar.xz) is read from the workspace instead, while it keeps that build’s files:

workspace_files = ["results/{build}/logs/*-server.*-logs.tar.xz", "results/{build}/logs/*-logs.tar.xz"]
artifact_members = ["var/log/rhn/*.log", "var/log/salt/*", "var/log/messages"]

{build} is the build’s number; the files are read in the patterns’ order, so the server’s logs come first within the limits. The account the agent reads Jenkins with needs the Workspace permission of the job: open the build’s Workspaces page with it to check.

A suite that publishes no test report to Jenkins (it writes Cucumber JSON) gives the CI history, and so the quality audit, no test. Name its report files, archived or in the workspace:

test_reports = ["results/{build}/cucumber_report/*.json"]

The CI history then reads each build’s files that match: its archived artifacts first, else its workspace’s, while the workspace keeps them.

The rules are the same on every CI: Test reports on every CI. The case of a failed build (Investigate a failed build, the Daily CI review’s RCA) reads the build’s Cucumber JSON beside its JUnit report, whatever Jenkins has: the files test_reports names, else its archived artifacts named like a Cucumber report (*cucumber*.json, or *.json under a folder named *cucumber*). Each failed scenario’s steps then come with their results and times, which a JUnit report converted from it may not name. A suite that leaves its Cucumber JSON only in the workspace needs test_reports for that.

A suite whose HTML report the build archives with the HTML Publisher often has its whole Cucumber JSON inside it, kept with every build (the workspace keeps only what later builds did not remove). Fistron finds it without any setting: the build’s console log names each HTML report the HTML Publisher archived ([htmlpublisher] Archiving at BUILD level ... to TestSuite_20Report), and Fistron looks in it for a Cucumber JSON by the usual names (cucumber_report.html.json, cucumber_report.json, cucumber.json, report.json, output.json, results.json).

When the file has another name, Fistron says so where you investigate the build: the report of Investigate a failed build (and the Daily CI review’s RCA) says that the test report names no step, which HTML report the build archived, and what to set. Name the file with report: and its path under the build, as the report’s address shows it (.../<build>/TestSuite_20Report/...):

test_reports = ["report:TestSuite_20Report/cucumber_report.html.json"]

To find the file: open the report’s (all files in zip), or download <build>/<report>/*zip*/<report>.zip, and look for a .json file in it that starts with `` (a list of features). A report: entry names one file whole, no pattern; a build without it says so and goes on. Set in test_reports, it replaces the search: name every file you want read.

Troubleshooting

You see Cause and fix
The job is not on the allowlist Add its full name to jobs, or its folder as folder/* or folder/**; folders are separated by /.
HTTP 401 or 403 The user or the token is wrong, or the user lacks Job/Read on the job.
The agent cannot connect The agent is not in a network that reaches Jenkins, or a private CA needs ca_pem in its configuration.
A build has no test cases The job publishes no JUnit test report.
Builds are missing from the history A build still running or without a git revision is left out.

Details: [jenkins.md.