Skip to content

Commit c3694e2

Browse files
committed
[cli] Update docs
1 parent a1c2f06 commit c3694e2

File tree

4 files changed

+124
-29
lines changed

4 files changed

+124
-29
lines changed

cli/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ nix build .#macos64.tarball
5757

5858
```bash
5959
source <(anti --bash-completion-script "$(which anti)")
60-
antij(){ anti "$@" | jq .result; }
60+
antij() {
61+
result=$(anti "$@")
62+
if [ "$(echo "$result" | jq '.error')" != "null" ]; then
63+
echo "$result" | jq
64+
else
65+
echo "$result" | jq '.result'
66+
fi
67+
}
6168
complete -o filenames -F _opt_env_conf_completion_anti antij
6269
```
6370

cli/docs/oracle-role.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ antij token | jq .state
4242

4343
Critically the owner matches the wallet owner.
4444

45-
## Publishing the oracle configuration
46-
47-
Before requesters can request test-runs, the oracle should select the agent identity and in general expose validation parameters so that the requesters and the agent can pre-validate their requests.
48-
49-
This is done with the `anti oracle config set` command.
50-
51-
52-
```bash
53-
anti oracle config set --min-test-duration MIN_TEST_HOURS --max-test-duration MAX_TEST_HOURS --agent-pkh PUBLIC_KEY_HASH
54-
```
55-
56-
This will end up in a fact and so we can inspect it with the `anti facts` command.
57-
58-
```bash
59-
antij facts config
60-
```
61-
6245
## Updating the anti token
6346

6447
The main responsibility of the oracle is to include change requests in the Antithesis token.
@@ -86,3 +69,24 @@ To delete the Antithesis token, you can use the `anti oracle token delete` comma
8669
```bash
8770
anti oracle token delete
8871
```
72+
73+
## Publishing the oracle configuration
74+
75+
Before requesters can request test-runs, the oracle should select the agent identity and in general expose validation parameters so that the requesters and the agent can pre-validate their requests.
76+
77+
This is done with the `anti oracle config set` command.
78+
79+
80+
```bash
81+
anti oracle config set --min-test-duration MIN_TEST_HOURS --max-test-duration MAX_TEST_HOURS --agent-pkh PUBLIC_KEY_HASH
82+
```
83+
84+
In this situation the oracle is acting like a user and so this request will end up in the Antithesis token as a request for change.
85+
86+
*Apply the token update command to commit the request to the Antithesis token*
87+
88+
This will end up in a fact and so anyone can inspect it with the `anti facts` command.
89+
90+
```bash
91+
antij facts config
92+
```

cli/docs/requester-role.md

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,121 @@ Be careful that there is no imperativity here, so i.e. you cannot unregister a u
1616

1717
### Registering a user public key
1818

19-
To register yourself as a user, you can use the `anti requester register-user` command.
19+
To register yourself as a user, you can use the `antij requester register-user` command.
2020

2121
```bash
22-
anti requester register-user --platform github --username alice --pubkeyhash AAAAC3NzaC1lZDI1NTE5AAAAIO773JHqlyLm5XzOjSe+Q5yFJyLFuMLL6+n63t4t7HR8
22+
antij requester register-user --platform github --username alice --pubkeyhash AAAAC3NzaC1lZDI1NTE5AAAAIO773JHqlyLm5XzOjSe+Q5yFJyLFuMLL6+n63t4t7HR8
2323
```
2424

2525
As with all other requests, once submitted regularly you have to wait for the oracle to merge your request into the Antithesis token.
2626

27-
You can use the `anti token` command to inspect your pending requests in the Antithesis token.
27+
You can use the `antij token` command to inspect your pending requests in the Antithesis token.
2828

29-
You can use the `anti facts` command to query the Antithesis token and see if your user is part of the facts.
29+
You can use the `antij facts` command to query the Antithesis token and see if your user is part of the facts.
3030

3131
```bash
32-
anti token | jq '.result.requests' "
32+
antij token | jq '.result.requests' "
3333
```
3434
3535
Until your requests is there, you cannot proceed with the next steps.
3636
37-
As with all requests to an mpfs you can retract your request using the `anti retract` command, anytime before the oracle merges it into the Antithesis token.
37+
As with all requests to an mpfs you can retract your request using the `antij retract` command, anytime before the oracle merges it into the Antithesis token.
3838
3939
Get the `outputRefId` of your request from pending requests command output and use it to retract your request
4040
4141
```bash
42-
anti retract -o 9ec36572e01bca9f7d32d791a5a6c529ef91c10d536f662735af26311b2c8766-0
42+
antij retract -o 9ec36572e01bca9f7d32d791a5a6c529ef91c10d536f662735af26311b2c8766-0
4343
```
44-
ATM the oracle is not able to justify a request rejection. But anti cli will apply the oracle validation before submitting it, so rejections will be caught before submitting the request.
44+
ATM the oracle is not able to justify a request rejection. But antij cli will apply the oracle validation before submitting it, so rejections will be caught before submitting the request.
4545
4646
### Unregistering a user public key
4747
48-
To unregister a user, you can use the `anti requester unregister-user` command.
48+
To unregister a user, you can use the `antij requester unregister-user` command.
4949
5050
```bash
51-
anti requester unregister-user --platform github --username alice --pubkeyhash AAAAC3NzaC1lZDI1NTE5AAAAIO773JHqlyLm5XzOjSe+Q5yFJyLFuMLL6+n63t4t7HR8
51+
antij requester unregister-user --platform github --username alice --pubkeyhash AAAAC3NzaC1lZDI1NTE5AAAAIO773JHqlyLm5XzOjSe+Q5yFJyLFuMLL6+n63t4t7HR8
5252
```
53+
54+
### Registering a role
55+
56+
This is necessary to register a user as a github repository antitheisis test requester.
57+
58+
Before you do this make sure your repository CODEOWNERS file contains a line like this:
59+
60+
```
61+
antithesis: @your-github-username
62+
```
63+
64+
You can have as many user as you want but registering them as test-run requesters has to be done one by one.
65+
66+
To register a role, you can use the `antij requester register-role` command.
67+
68+
```bash
69+
antij requester register-role --platform github --username alice --repository yourorg/yourrepo
70+
```
71+
72+
> Registering a role is not enough to gain rights to request test-runs. Your repository have to be white-listed by the agent. This requires you to get in contact with the agent and ask them to white-list your repository.
73+
74+
### Unregistering a role
75+
76+
```bash
77+
antij requester unregister-role --platform github --username alice --repository yourorg/yourrepo
78+
```
79+
80+
## Test-runs
81+
82+
83+
### Setup
84+
85+
Once you are registered as a user and a role, you can request test-runs.
86+
87+
Before doing that make sure you have a commit in your repository containing a directory with "valid" test assets inside.
88+
89+
You can obtain a set of standard test assets by running the following command:
90+
91+
If you are in your repository directory, you can run:
92+
93+
```bash
94+
antij requester generate-assets -D ./path/to/your/test/directory
95+
```
96+
97+
Once you modified them you can try to run them locally with the `antij requester test-run` command.
98+
99+
```bash
100+
antij agent test-run -D ./path/to/your/test/directory
101+
```
102+
103+
Then commit and push the changes to your repository.
104+
105+
### Requesting a test-run
106+
107+
Before proceding be careful to set the necessary signing assets in your environment variables.
108+
```bash
109+
Which key selector to use from the SSH file
110+
env: ANTI_SSH_KEY_SELECTOR STRING
111+
112+
Path to the SSH private key file
113+
env: ANTI_SSH_FILE FILEPATH
114+
115+
Password to the decrypt the SSH private key
116+
env: ANTI_SSH_PASSWORD STRING
117+
```
118+
119+
The file at ANTI_SSH_FILE FILEPATH is the encrypted ssh private key matching the user registration.
120+
121+
To request a test-run, you can use the `antij requester create-test` command.
122+
```bash
123+
antij requester create-test --platform github --username alice --repository yourorg/yourrepo --directory ./path/to/your/test/directory --commit your_commit_hash --try 1 --duration 2
124+
```
125+
126+
You can request multiple test-runs for the same commit but you have to specify a different `--try` number for each request.
127+
128+
### Checking the test-run status
129+
130+
You can check the status of your test-run requests with the `antij facts test-run` command.
131+
132+
```bash
133+
antij facts test-run pending
134+
```
135+
136+

cli/src/User/Requester/Options.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ requesterCommandParser =
118118
$ Box <$> addRoleOptions
119119
, command "unregister-role" "Remove a user from a repository"
120120
$ Box <$> removeRoleOptions
121-
, command "generate-asssets" "Generate assets for a test run"
121+
, command "generate-assets" "Generate assets for a test run"
122122
$ Box . GenerateAssets <$> downloadAssetsDirectoryOption
123123
]
124124

0 commit comments

Comments
 (0)