Guide

Connect a task tracker

This tutorial connects a private task tracker to a GAOS product in seven steps. The tracker implements the contract GAOS publishes; GAOS never learns anything about the tracker except an address, a certificate, a credential, the products it may serve and, optionally, its web base. The example tracker is an invented one, Acme Tasks, running on a private address. What a binding then does is described on Task tracker (D-118).

Before you start

You need: a tracker you can change, a GAOS instance you deploy, an auto-fix admin account on its back office (GAOS_AUTOFIX_ADMINS), and the product listed in GAOS_PR_TEMPLATE_PRODUCTS. Acme Tasks here listens on 10.20.0.5:9443, a private address; its product code is ACME.

1. Implement the contract

Download task-tracker-v1.proto and generate a server stub with your language’s gRPC tools (for Go, protoc-gen-go and protoc-gen-go-grpc). Implement the service gaos.tasktracker.v1.TaskTracker:

MethodYour server must
ListPeopleReturn active people only, in a stable order (by id), one page at a time; honour any page_size up to 100; set total to the number of active people across all pages. Set github_verified only for a login you have checked belongs to the person, and whatsapp_active only when the person agreed to receive messages.
GetTaskAnswer NOT_FOUND for a missing task and for a task outside the credential’s products; never OK without a task. Map your states to ACTIVE (anything not archived or deleted), ARCHIVED or DELETED; set product_code and the QA’s person id. Since v0.89.0 also set url (the task’s page), title (one line) and assignee_ids (every assignee’s person id), or leave them empty.
AddCommentAdd the text (at most 1500 characters) to the task’s discussion. You may rate-limit it.
RecordMergeSince v0.89.0 (optional: without it GAOS only pauses its merge write-back). Set the task’s release status to merged and no further, for a task of product_code assigned to person_id; answer RECORDED, ALREADY, NEEDS_DEV_DONE with a nonce, or REFUSED with a reason. The rules are below and on Recording the merge.

Answer UNAUTHENTICATED or PERMISSION_DENIED for a refused credential, and RESOURCE_EXHAUSTED when GAOS should stop calling (a lock-out after failed logins, or a rate limit): GAOS then pauses this connection for up to an hour. INVALID_ARGUMENT is for a malformed request; any other code is read as “unavailable”. Keep each answer to one uncompressed message under 1 MiB. The contract is v1: it may gain fields, methods and enum types, and a published enum never gains a value (D-132).

Implementing RecordMerge

GAOS calls RecordMerge once per task, after the last open pull request naming it has merged or closed. First map your own states onto the contract’s four work states — in development (started, not yet declared finished), development-done (declared finished, including any later review step), not started and on hold — and name the first step of your release status, merged.

2. Issue a narrow credential

Create a client account for GAOS that authenticates with HTTP Basic (client-id:secret) and may call only the methods above, on only the tracker products GAOS should see (here, ACME). Give it an expiry. Never give it an administrator role: the credential lives in a file on the GAOS host.

RecordMerge has two halves, and they are separate grants. The plain half lets GAOS set the release status to merged and nothing else. The development-done half (mark_dev_done) lets GAOS mark an in-development task development-done on an assignee’s behalf after that person accepted on GAOS’s one-time link. Grant it only if you accept that whoever holds this credential could do the same for any in-development task of the granted products (a nonce stops a caller without the credential, not its holder). Withheld, GAOS answers the author “the task tracker does not accept confirmations from GAOS” and leaves the task as it is.

3. Serve TLS

GAOS pins the tracker’s certificate as its only root and checks the IP, so a self-signed certificate for the private address is enough. Make one on the tracker host and keep the key there:

bash
openssl req -x509 -newkey rsa:3072 -sha256 -days 1095 -nodes \
  -keyout acme-grpc.key -out acme-grpc.crt -subj "/CN=acme-tasks" \
  -addext "subjectAltName=IP:10.20.0.5,IP:127.0.0.1"
# serve gRPC over TLS 1.3 with acme-grpc.crt and acme-grpc.key;
# copy only acme-grpc.crt (never the key) to the GAOS host

GAOS speaks plaintext only towards a loopback address (tests, or a local tunnel). Any other address needs the certificate.

4. Install a connection profile

On the GAOS host, a connection is one folder under the profiles folder (deploy/stacks/prod.pr-trackers/, mounted read-only as GAOS_TRACKERS_DIR). Give it a neutral name: it is shown on the Integrations view, logged and stored in events. Make one profile per tracker credential.

bash
cd deploy/stacks
install -d -m 700 prod.pr-trackers/acme
echo "10.20.0.5:9443"   > prod.pr-trackers/acme/endpoint
install -m 600 /path/to/acme-grpc.crt prod.pr-trackers/acme/ca.pem
printf 'p-1 ACME\n'     > prod.pr-trackers/acme/products
echo "https://tasks.acme.example/" > prod.pr-trackers/acme/web   # optional: task links
# the credential: type it into an editor, never on a command line you keep
install -m 600 /dev/null prod.pr-trackers/acme/credentials
"${EDITOR:-vi}" prod.pr-trackers/acme/credentials      # one line: client-id:secret
chmod 600 prod.pr-trackers/acme/*
FileContent
endpointip:port, an IP literal.
ca.pemThe tracker’s certificate. Required unless the IP is loopback.
credentialsclient-id:secret. Leave it empty to install the profile switched off.
productsOne line per GAOS product allowed to use the profile: <product-id> <tracker-code>, or <product-id> * for any code. # starts a comment.
webOptional: the tracker’s web base, https://host[:port]/[path/], ending in /. A task’s url is shown in a merge notice or on the confirmation page only when it lies under this base. Leave it out for no task links.

The folder must be mode 700 and every file mode 600; links are refused. deploy/check-stacks.sh checks this, and a prod deploy creates an empty prod.pr-trackers when it is missing. Then redeploy or restart the dashboard: profiles are read at start-up. Do not point two profiles at the same tracker with the same credential — that would let two GAOS products bind the same tracker product.

5. Bind the product

Sign in to the back office, open Integrations, find the Task tracker block. In the product’s row choose the connection acme, type the tracker product code ACME, tick enabled and save. The save answers 422 when the profile is not installed or its products line does not allow the product with that code, and 409 when another product already holds the same connection and code.

6. Verify it

bash
set +o history
grpcurl -cacert acme-grpc.crt -import-path . -proto task-tracker-v1.proto \
  -H "authorization: Basic $(base64 -w0 < credentials)" \
  -d '{"task_code":"ACME-FEATURE-00001"}' \
  10.20.0.5:9443 gaos.tasktracker.v1.TaskTracker/GetTask
set -o history

7. Troubleshoot

An admin sees the reason after unusable: on the connection’s row; it names the file and the rule, never the file’s content.

You seeWhat to do
endpoint is missing, endpoint must be ip:port, endpoint must be an IP literal, not a host nameWrite one line ip:port into endpoint.
a tracker is reached over TLS only: add ca.pem, ca.pem holds no PEM certificateCopy the tracker’s certificate (PEM, not the key) into ca.pem.
<file> must be mode 600, the profile folder must be mode 700chmod 600 the files, chmod 700 the folder.
<file> is a symbolic link, <file> is not a regular fileCopy the file in; links are refused.
products is missing, products line N is not <product-id> <code|*>Fix the products file: one product id and one code (or *) per line.
credentials holds no client-id:secret lineWrite one line client-id:secret.
off (credentials is empty)Fill credentials, then restart.
Chip Unusable, breaker authThe tracker refused the credential, or locked GAOS out. Fix the account; rewriting credentials is enough to retry.
Chip Unusable, connection fineThe binding names a connection that is not installed, or whose products line no longer allows the product and code.
Chip Degraded: unavailable or staleThe tracker does not answer. Check the address, the port and the TLS listener.
Chip Degraded: unchecked 10 of 10The tracker answers GetTask without a state GAOS knows, or OK without a task. Fix the mapping (step 1).
Chip Degraded: not in the template listAdd the product to GAOS_PR_TEMPLATE_PRODUCTS and redeploy.
A notice still goes to the groupThe author has a GAOS contact (it wins), the login is not verified in the tracker, or the number is not active.
Connection row: merge write-back: nomergeThe tracker does not implement RecordMerge, or the credential is not granted it. Merges wait, are retried hourly and are given up after 24 hours, to the bell only.
Connection row: merge write-back: confirmations not grantedThe tracker refused mark_dev_done. Plain merges still record; for an hour no confirmation link is sent. Grant the development-done half (step 2) if you want it.
the web file is not an https base ending in /Fix web: https, a host, and a trailing /. Until then notices carry no task link.
A valid code is called unknownThe case differs (codes are matched exactly), the task belongs to another tracker product, or the credential cannot see that product.