Skip to content

Commit 9570318

Browse files
authored
Merge branch 'main' into sentinel-lib
2 parents b52945d + fc2d7e3 commit 9570318

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3709
-1210
lines changed

.github/workflows/docker-test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
types: [submitted]
55
pull_request:
66
types: [labeled]
7+
paths-ignore:
8+
- 'tools/**'
79

810
jobs:
911
eth_env:

.github/workflows/generate-go-docs.yaml

Lines changed: 187 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,70 +9,215 @@ on:
99

1010
jobs:
1111
generate_docs_new_pr:
12-
if: ${{ contains(github.event.issue.labels.*.name, 'generate_go_docs') }}
12+
name: Generate Go Docs
13+
if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }}
1314
runs-on: ubuntu-latest
15+
environment: integration
1416
permissions:
17+
id-token: write
1518
contents: read
16-
pull-requests: write
17-
repository-projects: read
1819

1920
steps:
21+
- name: Setup GitHub Token for reading Generate Go Doc Repo
22+
id: setup-github-token-read
23+
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
24+
with:
25+
aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }}
26+
aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }}
27+
aws-region: ${{ secrets.AWS_REGION }}
28+
29+
- name: Configure git for private repository and install go tools
30+
env:
31+
GOPRIVATE: github.com/smartcontractkit/generate-go-function-docs
32+
run: |
33+
git config --global url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/"
34+
go install github.com/smartcontractkit/[email protected]
35+
go install github.com/jmank88/[email protected]
36+
go install golang.org/x/tools/gopls@latest
37+
2038
- name: Checkout current branch
2139
uses: actions/checkout@v3
2240
with:
2341
fetch-depth: 0
2442

25-
- name: Setup Git
26-
run: |
27-
git config user.name "github-actions[bot]"
28-
git config user.email "github-actions[bot]@users.noreply.github.com"
29-
30-
- name: Get PR details
31-
id: pr-details
32-
run: |
33-
echo "pr_number=$(jq -r .pull_request.number <<< "$GITHUB_EVENT_PATH")" >> $GITHUB_OUTPUT
34-
echo "pr_branch=$(jq -r .pull_request.head.ref <<< "$GITHUB_EVENT_PATH")" >> $GITHUB_OUTPUT
35-
echo "base_commit=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT
36-
echo "head_commit=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
43+
- name: Detect changes related to current PR
44+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
45+
id: changes
46+
with:
47+
filters: |
48+
seth:
49+
- 'seth/**/*.go'
50+
wasp:
51+
- 'wasp/**/*.go'
52+
havoc:
53+
- 'havoc/**/*.go'
54+
lib:
55+
- 'lib/**/*.go'
56+
k8s-test-runner:
57+
- 'k8s-test-runner/**/*.go'
58+
framework:
59+
- 'framework/**/*.go'
60+
tools/asciitable:
61+
- 'tools/asciitable/**/*.go'
62+
tools/breakingchanges:
63+
- 'tools/breakingchanges/**/*.go'
64+
tools/citool:
65+
- 'tools/citool/**/*.go'
66+
tools/ecrimagefetcher:
67+
- 'tools/ecrimagefetcher/**/*.go'
68+
tools/envresolve:
69+
- 'tools/envresolve/**/*.go'
70+
tools/flakeguard:
71+
- 'tools/flakeguard/**/*.go'
72+
tools/ghlatestreleasechecker:
73+
- 'tools/ghlatestreleasechecker/**/*.go'
74+
tools/ghsecrets:
75+
- 'tools/ghsecrets/**/*.go'
76+
tools/gotestloghelper:
77+
- 'tools/gotestloghelper/**/*.go'
78+
tools/testlistgenerator:
79+
- 'tools/testlistgenerator/**/*.go'
80+
tools/workflowresultparser:
81+
- 'tools/workflowresultparser/**/*.go'
82+
# add more projects here
3783
38-
- name: Install go doc generator
84+
- name: Find all go modules in the repository and filter the ones that changed
3985
shell: bash
86+
id: go-modules
87+
env:
88+
FILTERS: ${{ steps.changes.outputs.changes }}
4089
run: |
41-
go install github.com/smartcontractkit/generate-go-function-docs@latest
90+
PATH=$PATH:$(go env GOPATH)/bin
91+
export PATH
4292
43-
- name: Install gopls
44-
shell: bash
45-
run: |
46-
go install golang.org/x/tools/gopls@latest
93+
# Find all go projects
94+
gomods_output=$(gomods 2>&1)
4795
48-
- name: Create a new branch
49-
run: |
50-
git checkout -b ${{ steps.pr-details.outputs.pr_branch }}-docs
96+
# Extract the parent directories of go.mod files
97+
parent_folders=$(echo "$gomods_output" | grep 'go\.mod$' | sed 's/\/go\.mod//' | sed 's/^[ \t]*//;s/[ \t]*$//' | xargs -n 1)
98+
99+
# Convert parent directories into a JSON matrix
100+
echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > all_folders.json
101+
102+
# Filter the directories that did not changeß
103+
jq --argjson filters "$FILTERS" 'map(select(.folder as $folder | $filters | index($folder)))' all_folders.json > filtered_folders.json
51104
52-
- name: Generate go docs
105+
echo "Filtered folder List JSON"
106+
cat filtered_folders.json
107+
108+
rm all_folders.json
109+
110+
- name: Generate go docs for changed projects
53111
shell: bash
54112
env:
55113
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
56114
run: |
57-
generate-go-function-docs diff -b ${{ steps.pr-details.outputs.base_commit }} -c ${{ steps.pr-details.outputs.head_commit }} -g fake_slash
115+
# Add go binary to PATH
116+
PATH=$PATH:$(go env GOPATH)/bin
117+
export PATH
118+
cat filtered_folders.json | jq -c '.[]' | while read -r item; do
119+
folder=$(echo "$item" | jq -r '.folder')
120+
echo "Processing folder: $folder"
121+
generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} --saveCosts --generator chatgpt --generatorSubType ${{ vars.GO_DOC_GEN_CHATGPT_MODEL }} --folder "$folder"
122+
done
123+
rm filtered_folders.json
58124
59-
- name: Make sure code still compiles
60-
run: |
61-
go mod tidy
62-
go mod vendor
63-
go build ./...
125+
- name: Upload costs as artifact
126+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
127+
with:
128+
name: generation-costs
129+
path: ./costs
64130

65-
- name: Commit changes
66-
run: |
67-
git add .
68-
git commit -m "Add automatically generated go documentation"
69-
git push origin ${{ steps.pr-details.outputs.pr_branch }}-docs
131+
- name: Remove costs before committing
132+
shell: bash
133+
run: rm -rf costs
134+
135+
- name: Setup GitHub Token for creating a new PR
136+
id: setup-github-token-write
137+
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
138+
with:
139+
aws-role-arn: ${{ secrets.AWS_ROLE_ARN_CREATE_PR }}
140+
aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }}
141+
aws-region: ${{ secrets.AWS_REGION }}
70142

71143
- name: Create a new PR targeting current PR
72-
uses: peter-evans/create-pull-request@v5
144+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
145+
id: create-pr
146+
with:
147+
token: ${{ steps.setup-github-token-write.outputs.access-token }}
148+
branch: ${{ github.head_ref }}-docs
149+
base: ${{ github.head_ref }}
150+
title: "Go docs for PR#${{ github.event.pull_request.number }}"
151+
body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes."
152+
commit-message: "[Bot] Add automatically generated go documentation"
153+
154+
- name: Find comment with PR link
155+
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
156+
id: fc
157+
with:
158+
issue-number: ${{ github.event.pull_request.number }}
159+
body-includes: Go doc generation
160+
161+
- name: Create comment in the original PR with link to the new PR
162+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
163+
if: steps.create-pr.outputs.pull-request-number != ''
164+
with:
165+
token: ${{ steps.setup-github-token-write.outputs.access-token }}
166+
issue-number: ${{ github.event.pull_request.number }}
167+
comment-id: ${{ steps.fc.outputs.comment-id }}
168+
edit-mode: replace
169+
body: |
170+
## Go doc generation
171+
Hey @${{ github.actor }}, you can check generated Go function documentation [here](${{ steps.create-pr.outputs.pull-request-url }}). Please review them and merge to this PR once you're satisfied with them.
172+
173+
- name: Create comment in the original PR to notify about no new docs
174+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
175+
if: steps.create-pr.outputs.pull-request-number == ''
176+
with:
177+
token: ${{ steps.setup-github-token-write.outputs.access-token }}
178+
issue-number: ${{ github.event.pull_request.number }}
179+
comment-id: ${{ steps.fc.outputs.comment-id }}
180+
edit-mode: replace
181+
body: |
182+
## Go doc generation
183+
Hey @${{ github.actor }}, no documentation was generated. Are you sure that you made changes to public functions without existing comments in your PR?
184+
185+
- name: Send Slack notification
186+
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
187+
if: failure()
188+
id: slack
189+
env:
190+
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
73191
with:
74-
token: ${{ secrets.GITHUB_TOKEN }}
75-
base: ${{ env.pr_branch }}
76-
branch: ${{ steps.pr-details.outputs.pr_branch }}-docs
77-
title: "Go docs for PR#${{ env.pr_number }}"
78-
body: "This PR contains automatically generated go documentation for the PR#${{ env.pr_number }}. Please review the changes."
192+
channel-id: 'C049X3353K2'
193+
payload: |
194+
{
195+
"attachments": [
196+
{
197+
"color": "#C62828",
198+
"blocks": [
199+
{
200+
"type": "section",
201+
"text": {
202+
"type": "mrkdwn",
203+
"text": "Go doc generation - Failed :x:"
204+
}
205+
},
206+
{
207+
"type": "section",
208+
"text": {
209+
"type": "mrkdwn",
210+
"text": "<@U060CGGPY8H>, please have a look."
211+
}
212+
},
213+
{
214+
"type": "section",
215+
"text": {
216+
"type": "mrkdwn",
217+
"text": "<${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}|PR#${{ github.event.pull_request.number }}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run Details>"
218+
}
219+
}
220+
]
221+
}
222+
]
223+
}
21.5 KB
Loading

book/src/framework/components/troubleshooting.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,14 @@ rosetta error: Rosetta is only intended to run on Apple Silicon with a macOS hos
1010
#### Solution
1111

1212
Update your docker to `Docker version 27.3.1, build ce12230`
13+
14+
## Can't see any docker metrics with Cadvisor
15+
16+
Cadvisor container can't mount some layers
17+
```
18+
E1209 13:14:49.908130 1 manager.go:1116] Failed to create existing container: /docker/aa40875c382af890861447fa8aaf6908978041b9077bb81029971d23929f8c4d: failed to identify the read-write layer ID for container "aa40875c382af890861447fa8aaf6908978041b9077bb81029971d23929f8c4d". - open /rootfs/var/lib/docker/image/overlayfs/layerdb/mounts/aa40875c382af890861447fa8aaf6908978041b9077bb81029971d23929f8c4d/mount-id: no such file or directory
19+
```
20+
21+
Disable `containerd` images ( Settings -> General ), see [issue](https://github.com/google/cadvisor/pull/3569).
22+
23+
![img.png](img.png)

book/src/framework/observability/metrics.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22

33
We use Prometheus to collect metrics of Chainlink nodes and other services.
44

5+
Check [Prometheus UI](http://localhost:9090/query).
6+
57
Check [Grafana](http://localhost:3000/explore?panes=%7B%22gGs%22:%7B%22datasource%22:%22PBFA97CFB590B2093%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bjob%3D%5C%22ctf%5C%22%7D%22,%22range%22:true,%22instant%22:true,%22datasource%22:%7B%22type%22:%22prometheus%22,%22uid%22:%22PBFA97CFB590B2093%22%7D,%22editorMode%22:%22code%22,%22legendFormat%22:%22__auto%22%7D%5D,%22range%22:%7B%22from%22:%22now-5m%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1) example query.
68

79
Queries:
810
- All metrics of all containers
911
```json
1012
{job="ctf"}
11-
```
13+
```
14+
15+
## Docker Resources
16+
17+
We are using [cadvisor](https://github.com/google/cadvisor) to monitor resources of test [containers](http://localhost:3000/d/pMEd7m0Mz/cadvisor-exporter?orgId=1).
18+
19+
Cadvisor UI can be found [here](http://localhost:8085/containers/)

framework/.changeset/v0.3.5.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Add cadvisor support to "ctf obs up"
2+
- Add cadvisor dashboard

framework/.changeset/v0.3.6.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Add cadvisor support to obs stack
2+
- Add cadvisor dashboard

framework/.changeset/v0.3.7.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Separate JobDistributor database
2+
- Wait when fund nodes on testnets

framework/cmd/observability/compose/conf/prometheus.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ scrape_configs:
1111
- source_labels: [ __meta_docker_port_private ]
1212
regex: '6688'
1313
action: keep
14+
- job_name: cadvisor
15+
scrape_interval: 10s
16+
static_configs:
17+
- targets:
18+
- cadvisor:8080

0 commit comments

Comments
 (0)