@appland/appmap 3.168.0 → 3.168.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/built/docs/appmap-docs.md +1 -1
  3. package/built/docs/community.md +1 -1
  4. package/built/docs/get-started-with-appmap/index.md +1 -1
  5. package/built/docs/get-started-with-appmap/navie-ai-quickstart.md +6 -5
  6. package/built/docs/navie-reference/index.md +18 -0
  7. package/built/docs/navie-reference/navie-accessing-logs.md +42 -0
  8. package/built/docs/navie-reference/navie-bring-your-own-model-examples.md +202 -0
  9. package/built/docs/navie-reference/navie-commands.md +119 -0
  10. package/built/docs/navie-reference/navie-github-repository.md +12 -0
  11. package/built/docs/{using-navie-ai/how-navie-works.md → navie-reference/navie-how-it-works.md} +5 -4
  12. package/built/docs/navie-reference/navie-openai-key-management.md +83 -0
  13. package/built/docs/navie-reference/navie-options.md +87 -0
  14. package/built/docs/navie-reference/navie-pre-built-libraries-for-appmap-data.md +23 -0
  15. package/built/docs/navie-reference/navie-user-interface.md +32 -0
  16. package/built/docs/navie-reference.md +1 -0
  17. package/built/docs/reference/appmap-airgapped-install.md +293 -0
  18. package/built/docs/reference/appmap-client-cli.md +1 -1
  19. package/built/docs/reference/appmap-java.md +1 -1
  20. package/built/docs/reference/guides/exporting-appmap-diagrams.md +1 -0
  21. package/built/docs/reference/guides/handling-large-appmap-diagrams.md +1 -1
  22. package/built/docs/reference/guides/index.md +1 -0
  23. package/built/docs/reference/guides/navigating-code-objects.md +2 -2
  24. package/built/docs/reference/guides/openapi.md +1 -1
  25. package/built/docs/reference/guides/reading-sql-in-appmap-diagrams.md +1 -1
  26. package/built/docs/reference/guides/refine-appmap-data.md +1 -1
  27. package/built/docs/reference/guides/reverse-engineering.md +1 -0
  28. package/built/docs/reference/guides/using-appmap-analysis.md +1 -1
  29. package/built/docs/reference/guides/using-appmap-diagrams.md +2 -2
  30. package/built/docs/reference/index.md +3 -1
  31. package/built/docs/reference/integrations/atlassian-compass.md +1 -0
  32. package/built/docs/reference/integrations/atlassian-confluence.md +1 -0
  33. package/built/docs/reference/integrations/docker.md +1 -0
  34. package/built/docs/reference/integrations/index.md +1 -0
  35. package/built/docs/reference/integrations/mermaid.md +1 -0
  36. package/built/docs/reference/integrations/plantuml.md +1 -0
  37. package/built/docs/reference/integrations/postman.md +1 -0
  38. package/built/docs/reference/integrations/readme.md +1 -0
  39. package/built/docs/reference/integrations/smartbear-swaggerhub.md +2 -1
  40. package/built/docs/reference/uninstalling-appmap.md +1 -1
  41. package/built/docs/reference/vscode.md +1 -1
  42. package/built/docs/using-navie-ai/bring-your-own-model.md +38 -37
  43. package/built/docs/using-navie-ai/how-to-open-navie.md +5 -5
  44. package/built/docs/using-navie-ai/index.md +8 -7
  45. package/built/docs/using-navie-ai/using-navie.md +64 -75
  46. package/built/fulltext/FileIndex.js +0 -1
  47. package/built/fulltext/FileIndex.js.map +1 -1
  48. package/package.json +1 -1
  49. package/built/docs/reference/integrations/circle-ci.md +0 -425
@@ -1,425 +0,0 @@
1
- ---
2
- layout: docs
3
- title: Docs - Integrations
4
- description: "Use AppMap Analysis within CircleCI to analyze behavioral changes per Pull Request. It offers root cause analysis, API changes tracking, security and performance findings, and more."
5
- integrations: true
6
- name: CircleCI
7
- step: 3
8
- render_with_liquid: false
9
- redirect_from: [/docs/setup-appmap-in-ci/in-circleci]
10
- published: false
11
- ---
12
-
13
- # CircleCI <!-- omit in toc -->
14
-
15
- <p class="alert alert-info">
16
- If at any point you would like some help, <a href="/slack">join us in Slack</a>!
17
- You'll find the AppMap team there, along with other AppMap users.
18
- </p>
19
-
20
- ## Overview <!-- omit in toc -->
21
- AppMap works with your test cases in CircleCI and a GitHub Action to collect, store, analyze, and report on the behavioral changes within each Pull Request. Tests can execute within your existing CircleCI build job, and AppMap Data can be retrieved by a GitHub Action to analyze the code behavior changes.
22
-
23
- - [How it works](#how-it-works)
24
- - [Step-by-step walkthrough](#step-by-step-walkthrough)
25
- - [Prerequisites](#prerequisites)
26
- - [Step 1: Setup AppMap file sync in existing CircleCI Project](#step-1-setup-appmap-file-sync-in-existing-circleci-project)
27
- - [Step 2: Setup AppMap GitHub Action for baseline](#step-2-setup-appmap-github-action-for-baseline)
28
- - [Step 3: Add AppMap to compare HEAD revision](#step-3-add-appmap-to-compare-head-revision)
29
- - [Step 4: Merge Pull Request to enable AppMap](#step-4-merge-pull-request-to-enable-appmap)
30
- - [Example Project Files](#example-project-files)
31
- - [Advanced Configuration Options](#advanced-configuration-options)
32
- - [Prerequisites](#prerequisites-1)
33
- - [Step 1: Add or Update AppMap action to use `repository_dispatch` trigger](#step-1-add-or-update-appmap-action-to-use-repository_dispatch-trigger)
34
- - [Step 2: Update your CircleCI build to trigger the GitHub API on a successfully build completion.](#step-2-update-your-circleci-build-to-trigger-the-github-api-on-a-successfully-build-completion)
35
- - [Next Steps](#next-steps)
36
-
37
- <img class="video-screenshot" src="/assets/img/docs/gh-action/analysis-github-action.webp"/>
38
-
39
- ## How it works
40
-
41
- AppMap records the behavior of your test cases when they run in CircleCI and produces AppMap Data that can be copied to a centralized storage repository. An additional step is added in your CircleCI build job to create a tarball of that data and push the resulting file to a centralized object storage or file storage of your control. From there, the AppMap GitHub Action will download those maps and analyze them. AppMap will add comments to your Pull Request with deep insights into the runtime code changes.
42
-
43
- <img class="video-screenshot" src="/assets/img/docs/gh-action/circleci-github-arch-diagram.webp"/>
44
-
45
- In this example, the following events will happen:
46
-
47
- <b>1) CircleCI builds your application and runs automated test cases and AppMap Data will be created in `tmp/appmap` on the CircleCI runner.</b>
48
- - A tarball (`tar`) file of the `tmp/appmap` directory is created in the CircleCI runner.
49
- - This tarball is copied to your chosen centralized location (such as AWS S3 or Azure Blob Storage) for secure storage and retrieval by the AppMap GitHub Action.
50
-
51
- <b>2) While the CircleCI build is running, the AppMap GitHub Action will also trigger, looking for a baseline archive for comparison.</b>
52
- - The AppMap GitHub Action waits until all the complete AppMap Dataset exists on the central storage location before continuing.
53
- - This will download the raw AppMap Data archive created by CircleCI in your previous step to generate a baseline archive for comparison.
54
-
55
- <b>3) The GitHub Action will analyze the latest maps against the baseline for the pull request.
56
- - The AppMap GitHub Action will provide a full runtime code analysis diff report as a comment in your pull request.</b>
57
-
58
- ## Step-by-step walkthrough
59
-
60
- ### Prerequisites
61
-
62
- 1) AppMap only supports project that have automated test cases. To add AppMap to your project, use either the [AppMap installer CLI](/docs/reference/appmap-client-cli.html#install) or manually add with the [AppMap libraries](/docs/reference).
63
-
64
- 2) A centralized storage location (such as Amazon S3 or Azure Blob Storage) for storing the raw AppMap Data archive generated from the test cases. This storage needs write access from CircleCI and read access from GitHub Actions. In this example below we will use Amazon S3.
65
-
66
- ### Step 1: Setup AppMap file sync in existing CircleCI Project
67
-
68
- First, create a branch called `appmap-ci` in your project. Next, in your CircleCI configuration (generally found at `.circle/config.yml`), add a run action that will create a (`tar`) of your AppMap Data after your test cases are completed.
69
-
70
- ```yaml
71
- - run:
72
- name: Create AppMap Data archive
73
- command: tar --remove-files -cvzf <<pipeline.git.revision>>.tar tmp/appmap/
74
- ```
75
- {: .example-code}
76
-
77
- Using the CircleCI pipeline value of `<<pipeline.git.revision>>` will give this archive tarball a unique file name based on the SHA the AppMap Data is based on.
78
-
79
- After the archive step, add the necessary steps to authenticate and copy this archive file to your centralized storage location. In our example below, we will authenticate with Amazon AWS to generate temporary credentials and then we will copy this file to the configured bucket. In this example, copying the tarball to the `s3://circleci-appmaps/` bucket.
80
-
81
- ```yaml
82
- - aws-cli/setup:
83
- profile_name: Circle-CI-Write-to-S3
84
- role_arn: arn:aws:iam::12345678900:role/Circle-CI-Write-to-S3
85
-
86
- - aws-s3/copy:
87
- from: <<pipeline.git.revision>>.tar
88
- profile_name: Circle-CI-Write-to-S3
89
- to: s3://circleci-appmap/
90
- arguments: --region us-west-2
91
- ```
92
- {: .example-code}
93
-
94
- [**Example Code Commit**](https://github.com/land-of-apps/circle-ci-example/commit/1b1f2e886c8ca0a166296147b083d3eb500a8c5f)
95
-
96
- After you push this commit to your branch, CircleCI will trigger a workflow and you can confirm that the steps all completed successfully.
97
-
98
- <img class="video-screenshot" src="/assets/img/docs/gh-action/circle-ci-example-storage.webp"/>
99
-
100
- Once you have confirmed your AppMap Data archive has successfully copied to your centralized file repository, merge this branch and continue to the next step.
101
-
102
- ### Step 2: Setup AppMap GitHub Action for baseline
103
-
104
- To setup the GitHub Action, create a new branch called `appmap-action` in your repository.
105
-
106
- Create a new file with the name `.github/workflows/appmap-analysis.yml`
107
-
108
- In this file you can use [this default action example](https://github.com/land-of-apps/rails-7-app/blob/c70b48891f38f92223ec06a654406cb7a6886890/.github/workflows/appmap-analysis.yml#L1-L77). **NOTE** Right now you will only use the first job that is listed in lines 1-77, after we create the baseline archive we'll add the AppMap job below this section.
109
-
110
- - Download the AppMap tooling into the runner.
111
- - Check for an existing baseline AppMap archive stored in your GitHub artifact store.
112
- - (If no baseline AppMap archive exists) Locate and download the tarball of AppMap Data for the base revision from your chosen centralized data store.
113
- - (If no baseline AppMap archive exists) Create an AppMap archive of the baseline AppMap Data and store to your GitHub artifact store.
114
-
115
- Commit your GitHub Action workflow file to your branch and open a new Pull Request which will trigger the action.
116
-
117
- After the action completes running successfully, check the action summary and confirm a build artifact has been created like the following screenshot.
118
-
119
- <img class="video-screenshot" src="/assets/img/docs/gh-action/github-artifact-example.webp"/>
120
-
121
- ### Step 3: Add AppMap to compare HEAD revision
122
-
123
- After the previous step succeeds and the baseline AppMap Data is created, [update the GitHub Action](https://github.com/land-of-apps/rails-7-app/blob/c70b48891f38f92223ec06a654406cb7a6886890/.github/workflows/appmap-analysis.yml#L79-L125) to include a similar job to fetch the AppMap Data for the HEAD revision and additionally analyze the code changes for code quality problems and provide a detailed report into the pull request comments.
124
-
125
- [Review this example commit](https://github.com/land-of-apps/circle-ci-example/pull/2/commits/4ea72bb9c930960dafd38698749a0b1dbc2e9db8) for an example of the additional steps to add to your GitHub Action.
126
-
127
- When the build completes successfully, you will see a comment from the GitHub Action. After merging this Pull Request you will see a similar analysis on each new Pull Request.
128
-
129
- <img class="video-screenshot" src="/assets/img/docs/gh-action/initial-report.webp"/>
130
-
131
- Your completed installation should now look like the following [Pull Request Example.](https://github.com/land-of-apps/circle-ci-example/pull/2)
132
-
133
- ### Step 4: Merge Pull Request to enable AppMap
134
-
135
- After you merge this Pull Request, AppMap will execute on each subsequent Pull Request.
136
-
137
- With AppMap deployed in your project, AppMap will execute on each Pull Request and provide a detailed runtime code analysis on each new commit. AppMap performs a thorough analysis of the runtime differences, giving you:
138
-
139
- - Root cause analysis of failed tests.
140
- - Web service API changes, both breaking and non-breaking.
141
- - New and resolved security findings.
142
- - New and resolved performance findings.
143
- - New and resolved findings in other categories: maintainability, reliability, and user-defined rules.
144
- - "Behavioral diffs" as sequence diagrams showing changed runtime behavior within the PR.
145
-
146
- [Example Pull Request with Runtime Code Diff](https://github.com/land-of-apps/rails-7-app/pull/14)
147
-
148
- <img class="video-screenshot" src="/assets/img/docs/gh-action/analysis-pull-request.webp"/>
149
- <img class="video-screenshot" src="/assets/img/docs/gh-action/analysis-checks-with-circleci.webp"/>
150
-
151
- ## Example Project Files
152
-
153
- - [Example Ruby on Rails Project](https://github.com/land-of-apps/rails-7-app/)
154
- - [Pull Request with Runtime Code Diff](https://github.com/land-of-apps/rails-7-app/pull/14)
155
- - [CircleCI Example copying AppMap Data archive to Amazon S3](https://github.com/land-of-apps/rails-7-app/blob/c70b48891f38f92223ec06a654406cb7a6886890/.circleci/config.yml#L34-L46)
156
- - [GitHub Action Workflow File](https://github.com/land-of-apps/rails-7-app/blob/c70b48891f38f92223ec06a654406cb7a6886890/.github/workflows/appmap-analysis.yml)
157
-
158
- ## Advanced Configuration Options
159
-
160
- In our basic CircleCI example above, both the CircleCI test runner and the AppMap action will start running at the same time. The GitHub Action will check your central storage location every 10 seconds until your baseline maps and HEAD revision maps exist. For many projects where your test cases can complete in a short amount of time, this additional wait time in the AppMap GitHub Action is worth the cost for the simpler configuration to get started.
161
-
162
- But if your test cases on CircleCi take longer to run, it can be inefficient and expensive to have a GitHub Action running and waiting for files to become available. You can use the GitHub API to trigger a webhook event called `repository_dispatch` when you want to trigger a workflow for activity that happens outside of GitHub. In our case after CircleCI has successfully finished running test and pushed the AppMap archive to the central file storage location.
163
-
164
- Refer to the [GitHub Action documentation](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch) for more details about how the `repository_dispatch` action trigger works.
165
-
166
- The overall architecture largely stays the same as the basic example from above. You can see in the diagram below we've added a new step #2 where a CircleCI job will make a call to the GitHub API to trigger a webhook and start our updated GitHub Action.
167
-
168
- <img class="video-screenshot" src="/assets/img/docs/gh-action/advanced-circleci-github-arch-diagram.webp"/>
169
-
170
- ### Prerequisites
171
-
172
- - [Create a GitHub Personal Access Token](https://docs.github.com/en/enterprise-server@3.8/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with the `repo` scope. This needs to be stored in your CircleCI account as an environment variable.
173
- - The `repository_dispatch` trigger will only run if your workflow file is on your main branch. As such, you'll need the ability to commit to your project main branch.
174
- - Centralized storage setup and configured for access. As the example above, you'll need write access from CircleCI and read access from GitHub Actions. In our example we'll be using Amazon S3.
175
- - This walkthrough assumes you have already completed the basic setup steps in the previous example. At the very least you need to ensure you've [completed Step 2](/docs/setup-appmap-in-ci/in-circleci.html#step-2-setup-appmap-github-action-for-baseline) and have a baseline AppMap archive ready for analysis.
176
-
177
- ### Step 1: Add or Update AppMap action to use `repository_dispatch` trigger
178
-
179
- For this updated GitHub Action to work you'll need to commit a software utility to your project that will locate which Pull Request your commit is associated with. Normally when a Pull Request is opened, the AppMap Action will trigger and the action payload will include details about which Pull Request the AppMap report will be associated with. But since our action will be triggered via a webhook, it will lack information about what Pull Request is associated with the commit.
180
-
181
- #### Add `searchPullRequest.js` to your project <!-- omit in toc -->
182
-
183
- You can use this JavaScript function to locate the Pull Request for your commits, and pass the relevant pull request number to the AppMap GitHub Action. [Copy the latest version from the sample project](https://github.com/land-of-apps/rails-7-app/blob/d098acdc0b3d327ebf8c9d062bedb5c779d18008/searchPullRequest.js) and add to your project.
184
-
185
- Add the following as a new file named `package.json` or add these project dependencies to your existing `package.json`
186
-
187
- ```json
188
- {
189
- "dependencies": {
190
- "@octokit/rest": "^20.0.2",
191
- "yargs": "^17.7.2"
192
- }
193
- }
194
- ```
195
- {: .example-code}
196
-
197
- #### Add/Update the AppMap Action to your project <!-- omit in toc -->
198
-
199
- The most recent version of the AppMap GitHub Action that can be triggered via a [webhook is located in our sample project.](https://github.com/land-of-apps/rails-7-app/blob/cca7f276cf7c32b4b7a5af218ccf19399084777a/.github/workflows/analyze-maps-from-circleci.yml) You'll need to commit this file (configured for your environment) and the files above into the main branch of your repository. As with the above example you'll need to save this file into the `.github/workflows/` folder.
200
-
201
- **Commit these files to your main branch and then continue to Step 2.**
202
-
203
- This action has many steps to process the files and analyze your pull requests, below are details of what each step is doing.
204
-
205
- * Reconfigure this environment variable to point to your specific central file location.
206
-
207
- ```yaml
208
- env:
209
- appmap_storage_bucket: circleci-appmaps
210
- ```
211
- {: .example-code}
212
-
213
- * Use this action to set the status of your Pull Request as "pending" for the commit being built.
214
-
215
- ```yaml
216
- - name: Set commit status as pending
217
- uses: myrotvorets/set-commit-status-action@f8a3f50eca0d32f3e12dc3a98792bb588bf29626
218
- with:
219
- token: ${{ secrets.GITHUB_TOKEN }}
220
- status: pending
221
- context: AppMap Analysis
222
- sha: ${{ github.event.client_payload.head_sha }}
223
- ```
224
- {: .example-code}
225
-
226
- <img class="video-screenshot" src="/assets/img/docs/gh-action/appmap-analysis-status.webp"/>
227
-
228
-
229
- * Install the AppMap command line tools, but do not install the libraries.
230
-
231
- ```yaml
232
- - name: Install AppMap tools
233
- uses: getappmap/install-action@v1
234
- with:
235
- install-appmap-library: false
236
- ```
237
- {: .example-code}
238
-
239
- * Check and see if the baseline AppMap archive exists in the GitHub artifact store. This will fail if an archive is not found so we enable `continue-on-error: true`
240
-
241
- ```yaml
242
- - name: Check for existing baseline archive
243
- id: check_for_baseline
244
- env:
245
- GITHUB_TOKEN: ${{ github.token }}
246
- continue-on-error: true
247
- run: |
248
- appmap restore --check --revision ${base_sha} --github-repo ${GITHUB_REPOSITORY} --exact
249
- ```
250
- {: .example-code}
251
-
252
- * If the previous step "fails" (i.e. no baseline archive exists) run these steps to download the raw AppMap Data archive and archive them for analysis.
253
-
254
- ```yaml
255
- - name: Download and extract appmap data archive
256
- if: steps.check_for_baseline.outcome == 'failure'
257
- run: |
258
- aws s3 cp s3://${appmap_storage_bucket}/${base_sha}.tar ${base_sha}.tar
259
- tar xvf ${base_sha}.tar
260
-
261
- - name: Archive AppMap Data archive
262
- if: steps.check_for_baseline.outcome == 'failure'
263
- uses: getappmap/archive-action@v1
264
- with:
265
- revision: ${base_sha}
266
- ```
267
- {: .example-code}
268
-
269
- The 2nd section in the GitHub AppMap Action will trigger when the above steps are successful. Below is an explanation of what each of those steps is used for.
270
-
271
- * As in the previous example, reconfigure the storage bucket location based on where your AppMap Data archive is located.
272
-
273
- ```yaml
274
- env:
275
- appmap_storage_bucket: circleci-appmaps
276
- ```
277
- {: .example-code}
278
-
279
- * Install Node.js and the packages required to run the `searchPullRequest.js` application.
280
-
281
- ```yaml
282
- - name: Use Node.js
283
- uses: actions/setup-node@v2
284
- with:
285
- node-version: '18'
286
-
287
- - name: Install dependencies
288
- run: npm ci
289
- ```
290
- {: .example-code}
291
-
292
- * Download and extract the HEAD revision AppMap Data archive sent from CircleCI
293
-
294
- ```yaml
295
- - name: Download and extract AppMap Data archive
296
- run: |
297
- aws s3 cp s3://${appmap_storage_bucket}/${head_sha}.tar ${head_sha}.tar
298
- tar xvf ${head_sha}.tar
299
- ```
300
- {: .example-code}
301
-
302
- * Run `searchPullRequest.js` and locate the most recent Pull Request with the HEAD sha associated. This value will be stored in $LATESTPR.
303
-
304
- ```yaml
305
- - name: Get only the most recent issue with this head commit
306
- run: echo LATESTPR=$(node searchPullRequest.js --ownerRepo=${GITHUB_REPOSITORY} --commit=${head_sha}) >> "$GITHUB_ENV"
307
-
308
- ```
309
- {: .example-code}
310
-
311
- * Analyze the AppMap Data archive and compare the changes between the base and head revisions, passing the `issue-number` to the analyze-action.
312
-
313
- ```yaml
314
- - name: Analyze AppMap Data
315
- uses: getappmap/analyze-action@v1
316
- with:
317
- issue-number: ${{env.LATESTPR}}
318
- directory: .
319
- base-revision: ${{ github.event.client_payload.base_sha }}
320
- head-revision: ${{ github.event.client_payload.head_sha }}
321
- ```
322
- {: .example-code}
323
-
324
- * Update the commit status for this repository_dispatch build.
325
-
326
- ```yaml
327
- - name: Update Commit Status
328
- uses: myrotvorets/set-commit-status-action@v2.0.0
329
- if: always()
330
- with:
331
- token: ${{ secrets.GITHUB_TOKEN }}
332
- status: ${{ job.status }}
333
- context: AppMap Analysis
334
- sha: ${{ github.event.client_payload.head_sha }}
335
- ```
336
- {: .example-code}
337
-
338
- The commit status update will look like the following in a successful pull request.
339
-
340
- <img class="video-screenshot" src="/assets/img/docs/gh-action/appmap-analysis-status-complete.webp"/>
341
-
342
- Make sure to commit the [searchPullRequest.js](https://github.com/land-of-apps/rails-7-app/blob/d098acdc0b3d327ebf8c9d062bedb5c779d18008/searchPullRequest.js), the [package.json](https://github.com/land-of-apps/rails-7-app/blob/d098acdc0b3d327ebf8c9d062bedb5c779d18008/package.json), and the Webhook AppMap GitHub Action before continuing to step 2.
343
-
344
- [Here is an example commit with the changes files in an example test project.](https://github.com/land-of-apps/circle-ci-example/commit/44bcfafbaf978484fc0d29e826d28161ded89ef6)
345
-
346
- ### Step 2: Update your CircleCI build to trigger the GitHub API on a successfully build completion.
347
-
348
- For an example of a full CircleCI workflow, [refer to the latest version from our sample project.](https://github.com/land-of-apps/rails-7-app/blob/235f97aa4225f4e6e43715b404182f1df7d5c6f5/.circleci/config.yml)
349
-
350
- In our example, we'll modify the CircleCI build runner from our basic example, and add a new build job called `run_appmap_analysis` which will only trigger on non-mainline code commits after the normal build succeeds.
351
-
352
- We don't need to trigger the Webhook based AppMap Action on a mainline branch build because analysis only happens inside of an existing Pull Request.
353
-
354
- First we can create a new job in our existing `.circleci/config.yml` file.
355
-
356
- You'll need to update the following items according to your project:
357
-
358
- - Ensure your GitHub Personal Access Token is saved as a CircleCI secure environment variable at `$GITHUB_PAT`
359
- - Update the URL for triggering the `repository_dispatch` project. The format is: `https://api.github.com/repos/{ORGNAME}/{REPONAME}/dispatches`
360
- - [Confirm the name of your `repository_dispatch`](https://github.com/land-of-apps/rails-7-app/blob/235f97aa4225f4e6e43715b404182f1df7d5c6f5/.github/workflows/analyze-maps-from-circleci.yml#L3-L7) action and update the `"event_type": "run_appmap_analysis",` accordingly.
361
-
362
- ```yaml
363
- run_appmap_analysis:
364
- docker:
365
- - image: cimg/ruby:3.1.2
366
-
367
- steps:
368
- - checkout
369
-
370
- - run:
371
- name: Get base Git SHA
372
- command: echo 'export BASE_SHA=$(git merge-base origin/main $CIRCLE_BRANCH)' >> $BASH_ENV
373
-
374
- - run:
375
- name: Run AppMap Analysis
376
- command: |
377
- curl -L \
378
- -X POST \
379
- -H "Accept: application/vnd.github.v3+json" \
380
- -H "Authorization: token $GITHUB_PAT" \
381
- -H "Content-Type: application/json" \
382
- -H "X-GitHub-Api-Version: 2022-11-28" \
383
- https://api.github.com/repos/land-of-apps/rails-7-app/dispatches \
384
- -d @- \<<EOF
385
- {
386
- "event_type": "run_appmap_analysis",
387
- "client_payload": {
388
- "base_sha": "$BASE_SHA",
389
- "head_sha": "<< pipeline.git.revision >>"
390
- }
391
- }
392
- EOF
393
- ```
394
- {: .example-code}
395
-
396
- In your CircleCI workflow declaration section. Update the jobs so that the GitHub webhook job will only run after the build job and excluding your mainline branch.
397
-
398
- ```yaml
399
- workflows:
400
- build:
401
- jobs:
402
- - build
403
- - run_appmap_analysis:
404
- requires:
405
- - build
406
- filters:
407
- branches:
408
- ignore:
409
- - main
410
- ```
411
- {: .example-code}
412
-
413
- Now, create a new Pull Request with these changes and on your next CircleCI build, you'll see that the `run_appmap_analysis` job will execute after your normal build step.
414
-
415
- <img class="video-screenshot" src="/assets/img/docs/gh-action/circleci-build-example.webp"/>
416
-
417
- For more details refer to this [example Pull Request](https://github.com/land-of-apps/circle-ci-example/pull/3) and [commit changes](https://github.com/land-of-apps/circle-ci-example/pull/3/commits/8c328130e0572a0eee9b9a0e0b1b2d73e3909ebc) for this sample project.
418
-
419
- When you view your project's GitHub Actions page, you'll see the `workflow_dispatch` action trigger after CircleCI completes its build after it has uploaded the AppMap Data archive to your centralized data store.
420
-
421
- <img class="video-screenshot" src="/assets/img/docs/gh-action/github-action-webhook-example.webp"/>
422
-
423
- ## Next Steps
424
-
425
- AppMap comes with a comprehensive set of rules that are categorized by their impact on applications: Performance, Reliability, Maintainability, Stability, and Security. [Refer to the AppMap documentation](/docs/setup-appmap-in-ci/in-github-actions.html#configure-additional-appmap-analysis-rules) to learn how to configure these rules for your project.