@appland/appmap 3.146.0 → 3.147.0

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 (62) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/built/docs/CLA Instructions.pdf +0 -0
  3. package/built/docs/Code of Conduct for Contributors.pdf +0 -0
  4. package/built/docs/analysis/rules-reference.html +27 -0
  5. package/built/docs/appmap-docs.md +27 -0
  6. package/built/docs/community.md +28 -0
  7. package/built/docs/guides/exporting-appmap-diagrams.md +50 -0
  8. package/built/docs/guides/handling-large-appmap-diagrams.md +138 -0
  9. package/built/docs/guides/index.md +21 -0
  10. package/built/docs/guides/navigating-code-objects.md +67 -0
  11. package/built/docs/guides/openapi.md +105 -0
  12. package/built/docs/guides/reading-sql-in-appmap-diagrams.md +69 -0
  13. package/built/docs/guides/refine-appmap-data.md +186 -0
  14. package/built/docs/guides/reverse-engineering.md +377 -0
  15. package/built/docs/guides/runtime-code-review.md +111 -0
  16. package/built/docs/guides/using-appmap-analysis.md +206 -0
  17. package/built/docs/guides/using-appmap-diagrams.md +331 -0
  18. package/built/docs/integrations/atlassian-compass.md +25 -0
  19. package/built/docs/integrations/atlassian-confluence.md +51 -0
  20. package/built/docs/integrations/circle-ci.md +424 -0
  21. package/built/docs/integrations/docker.md +109 -0
  22. package/built/docs/integrations/github-actions.md +524 -0
  23. package/built/docs/integrations/index.md +20 -0
  24. package/built/docs/integrations/plantuml.md +66 -0
  25. package/built/docs/integrations/postman.md +30 -0
  26. package/built/docs/integrations/readme.md +39 -0
  27. package/built/docs/integrations/smartbear-swaggerhub.md +119 -0
  28. package/built/docs/reference/analysis-labels.md +49 -0
  29. package/built/docs/reference/analysis-rules.md +61 -0
  30. package/built/docs/reference/appmap-client-cli.md +628 -0
  31. package/built/docs/reference/appmap-gradle-plugin.md +141 -0
  32. package/built/docs/reference/appmap-java.md +311 -0
  33. package/built/docs/reference/appmap-maven-plugin.md +164 -0
  34. package/built/docs/reference/appmap-node.md +185 -0
  35. package/built/docs/reference/appmap-python.md +520 -0
  36. package/built/docs/reference/appmap-ruby.md +514 -0
  37. package/built/docs/reference/github-action.md +171 -0
  38. package/built/docs/reference/index.md +25 -0
  39. package/built/docs/reference/jetbrains.md +136 -0
  40. package/built/docs/reference/license-key-install.md +74 -0
  41. package/built/docs/reference/navie.md +261 -0
  42. package/built/docs/reference/remote-recording-api.md +97 -0
  43. package/built/docs/reference/uninstalling-appmap.md +119 -0
  44. package/built/docs/reference/vscode.md +122 -0
  45. package/built/docs/setup-appmap-in-ci/example-projects.md +21 -0
  46. package/built/docs/setup-appmap-in-ci/how-it-works.md +43 -0
  47. package/built/docs/setup-appmap-in-ci/in-circleci.md +423 -0
  48. package/built/docs/setup-appmap-in-ci/in-github-actions.md +177 -0
  49. package/built/docs/setup-appmap-in-ci/index.md +22 -0
  50. package/built/docs/setup-appmap-in-ci/matrix-builds.md +225 -0
  51. package/built/docs/setup-appmap-in-ci/troubleshooting.md +71 -0
  52. package/built/docs/setup-appmap-in-your-code-editor/add-appmap-to-your-code-editor.md +93 -0
  53. package/built/docs/setup-appmap-in-your-code-editor/appmap-analysis.md +77 -0
  54. package/built/docs/setup-appmap-in-your-code-editor/generate-appmap-data-from-tests.md +93 -0
  55. package/built/docs/setup-appmap-in-your-code-editor/generate-appmap-data-with-remote-recording.md +112 -0
  56. package/built/docs/setup-appmap-in-your-code-editor/generate-appmap-data-with-request-recording.md +77 -0
  57. package/built/docs/setup-appmap-in-your-code-editor/how-appmap-works.md +166 -0
  58. package/built/docs/setup-appmap-in-your-code-editor/index.md +25 -0
  59. package/built/docs/setup-appmap-in-your-code-editor/navigating-appmap-diagrams.md +59 -0
  60. package/built/docs/setup-appmap-in-your-code-editor/navigating-code-objects.md +67 -0
  61. package/built/docs/unused_for_now_index.html +11 -0
  62. package/package.json +2 -2
@@ -0,0 +1,25 @@
1
+ ---
2
+ layout: docs
3
+ title: Docs - Integrations
4
+ description: "Atlassian Compass is a unified platform for managing distributed software architecture. It supports visualizing OpenAPI docs via SwaggerUI, and enables file pushing through webhooks."
5
+ integrations: true
6
+ name: Atlassian Compass
7
+ step: 1
8
+ ---
9
+
10
+ # Atlassian Compass
11
+
12
+ [Atlassian Compass](https://www.atlassian.com/software/compass) is a developer experience platform that brings your distributed software architecture and the teams collaborating on them together in a single, unified place. [Compass supports visualizing your OpenAPI docs using SwaggerUI](https://community.atlassian.com/t5/Compass-Alpha-articles/Visualize-your-APIs-in-Compass-with-Swagger-UI/ba-p/1814790) integrated into the main Compass application. After adding your application as a new component in Compass, and after enabling the SwaggerUI app, you can now add an additional task to push the `openapi.yml` file to Compass via a webhook.
13
+
14
+ <img class="video-screenshot" src="/assets/img/compass-swagger-ui-config.webp"/>
15
+
16
+ After generating an API username and token, create a step in your GitHub Action (or other CI tool) to push the file to Compass using the custom URL in the configuration page. Make sure to store the webhook URL, API user, and API key as [encrypted secrets in your build task.](https://docs.github.com/en/actions/security-guides/encrypted-secrets)
17
+
18
+ ```
19
+ - name: AppMap Generate OpenAPI Definitions
20
+ run: npx @appland/appmap@latest openapi --output-file openapi.yml
21
+ - name: Push OpenAPI to Atlassian Compass
22
+ run: curl -X PUT ${COMPASS_WEBHOOK_URL} -F file=@openapi.yml --user "$COMPASS_API_USER}:${COMPASS_API_KEY}"
23
+ ```
24
+
25
+ [Refer to the Compass documentation for additional information on how to upload your definitions](https://community.atlassian.com/t5/Compass-Alpha-articles/Visualize-your-APIs-in-Compass-with-Swagger-UI/ba-p/1814790)
@@ -0,0 +1,51 @@
1
+ ---
2
+ layout: docs
3
+ title: Docs - Integrations
4
+ description: "AppMap integrates with Atlassian Confluence to generate interactive software diagrams from run-time data, enhancing documentation and collaboration on software projects."
5
+ integrations: true
6
+ name: Atlassian Confluence
7
+ step: 1
8
+ ---
9
+
10
+ # Atlassian Confluence
11
+
12
+ AppMap integrates with [Confluence](https://www.atlassian.com/software/confluence), the popular corporate wiki developed by the Atlassian.
13
+
14
+ Confluence facilitates robust documentation and knowledge sharing. AppMap automatically generates interactive software diagrams from run-time data, ensuring an accurate and up-to-date understanding of code architecture and behavior. This integration leverages the strengths of both platforms enabling teams to better understand, document, and collaborate on their software projects.
15
+
16
+ ## Requirements
17
+
18
+ 1. A project containing AppMap Data.
19
+ - How to make AppMap Diagrams [in your code editor](/docs/get-started-with-appmap/)
20
+ - How to make AppMap Diagrams [using a GitHub action](/docs/integrations/github-actions) or in [CircleCI](/docs/integrations/circle-ci)
21
+ 2. [The AppMap app for Confluence](https://marketplace.atlassian.com/apps/1233075/appmap-for-confluence).
22
+
23
+ ## Add AppMap Diagrams to a Document or Blog Post
24
+
25
+ 1. **Enter Edit Mode:** Click the pencil icon to switch to Edit Mode in Confluence.
26
+ <img class="video-screenshot" src="/assets/img/enter-edit-mode.png"/>
27
+
28
+ 2. **Attach AppMap File:** Drag and drop the AppMap file from your file system or Finder into the Confluence page.
29
+ <img class="video-screenshot" src="/assets/img/drag-and-drop-appmap.webp"/>
30
+
31
+ 3. **Insert AppMap:** Click the plus sign to get the insert menu. Type in and select 'AppMap'.
32
+ <img class="video-screenshot" src="/assets/img/insert-appmap.webp"/>
33
+ A placeholder that looks like this will be added to the page:
34
+ <img class="video-screenshot" src="/assets/img/appmap-placeholder-confluence.png"/>
35
+
36
+ 4. **Choose AppMap:** Click the pencil under the placeholder to open the AppMap options.
37
+ <img class="video-screenshot" src="/assets/img/edit-menu-confluence.png"/>
38
+ Select the AppMap you want to display from the dropdown menu and it will render.
39
+ <img class="video-screenshot" src="/assets/img/select-an-appmap-confluence.webp"/>
40
+ <p class="alert alert-info"> If your AppMap does not render, make sure that you are working on a published document. AppMap Diagrams will not render until the document has been published at least once</p>
41
+
42
+ 5. **Adjust Width (Optional)** The width adjustment controls at the bottom of the AppMap window can be used to view more of the AppMap inline.
43
+ <img class="video-screenshot" src="/assets/img/width-adjustments-confluence.png"/>
44
+
45
+ 6. **Save Changes:** Click the 'Update' button to apply the changes to your Confluence page.
46
+ <img class="video-screenshot" src="/assets/img/update-button-confluence.png"/>
47
+
48
+ 7. **Fullscreen Mode (Optional):** Click on the 'full screen' icon in the AppMap use Fullscreen mode.
49
+ <img class="video-screenshot" src="/assets/img/full-screen-control-confluence.png"/>
50
+ <p class="alert alert-info"> If at any point you would like some help, <strong><a href="/slack">join us in Slack</a>!</strong> You'll find the AppMap team there, along with other AppMap users.</p>
51
+
@@ -0,0 +1,424 @@
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
+ ---
11
+
12
+ # CircleCI <!-- omit in toc -->
13
+
14
+ <p class="alert alert-info">
15
+ If at any point you would like some help, <a href="/slack">join us in Slack</a>!
16
+ You'll find the AppMap team there, along with other AppMap users.
17
+ </p>
18
+
19
+ ## Overview <!-- omit in toc -->
20
+ 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.
21
+
22
+ - [How it works](#how-it-works)
23
+ - [Step-by-step walkthrough](#step-by-step-walkthrough)
24
+ - [Prerequisites](#prerequisites)
25
+ - [Step 1: Setup AppMap file sync in existing CircleCI Project](#step-1-setup-appmap-file-sync-in-existing-circleci-project)
26
+ - [Step 2: Setup AppMap GitHub Action for baseline](#step-2-setup-appmap-github-action-for-baseline)
27
+ - [Step 3: Add AppMap to compare HEAD revision](#step-3-add-appmap-to-compare-head-revision)
28
+ - [Step 4: Merge Pull Request to enable AppMap](#step-4-merge-pull-request-to-enable-appmap)
29
+ - [Example Project Files](#example-project-files)
30
+ - [Advanced Configuration Options](#advanced-configuration-options)
31
+ - [Prerequisites](#prerequisites-1)
32
+ - [Step 1: Add or Update AppMap action to use `repository_dispatch` trigger](#step-1-add-or-update-appmap-action-to-use-repository_dispatch-trigger)
33
+ - [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)
34
+ - [Next Steps](#next-steps)
35
+
36
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/analysis-github-action.webp"/>
37
+
38
+ ## How it works
39
+
40
+ 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.
41
+
42
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/circleci-github-arch-diagram.webp"/>
43
+
44
+ In this example, the following events will happen:
45
+
46
+ <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>
47
+ - A tarball (`tar`) file of the `tmp/appmap` directory is created in the CircleCI runner.
48
+ - 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.
49
+
50
+ <b>2) While the CircleCI build is running, the AppMap GitHub Action will also trigger, looking for a baseline archive for comparison.</b>
51
+ - The AppMap GitHub Action waits until all the complete AppMap Dataset exists on the central storage location before continuing.
52
+ - This will download the raw AppMap Data archive created by CircleCI in your previous step to generate a baseline archive for comparison.
53
+
54
+ <b>3) The GitHub Action will analyze the latest maps against the baseline for the pull request.
55
+ - The AppMap GitHub Action will provide a full runtime code analysis diff report as a comment in your pull request.</b>
56
+
57
+ ## Step-by-step walkthrough
58
+
59
+ ### Prerequisites
60
+
61
+ 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).
62
+
63
+ 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.
64
+
65
+ ### Step 1: Setup AppMap file sync in existing CircleCI Project
66
+
67
+ 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.
68
+
69
+ ```yaml
70
+ - run:
71
+ name: Create AppMap Data archive
72
+ command: tar --remove-files -cvzf <<pipeline.git.revision>>.tar tmp/appmap/
73
+ ```
74
+ {: .example-code}
75
+
76
+ 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.
77
+
78
+ 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.
79
+
80
+ ```yaml
81
+ - aws-cli/setup:
82
+ profile_name: Circle-CI-Write-to-S3
83
+ role_arn: arn:aws:iam::12345678900:role/Circle-CI-Write-to-S3
84
+
85
+ - aws-s3/copy:
86
+ from: <<pipeline.git.revision>>.tar
87
+ profile_name: Circle-CI-Write-to-S3
88
+ to: s3://circleci-appmap/
89
+ arguments: --region us-west-2
90
+ ```
91
+ {: .example-code}
92
+
93
+ [**Example Code Commit**](https://github.com/land-of-apps/circle-ci-example/commit/1b1f2e886c8ca0a166296147b083d3eb500a8c5f)
94
+
95
+ After you push this commit to your branch, CircleCI will trigger a workflow and you can confirm that the steps all completed successfully.
96
+
97
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/circle-ci-example-storage.webp"/>
98
+
99
+ 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.
100
+
101
+ ### Step 2: Setup AppMap GitHub Action for baseline
102
+
103
+ To setup the GitHub Action, create a new branch called `appmap-action` in your repository.
104
+
105
+ Create a new file with the name `.github/workflows/appmap-analysis.yml`
106
+
107
+ 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.
108
+
109
+ - Download the AppMap tooling into the runner.
110
+ - Check for an existing baseline AppMap archive stored in your GitHub artifact store.
111
+ - (If no baseline AppMap archive exists) Locate and download the tarball of AppMap Data for the base revision from your chosen centralized data store.
112
+ - (If no baseline AppMap archive exists) Create an AppMap archive of the baseline AppMap Data and store to your GitHub artifact store.
113
+
114
+ Commit your GitHub Action workflow file to your branch and open a new Pull Request which will trigger the action.
115
+
116
+ After the action completes running successfully, check the action summary and confirm a build artifact has been created like the following screenshot.
117
+
118
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/github-artifact-example.webp"/>
119
+
120
+ ### Step 3: Add AppMap to compare HEAD revision
121
+
122
+ 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.
123
+
124
+ [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.
125
+
126
+ 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.
127
+
128
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/initial-report.webp"/>
129
+
130
+ Your completed installation should now look like the following [Pull Request Example.](https://github.com/land-of-apps/circle-ci-example/pull/2)
131
+
132
+ ### Step 4: Merge Pull Request to enable AppMap
133
+
134
+ After you merge this Pull Request, AppMap will execute on each subsequent Pull Request.
135
+
136
+ 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:
137
+
138
+ - Root cause analysis of failed tests.
139
+ - Web service API changes, both breaking and non-breaking.
140
+ - New and resolved security findings.
141
+ - New and resolved performance findings.
142
+ - New and resolved findings in other categories: maintainability, reliability, and user-defined rules.
143
+ - "Behavioral diffs" as sequence diagrams showing changed runtime behavior within the PR.
144
+
145
+ [Example Pull Request with Runtime Code Diff](https://github.com/land-of-apps/rails-7-app/pull/14)
146
+
147
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/analysis-pull-request.webp"/>
148
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/analysis-checks-with-circleci.webp"/>
149
+
150
+ ## Example Project Files
151
+
152
+ - [Example Ruby on Rails Project](https://github.com/land-of-apps/rails-7-app/)
153
+ - [Pull Request with Runtime Code Diff](https://github.com/land-of-apps/rails-7-app/pull/14)
154
+ - [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)
155
+ - [GitHub Action Workflow File](https://github.com/land-of-apps/rails-7-app/blob/c70b48891f38f92223ec06a654406cb7a6886890/.github/workflows/appmap-analysis.yml)
156
+
157
+ ## Advanced Configuration Options
158
+
159
+ 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.
160
+
161
+ 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.
162
+
163
+ 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.
164
+
165
+ 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.
166
+
167
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/advanced-circleci-github-arch-diagram.webp"/>
168
+
169
+ ### Prerequisites
170
+
171
+ - [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.
172
+ - 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.
173
+ - 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.
174
+ - 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.
175
+
176
+ ### Step 1: Add or Update AppMap action to use `repository_dispatch` trigger
177
+
178
+ 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.
179
+
180
+ #### Add `searchPullRequest.js` to your project <!-- omit in toc -->
181
+
182
+ 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.
183
+
184
+ Add the following as a new file named `package.json` or add these project dependencies to your existing `package.json`
185
+
186
+ ```json
187
+ {
188
+ "dependencies": {
189
+ "@octokit/rest": "^20.0.2",
190
+ "yargs": "^17.7.2"
191
+ }
192
+ }
193
+ ```
194
+ {: .example-code}
195
+
196
+ #### Add/Update the AppMap Action to your project <!-- omit in toc -->
197
+
198
+ 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.
199
+
200
+ **Commit these files to your main branch and then continue to Step 2.**
201
+
202
+ This action has many steps to process the files and analyze your pull requests, below are details of what each step is doing.
203
+
204
+ * Reconfigure this environment variable to point to your specific central file location.
205
+
206
+ ```yaml
207
+ env:
208
+ appmap_storage_bucket: circleci-appmaps
209
+ ```
210
+ {: .example-code}
211
+
212
+ * Use this action to set the status of your Pull Request as "pending" for the commit being built.
213
+
214
+ ```yaml
215
+ - name: Set commit status as pending
216
+ uses: myrotvorets/set-commit-status-action@f8a3f50eca0d32f3e12dc3a98792bb588bf29626
217
+ with:
218
+ token: ${{ secrets.GITHUB_TOKEN }}
219
+ status: pending
220
+ context: AppMap Analysis
221
+ sha: ${{ github.event.client_payload.head_sha }}
222
+ ```
223
+ {: .example-code}
224
+
225
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/appmap-analysis-status.webp"/>
226
+
227
+
228
+ * Install the AppMap command line tools, but do not install the libraries.
229
+
230
+ ```yaml
231
+ - name: Install AppMap tools
232
+ uses: getappmap/install-action@v1
233
+ with:
234
+ install-appmap-library: false
235
+ ```
236
+ {: .example-code}
237
+
238
+ * 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`
239
+
240
+ ```yaml
241
+ - name: Check for existing baseline archive
242
+ id: check_for_baseline
243
+ env:
244
+ GITHUB_TOKEN: ${{ github.token }}
245
+ continue-on-error: true
246
+ run: |
247
+ appmap restore --check --revision ${base_sha} --github-repo ${GITHUB_REPOSITORY} --exact
248
+ ```
249
+ {: .example-code}
250
+
251
+ * 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.
252
+
253
+ ```yaml
254
+ - name: Download and extract appmap data archive
255
+ if: steps.check_for_baseline.outcome == 'failure'
256
+ run: |
257
+ aws s3 cp s3://${appmap_storage_bucket}/${base_sha}.tar ${base_sha}.tar
258
+ tar xvf ${base_sha}.tar
259
+
260
+ - name: Archive AppMap Data archive
261
+ if: steps.check_for_baseline.outcome == 'failure'
262
+ uses: getappmap/archive-action@v1
263
+ with:
264
+ revision: ${base_sha}
265
+ ```
266
+ {: .example-code}
267
+
268
+ 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.
269
+
270
+ * As in the previous example, reconfigure the storage bucket location based on where your AppMap Data archive is located.
271
+
272
+ ```yaml
273
+ env:
274
+ appmap_storage_bucket: circleci-appmaps
275
+ ```
276
+ {: .example-code}
277
+
278
+ * Install Node.js and the packages required to run the `searchPullRequest.js` application.
279
+
280
+ ```yaml
281
+ - name: Use Node.js
282
+ uses: actions/setup-node@v2
283
+ with:
284
+ node-version: '18'
285
+
286
+ - name: Install dependencies
287
+ run: npm ci
288
+ ```
289
+ {: .example-code}
290
+
291
+ * Download and extract the HEAD revision AppMap Data archive sent from CircleCI
292
+
293
+ ```yaml
294
+ - name: Download and extract AppMap Data archive
295
+ run: |
296
+ aws s3 cp s3://${appmap_storage_bucket}/${head_sha}.tar ${head_sha}.tar
297
+ tar xvf ${head_sha}.tar
298
+ ```
299
+ {: .example-code}
300
+
301
+ * Run `searchPullRequest.js` and locate the most recent Pull Request with the HEAD sha associated. This value will be stored in $LATESTPR.
302
+
303
+ ```yaml
304
+ - name: Get only the most recent issue with this head commit
305
+ run: echo LATESTPR=$(node searchPullRequest.js --ownerRepo=${GITHUB_REPOSITORY} --commit=${head_sha}) >> "$GITHUB_ENV"
306
+
307
+ ```
308
+ {: .example-code}
309
+
310
+ * Analyze the AppMap Data archive and compare the changes between the base and head revisions, passing the `issue-number` to the analyze-action.
311
+
312
+ ```yaml
313
+ - name: Analyze AppMap Data
314
+ uses: getappmap/analyze-action@v1
315
+ with:
316
+ issue-number: ${{env.LATESTPR}}
317
+ directory: .
318
+ base-revision: ${{ github.event.client_payload.base_sha }}
319
+ head-revision: ${{ github.event.client_payload.head_sha }}
320
+ ```
321
+ {: .example-code}
322
+
323
+ * Update the commit status for this repository_dispatch build.
324
+
325
+ ```yaml
326
+ - name: Update Commit Status
327
+ uses: myrotvorets/set-commit-status-action@v2.0.0
328
+ if: always()
329
+ with:
330
+ token: ${{ secrets.GITHUB_TOKEN }}
331
+ status: ${{ job.status }}
332
+ context: AppMap Analysis
333
+ sha: ${{ github.event.client_payload.head_sha }}
334
+ ```
335
+ {: .example-code}
336
+
337
+ The commit status update will look like the following in a successful pull request.
338
+
339
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/appmap-analysis-status-complete.webp"/>
340
+
341
+ 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.
342
+
343
+ [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)
344
+
345
+ ### Step 2: Update your CircleCI build to trigger the GitHub API on a successfully build completion.
346
+
347
+ 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)
348
+
349
+ 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.
350
+
351
+ 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.
352
+
353
+ First we can create a new job in our existing `.circleci/config.yml` file.
354
+
355
+ You'll need to update the following items according to your project:
356
+
357
+ - Ensure your GitHub Personal Access Token is saved as a CircleCI secure environment variable at `$GITHUB_PAT`
358
+ - Update the URL for triggering the `repository_dispatch` project. The format is: `https://api.github.com/repos/{ORGNAME}/{REPONAME}/dispatches`
359
+ - [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.
360
+
361
+ ```yaml
362
+ run_appmap_analysis:
363
+ docker:
364
+ - image: cimg/ruby:3.1.2
365
+
366
+ steps:
367
+ - checkout
368
+
369
+ - run:
370
+ name: Get base Git SHA
371
+ command: echo 'export BASE_SHA=$(git merge-base origin/main $CIRCLE_BRANCH)' >> $BASH_ENV
372
+
373
+ - run:
374
+ name: Run AppMap Analysis
375
+ command: |
376
+ curl -L \
377
+ -X POST \
378
+ -H "Accept: application/vnd.github.v3+json" \
379
+ -H "Authorization: token $GITHUB_PAT" \
380
+ -H "Content-Type: application/json" \
381
+ -H "X-GitHub-Api-Version: 2022-11-28" \
382
+ https://api.github.com/repos/land-of-apps/rails-7-app/dispatches \
383
+ -d @- \<<EOF
384
+ {
385
+ "event_type": "run_appmap_analysis",
386
+ "client_payload": {
387
+ "base_sha": "$BASE_SHA",
388
+ "head_sha": "<< pipeline.git.revision >>"
389
+ }
390
+ }
391
+ EOF
392
+ ```
393
+ {: .example-code}
394
+
395
+ 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.
396
+
397
+ ```yaml
398
+ workflows:
399
+ build:
400
+ jobs:
401
+ - build
402
+ - run_appmap_analysis:
403
+ requires:
404
+ - build
405
+ filters:
406
+ branches:
407
+ ignore:
408
+ - main
409
+ ```
410
+ {: .example-code}
411
+
412
+ 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.
413
+
414
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/circleci-build-example.webp"/>
415
+
416
+ 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.
417
+
418
+ 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.
419
+
420
+ <img class="video-screenshot" src="/assets/img/docs/gh-action/github-action-webhook-example.webp"/>
421
+
422
+ ## Next Steps
423
+
424
+ 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.
@@ -0,0 +1,109 @@
1
+ ---
2
+ layout: docs
3
+ title: Docs - Integrations
4
+ description: "Learn how to record AppMap Data inside a Docker container for consistent, reproducible environments across various operating systems, enhancing code quality and collaboration."
5
+ integrations: true
6
+ name: Docker
7
+ step: 7
8
+ ---
9
+
10
+ # Docker
11
+
12
+ AppMap supports capturing AppMap recordings from inside a Docker container, when using [Docker Compose](https://docs.docker.com/compose/), or when running [Docker Desktop](https://www.docker.com/products/docker-desktop/).
13
+
14
+ - [Why record AppMap Data within Docker?](#why-record-appmap-data-within-docker)
15
+ - [Sample Project](#sample-project)
16
+ - [How to run AppMap inside of Docker Engine](#how-to-run-appmap-inside-of-docker-engine)
17
+ - [How to run AppMap inside of Docker Compose](#how-to-run-appmap-inside-of-docker-compose)
18
+ - [Troubleshooting AppMap and Docker](#troubleshooting-appmap-and-docker)
19
+
20
+ ## Why record AppMap Data within Docker?
21
+
22
+ Recording AppMap Data inside a Docker container offers several advantages for developers. Docker's containerization ensures a consistent, reproducible environment across various operating systems, which is crucial for diagnosing and resolving issues that may be environment-specific. This uniformity simplifies the setup process, reduces the time spent on environment configuration, and increases the reliability of recorded AppMap Diagrams by mirroring the conditions under which software runs in production or other developers' environments.
23
+
24
+ Overall, using Docker for recording AppMap Data streamlines the development workflow, enhances code quality, and fosters collaboration among team members by ensuring that everyone works within an identical development setup.
25
+
26
+ ## Sample Project
27
+
28
+ To see an example project using Docker and configured with AppMap, you can see the necessary configuration available on our [sample project on GitHub](https://github.com/land-of-apps/sample_rails_app/).
29
+
30
+ - [Example Dockerfile](https://github.com/land-of-apps/sample_rails_app/blob/main/Dockerfile)
31
+ - [Example docker-compose.yml](https://github.com/land-of-apps/sample_rails_app/blob/main/docker-compose.yml)
32
+
33
+ ## How to run AppMap inside of Docker Engine
34
+
35
+ Using the example [Dockerfile](https://github.com/land-of-apps/sample_rails_app/blob/main/Dockerfile) above you need to make sure that you run Docker with the `-v` or `--volume` options in `docker run`.
36
+
37
+ For example to run the application with AppMap enabled in the sample project above, you will need to run:
38
+
39
+ ```
40
+ > docker run -p 3000:3000 -v $(pwd)/tmp/appmap:/app/tmp/appmap sample_rails_docker bundle exec rails server -b 0.0.0.0
41
+ ```
42
+ {: .example-code}
43
+
44
+ Let's breakdown what that command is doing:
45
+
46
+ - `docker run`: Command to create and start a new container.
47
+ - `-p 3000:3000`: Maps port 3000 on the host to port 3000 in the container.
48
+ - `-v $(pwd)/tmp/appmap:/app/tmp/appmap`: Mounts the tmp/appmap directory from the current directory on the host to /app/tmp/appmap in the container for file sharing.
49
+ **NOTE** Update `/app/` in the command to where your application is configured to run.
50
+ - `sample_rails_docker`: The name of the Docker image to use for the container.
51
+ - `bundle exec rails server -b 0.0.0.0`: The command executed within the container to start the application.
52
+
53
+ After recording your AppMap Data, you'll now see them in the VS Code or JetBrains extension. The maps will also be visible in your local directory in the `tmp/appmap` folder.
54
+
55
+ <img class="video-screenshot" src="/assets/img/docs/guides/docker-appmaps.webp"/>
56
+
57
+ ## How to run AppMap inside of Docker Compose
58
+
59
+ Using the example [docker-compose.yml](https://github.com/land-of-apps/sample_rails_app/blob/main/docker-compose.yml) file in our sample project. Here is the relevant part of the config.
60
+
61
+ ```
62
+ services:
63
+ web:
64
+ build: .
65
+ command: bundle exec rails server -b 0.0.0.0
66
+ ports:
67
+ - "3000:3000"
68
+ volumes:
69
+ - ./tmp/appmap:/app/tmp/appmap
70
+ ```
71
+ {: .example-code}
72
+
73
+ Let's explain the main part of our relevant configuration.
74
+
75
+ services: Defines the services that make up your application.
76
+
77
+ - `web`: The name of the first (and in this case, only) service.
78
+ - `build: .`: Tells Docker to build the Docker image for the web service using the Dockerfile in the current directory.
79
+ - `command: bundle exec rails server -b 0.0.0.0`: Overrides the default command to start the Rails server, making it accessible from any IP address.
80
+ - `ports: "3000:3000"`: Maps port 3000 on the host to port 3000 in the container, allowing access to the application via localhost:3000.
81
+ - `volumes: ./tmp/appmap:/app/tmp/appmap`: Mounts the tmp/appmap directory from the host into the container at /app/tmp/appmap for file sharing.
82
+ **NOTE** Update `/app/` in the command to where your application is configured to run.
83
+
84
+ You can now run `docker compose up web` to launch this container using Docker Compose. When interacting with the application your maps will be displayed in the VS Code or JetBrains plugin. The maps will also be visible in your local directory in the `tmp/appmap` folder.
85
+
86
+ <img class="video-screenshot" src="/assets/img/docs/guides/docker-file-share.webp"/>
87
+
88
+
89
+ ## Troubleshooting AppMap and Docker
90
+
91
+ ### AppMap Diagrams are not visible in plugin with directory correctly mounted <!-- omit in toc -->
92
+
93
+ You may experience an issue on Linux where you have correctly bind mounted the `tmp/appmap` directory into your Docker container, but are still unable to see the AppMap Diagrams in your project.
94
+
95
+ <img class="video-screenshot" src="/assets/img/docs/guides/docker-no-appmaps.webp"/>
96
+
97
+ You can confirm this by looking in the `tmp/appmap` directory in your project file directory listing like in the screenshot below:
98
+
99
+ <img class="video-screenshot" src="/assets/img/docs/guides/docker-maps-directory.webp"/>
100
+
101
+ You can see in that screenshot, a list of AppMap files are visible, and if we opened them in the editor, they would be visible as an AppMap.
102
+
103
+ <img class="video-screenshot" src="/assets/img/docs/guides/docker-open-map.webp"/>
104
+
105
+ When using Docker on Linux, developers might encounter a situation where directories mounted inside a Docker container as bind mounts (using the -v or --volume flag) are owned by the root user. This happens because, by default, Docker runs its containers as the root user, unless specified otherwise. As a result, any files or directories created inside the container on these bind mounts will also be owned by root. Because the AppMap files in `tmp/appmap` are now owned as the `root` user, the AppMap editor extension is unable to index them, which is necessary for them to be visible in the code editor extension.
106
+
107
+ We recommend reviewing the [Docker official documentation regarding bind mounts](https://docs.docker.com/storage/bind-mounts/) for the most up to date information on the permission settings for linux bind mounts.
108
+
109
+ As a Linux user, make sure that the user/group you are running VS Code as also has write access. For more info, refer to [this blog post](https://techflare.blog/permission-problems-in-bind-mount-in-docker-volume/) which goes into detail about Linux, Docker, and file permissions.