Fistron docs

fistron.io

Fistron in your CI

In your pipeline, Fistron works on every change by itself: each pull or merge request is reviewed by your team’s rules and its change assessed, each failed build analysed while its environment still exists. Nobody switches anything on in Fistron’s GUI, and nobody has to notice a failure first. That is the difference from asking Fistron afterwards, from its GUI, to analyse a failed build or fix a test: the pipeline is proactive, the GUI is there when you want to look closer.

Fistron sets it up as one pull or merge request with the files for your CI. It never edits your .gitlab-ci.yml or Jenkinsfile: the request says, word for word, what to add there.

In the GUI

  1. On the project’s page, choose Add Fistron to your CI (also a step of the solutions that run in CI: the review of your pull requests, the AI-written code, a failed build). Set it up in CI on the project’s Pull and merge requests (in Review a request, and above the tabs until the CI job uploads a change’s risk) and, for a repository of a project, in Repository settings opens it with that repository chosen.

  2. What Fistron does in your pipeline: Each has a default:

    • Review each pull or merge request: The summary only (in the run’s summary and its reports) or Also as a comment on the pull or merge request (never an approval);
    • Assess each change and its risk (the review comes with it);
    • Analyse a failed build (RCA): every cause of each failed job and its fix, verified by your own CI, on the pull or merge request;
    • Upload the reports to this control plane, on by default: for Jenkins and a self-managed GitLab, so that the project’s page shows that the pipeline reports.

    On GitHub Actions all of it is fistron-action, on GitLab.com Fistron’s components fistron and fistron-change; they upload nothing, and the project’s agent reads what each run did (Fistron’s runs in your CI, below). Jenkins and a self-managed GitLab get Fistron’s own jobs, which upload.

  3. Your CI: Choose the repository and Find my CI: the project’s agent reads, without changing anything, which CI builds it and how its workflows, stages and jobs are named. Change what it found if you need to: The CI that builds it, The workflows to watch (GitHub Actions) or The stage of the analysis (GitLab CI: after your tests, before a teardown).

  4. One pull request: You see the files and Your guide: what to do before merging, for this repository, with its names, every variable, secret and credential, the token’s permissions and links to where they are set.

  5. With the upload (Jenkins, a self-managed GitLab), the pipeline needs the project’s token; the action and the components need none:

    • Issue the token: it is shown once, with Copy and a link to the repository’s secrets (Jenkins: the folder’s credentials). Issued again, the former stops working.
    • Set it for me: the organisation’s agent sets the secret and the variables in the repository itself. Only where an admin allows the action set-ci-secret in Platform access; you never see the token. Not for Jenkins, whose credentials are added by hand.
  6. Open the pull request, review it and merge it. With the action or the components, the project’s agent reads the repository’s runs every 15 minutes from then on, unless a schedule does already; a schedule is a manager’s, so for an engineer the step says that a manager sets it.

Each run of the action or the component asks this control plane for its licence and the project’s models with its identity token (Without a secret, below): the team’s licence, no key stored in the repository.

Once the pipeline runs, the project’s page lists Your pipelines: for each repository the last upload, what came (analyses, change assessments, reviews) and what of your choices has not come yet, and why: nothing uploaded yet, nothing for 14 days, the token revoked or expired. A pipeline set up by hand is listed too, by the names its documents carry (ci/<repository>/...), whatever token it uploads with, and so is a repository whose runs the project’s agent reads (Fistron’s runs in your CI, below). A month before a token expires, the page says so: Issue it again or Set it for me renews it before the pipeline goes quiet.

Without a secret

A run’s licence and upload without a stored secret

On GitHub Actions and GitLab CI a run proves which repository it is with an identity token the platform signs, and needs no token stored in the repository:

  1. When you save a repository’s setup, the project’s agent reads the repository’s id and its owner’s. Your pipelines says when.
  2. Each run sends its identity token to this control plane (fistron ci-licence). The control plane checks it against those ids and answers with a token of this project only, for an hour, and the models the project chose on its Models page.
  3. The run calls those models through this control plane with that token, so no model key is stored in the repository either; at the project’s monthly cap a call is refused and the run goes on with Fistron’s rules.
  4. The run uploads its reports with that token.

The job needs permissions: id-token: write on GitHub, and id_tokens: FISTRON_ID_TOKEN: aud: fistron on GitLab CI (ci-job.md). A repository set up in two projects uploads to neither until one removes it. Jenkins and a self-managed GitLab keep the project’s token.

Fistron’s runs in your CI

Where Fistron runs in a repository’s CI as fistron-action (GitHub Actions) or as Fistron’s GitLab components, each run keeps what it did in its artifact: fistron (on GitLab the change’s job keeps fistron-change). The project’s agent reads it with its own token for the repository: your CI needs no token of this control plane and no way in to it, so this works with a control plane inside your company’s network too. Besides a failed run’s causes and fixes, it reads each pull or merge request’s change assessment, its risk and its review, which the project’s Pull and merge requests then show.

On the project’s page, under Add Fistron to your CI, Fistron’s runs in your CI lists each repository whose runs are read:

Add Fistron to your CI adds the repository by itself when it sets up the analysis by the action or the component. Read the runs of adds one of the project’s repositories on GitHub or GitLab by hand: it is checked at once and then every 15 minutes, unless you choose otherwise. A check downloads only what it has not read before. A run’s documents (its status, the causes of each failed job, its analysis) are the project’s, named as its pipeline’s (ci/<repository>/run-<id>/..., on GitLab .../pipeline-<id>/...), so Your pipelines counts them too.

The project’s agent needs the repository in its [acquisition.github] repositories or [acquisition.gitlab] projects, and a token that reads the repository’s Actions artifacts (GitHub) or its jobs and their artifacts (GitLab). On GitLab the component’s job is fistron unless its input job-name names another.

The artifact holds no log, licence or token. In a public repository anyone who can read the repository can download it, as they can read its logs.

In the local UI

Add Fistron to your CI under Setup and settings does the same for the repositories of your fistron.toml, without a control plane: the reports stay the run’s artifacts, and no token is needed. Fistron opens the pull or merge request with the write path of your [actions] (Setup).

What each CI gets

CI Files What you add Secrets and variables
GitHub Actions .github/workflows/fistron.yml (RCA) and .github/workflows/fistron-pr.yml (the change and its review), both fistron-action nothing: they run after your workflows (workflow_run); for a fix verified by your CI, workflow_dispatch: in the workflow the guide names none: the repository’s GITHUB_TOKEN, the licence by the run’s identity token (id-token: write)
GitLab CI on GitLab.com .gitlab/fistron.gitlab-ci.yml: Fistron’s components fistron (RCA) and fistron-change (the change and its review) the include of that file in .gitlab-ci.yml; merge request pipelines for the change FISTRON_GITLAB_TOKEN (masked, not protected; Developer, api): it also posts the review
GitLab CI, self-managed .gitlab/fistron.gitlab-ci.yml, hidden jobs the include and two jobs in .gitlab-ci.yml FISTRON_GITLAB_TOKEN (masked, read_api); to post the review FISTRON_GITLAB_WRITE_TOKEN (api); for the upload the same as GitHub, the jobs’ id_tokens instead of the secret
Jenkins .jenkins/fistron.groovy, the stages change() and rca() the stage loaded in the Jenkinsfile, change() for pull request builds, rca() in post { failure } the credentials fistron-git-token, fistron-jenkins, with the upload fistron-cp-token; to post the review fistron-git-write-token
Bitbucket Pipelines none from the GUI yet: you add the step a final step with Fistron’s image and fistron ci in bitbucket-pipelines.yml (the RCA only; the change and its review are not built for Bitbucket yet) FISTRON_CONFIG_TOML and FISTRON_BITBUCKET_TOKEN (secured; an access token with Repositories, Pull requests and Pipelines: Read)

Bitbucket Pipelines, by hand

Bitbucket runs no step after a failed one, but it runs the pipeline’s final step whatever the others did. Add Fistron there, and keep your test steps’ JUnit files as artifacts so that it reads them:

      - step:
          name: api tests
          script:
            - pytest --junitxml=test-results/junit.xml
          artifacts:
            - test-results/**
      - final:
          name: fistron
          image: ghcr.io/fistron-io/fistron:<version>
          script:
            - printf '%s' "$FISTRON_CONFIG_TOML" > /tmp/fistron.toml
            - fistron ci --config /tmp/fistron.toml --output fistron-report
          artifacts:
            - fistron-report/**

FISTRON_CONFIG_TOML holds the configuration with [acquisition.bitbucket] (the token’s variable and the repositories Fistron may read, as workspace/repo_slug). Each step that failed gets its report in fistron-report/reports/.

What runs when

When What Fistron does Where you see it
Each pull or merge request assesses the change and its risk, reviews it by your team’s rules, names the tests the change needs the run’s summary; the request, when you chose Also as a comment; the project’s Pull and merge requests, read by the project’s agent (the action, the components) or uploaded (Jenkins, a self-managed GitLab)
A failed run of your pipeline finds every cause while its environment still exists and proposes each fix verified by your CI (the action, the component); Jenkins and a self-managed GitLab analyse the run’s summary and the request; Fistron’s runs in your CI; with the upload (Jenkins, a self-managed GitLab), the project’s failures
On a schedule the Daily CI review, flaky tests the project’s schedules in the control plane (Run and schedule work), never your pipeline

Pull and merge requests from forks

A fork’s code never runs where a secret is. On GitHub, the review and the analysis of a fork’s pull request run after its pipeline, in a separate run of your default branch’s workflow (workflow_run), which reads the request through GitHub and never checks out its code with a secret; a pull_request_target workflow gets no licence. On GitLab, a merge request from a fork runs in the fork’s project, without your variables: the project’s agent reviews it from the control plane instead (Review pull and merge requests).

What it costs, and the cap

Fistron never fails your build: an analysis, a review or an upload that fails is said in the log. A team that wants the review to stop a merge uses its platform’s own required checks on the review’s result.

On-premises, or behind your own CA

The pipeline reaches your control plane at the address of Your pipelines (FISTRON_CP_URL). Behind a certificate of your own CA, give Fistron’s job a file with the CA in SSL_CERT_FILE, for example a file variable of GitLab. That file replaces the public CAs, so when the job also reaches GitHub, GitLab.com or a model’s API, make it a bundle of the public CAs and yours. Air-gapped, the runners pull Fistron’s image from your registry (Install without internet access).

Check that it works

  1. Open a small pull or merge request, for example a comment in a test.
  2. When its pipeline finished, read Fistron’s job: its summary names the change’s risk and the review’s findings, or why it did not run.
  3. With the upload, the project’s Your pipelines lists the repository with the time of its last upload and what came.
  4. Make a test fail on a branch: the failed run’s Fistron job names its cause and offers its fix on the request; Fistron’s runs in your CI shows the run within 15 minutes (or at Check now).

Troubleshooting

What you see Why What to do
Fistron’s job does not start GitHub runs a workflow_run workflow only from the default branch Merge the pull request that added it, then open another
no licence: the analysis runs with Rules The run’s identity token was refused, or no secret Read the reason in the job’s log; on GitHub give the job permissions: id-token: write
Your pipelines: nothing uploaded yet No run since the setup, or the upload’s token is missing Check FISTRON_CP_URL, FISTRON_CP_PROJECT and the token in the repository’s settings
Your pipelines: the token revoked or expired The project’s token for the pipeline ended Issue it again, or Set it for me
The review is not on the request You chose The summary only, or the write token is missing Choose Also as a comment and set the write token the guide names
certificate verify failed in the job Your control plane’s certificate is of your own CA Give the job the CA, as above

By hand or from the command line

The same proposal without the GUI:

fistron propose setup --config fistron.toml --repository acme/shop \
  --ci jenkins --review review --upload \
  --cp-url https://fistron.example.com --cp-project shop

--ci is github-actions, gitlab-ci or jenkins (the platform’s own by default); --no-rca and --no-change leave those out, --review publish posts the review, --stage names GitLab’s stage. --dry-run says what it would write. The token for the upload is an automation token of the project (API tokens). The templates and every variable are in ci-job.md; the proposal in setup.md.