Time: 25 minutes. Track: operator. Before this: operator lesson 1.
By the end of this lesson you will be able to:
- create a repository and work in it;
- restrict a folder, and list who may read and write it;
- enroll a runner, and stop it.
A second repository
A development forge starts with one repository, main. An administrator creates more; each has its own history, its own changes and its own Raft group, so a busy one never slows another:
$ af-server --dev
...$ source ~/af-dev/dev/env
$ af create-repository web --reason "the web front end"
done: it took effect at once, on your word as an administrator
$ af --repository web workspace add ~/web
Workspace at /home/you/web
Paths: **
main has no landing yetA repository names its objects in SHA-256, Git’s newer hash, unless it is made asking for SHA-1: ids are then 40 hex digits instead of 64, as for a history that must keep the SHA-1 ids it already has. The choice is the repository’s for good:
$ af create-repository legacy --objects sha1 --reason "kept in SHA-1"
done: it took effect at once, on your word as an administratorA repository’s name is plain, and given once:
$ af create-repository web
Error: PermissionDenied: the organization has "web" already
[1]
$ af create-repository 'bad name'
Error: "bad name" is no repository's name: a-z, A-Z, 0-9, ., - and _
[1]Restrict a folder
Every folder is open to every reader and writer until it is restricted. A restriction covers the folder and everything under it, and names the teams and people who may read and write there:
$ af folder restrict payroll --person dev@localhost --reason "salary data"
done: it took effect at once, on your word as an administrator
$ af folder list
payroll (reads and writes): person dev@localhostThe forge enforces it wherever code moves: a sync never sends a file of it to anyone else, a snapshot that writes it without access is refused, and every agent born from a person has no more access than that person.
Enroll a runner
Runners run the tests that decide what lands. A runner makes its own key; an administrator enrolls it by the public half:
$ af-runner key ~/runner.key | tee ~/runner.pub
3587e5ded725cf9ea256bdf9f0a8d1251e0cdc34ef50cb85c36abc97cf47d315
$ af enroll-runner "$(cat ~/runner.pub)" --name build-01 | tee ~/runner.id
done: it took effect at once, on your word as an administrator
born b6eef2b97441410492977bcd30202e60c04417de513bfeca8850bf6210c5ae06On its machine, the runner then runs until it is stopped, taking jobs from the forge; see Set up a runner. When the machine is retired, stop the runner, and the forge refuses it from then on:
$ af stop "$(sed -n 's/^born //p' ~/runner.id)" --reason "machine retired"
stop reference 49b2845e2b8bf150cdb043cd2a4836df7194f96193d3c25efb5ba8dce4038340
stopped b6eef2b97441410492977bcd30202e60c04417de513bfeca8850bf6210c5ae06Exercises
-
Restrict a second folder for writing only, so everyone can still read it.
$ af folder restrict docs/policies --person dev@localhost --only-writes --reason "policy is changed by its owners" done: it took effect at once, on your word as an administrator $ af folder list docs/policies (writes): person dev@localhost payroll (reads and writes): person dev@localhost
Check your understanding
Who may read a folder that is restricted for writing only?
Everyone who may read the repository. Only the teams and people it names may write in it.
Where does a runner’s private key live?
In the file it made, on its own machine. The forge only ever holds the public half, which an administrator enrolls.
Next
Operator lesson 3: A cluster joins two more nodes and keeps landing with one down. Lesson 4 needs an identity provider, more than a development forge.