Skip to content
Sign in

How-to

GitLab status writes

Updated

On this page

Let Zof post its verdict on each GitLab merge request as the zof/control status, and keep it posting. It takes about 3 minutes, and you need to be a company admin in Zof and have at least Developer access on the GitLab project.

Zof's GitLab connection only reads. Posting a status needs a second token, used only to write zof/control on one project. Until a project has one, its decisions show in Zof only.

Before you start

  • GitLab is connected in Integrations › GitLab.
  • You have a separate GitLab token for the project:
    • a personal access token or a project access token (group and fine-grained tokens aren't supported);
    • with only the api scope;
    • from an account with at least Developer access on the project.

Set up status writes

  1. Open Integrations › GitLab. Under Stop risky merges, click Set up.
  2. Pick the project, if the group has more than one.
  3. Paste the token into Separate GitLab token.
  4. Under Ends, keep When the token expires, or choose an earlier end (1 hour, 1 day, 7 days or 30 days).
  5. Tick I authorize Zof to write commit statuses to this GitLab project. and click Authorize status writes.

Zof checks the token with GitLab before saving it. Zof writes until the token expires in GitLab, or until the end you chose. To block merges until Zof's check passes, require zof/control in GitLab's merge settings.

Check that it worked

The project's line under Stop risky merges says "Status writes are working", with when Zof last checked. On a merge request Zof has checked since, GitLab shows the zof/control status.

When the token needs attention

Zof checks the token every day and before each status it posts. The GitLab card in Integrations, the GitLab page and the project's page show what it found:

What Zof showsWhat it meansWhat to do
"Status writes are working · checked 2h ago"The token worked at the last check.Nothing.
"Token expires in 3 days. Replace it."The token, or the end you chose, is 7 days away or less. Zof still posts.Replace the token before then.
"Zof stopped posting statuses: the token expired. Replace it."The token or the end you chose has passed.Replace the token.
"Zof can't post statuses: the token was revoked or no longer has the right access. Replace it."GitLab refused the token: it was revoked, made inactive, or its account lost access.Replace the token.
"Zof can't post statuses: the token's access changed. Replace it with a token that has only the api scope."The token's scopes changed.Replace it with a token that has only api.
"Status writes are set up. Zof hasn't checked the token yet."Zof hasn't finished its first check.Check again later.

While Zof can't post, merge requests on a project that requires zof/control can't merge.

Zof also tells company admins, in the bell and by email, the next time an admin opens Integrations or the GitLab page after a token's state changes. Each change is told once, however often the pages are opened. Until an admin opens one of them, the change shows only on those pages. If your company has Slack connected and an admin picked a channel for Integration problems in Integrations › Slack, it posts there too. No message ever includes the token.

Replace a token

  1. Create a new token in GitLab, as in Before you start.
  2. In Zof, click Replace token on the GitLab card or next to the project on the GitLab page.
  3. Paste the new token, choose when it ends, tick the box and click Replace status-write permission.

The new token takes over at once. Revoke the old one in GitLab.

Turn status writes off

On the GitLab page, open Set up for the project and click Revoke Zof status-write permission. Zof stops posting at once. Statuses already posted stay in GitLab, and the token stays valid in GitLab until you revoke it there.

Only company admins can set up, replace or revoke status writes. Members see the decisions in Zof.

Next steps