You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tools/assets-automation/asset-sync/README.md
-14Lines changed: 0 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,6 @@
3
3
-[Azure SDK Assets Relocation -- "move recordings out of repos"](#azure-sdk-assets-relocation----move-recordings-out-of-repos)
4
4
-[What is the problem? Why?](#what-is-the-problem-why)
5
5
-[How the test-proxy can ease transition of external recordings](#how-the-test-proxy-can-ease-transition-of-external-recordings)
6
-
-[Old](#old)
7
-
-[New](#new)
8
6
-[Which external storage mediums were considered?](#which-external-storage-mediums-were-considered)
9
7
-[`Git SubModules`](#git-submodules)
10
8
-[Advantages of `Git SubModules`](#advantages-of-git-submodules)
@@ -99,18 +97,6 @@ All that needs to happen is to:
99
97
2. Adjust the provided "file path" to the recording within the asset repo if necesssary.
100
98
3. Profit.
101
99
102
-
If you were invoking the test-proxy as a docker image, the difference in initialization is as easy as:
103
-
104
-
### Old
105
-
106
-
`docker run -v C:/repo/sdk-for-python/:/etc/testproxy azsdkengsys.azurecr.io/engsys/testproxy-lin:latest`
107
-
108
-
### New
109
-
110
-
`docker run -v C:/repo/sdk-for-python-assets/:/etc/testproxy azsdkengsys.azurecr.io/engsys/testproxy-lin:latest`
111
-
112
-
Given the same relative path in the assets repo, zero changes to test code are necessary.
113
-
114
100
## Which external storage mediums were considered?
115
101
116
102
Prior to ScottB starting on this project, JimS was the one leading the charge. As part of that work, [Jim explored a few potentional storage solutions](https://microsoft.sharepoint.com/:w:/t/AzureDeveloperExperience/EZ8CA-UTsENIoORsOxekfG8BzwoNV4xhVOIzTGmdk8j4rA?e=RKAkkc). He did not evaluate these strictly from a `usability` standpoint.
@@ -35,7 +35,7 @@ An `assets.json` takes the form:
35
35
|---|---|
36
36
| AssetsRepo | The full name of the external github repo storing the data. EG: `Azure/azure-sdk-assets`|
37
37
| AssetsRepoPrefixPath | The assets repository may want to place the content under a specific path in the assets repo. The default should be the language that the assets belong to. EG: `python`, `net`, `java` etc. |
38
-
| TagPrefix |`<Language>/<ServiceDirectory>` or `<Language>/<ServiceDirectory>/<Library>` or deeper if things are nested in such a manner. |
38
+
| TagPrefix |`<Language>/<ServiceDirectory>` or `<Language>/<ServiceDirectory>/<Library>` or deeper if things are nested in such a manner. This exists **purely** for ease of recognizing your tags.|
39
39
| Tag | Initially empty until after the first push at which point the tag will be the `<TagPrefix><10-character-commit-SHA>`|
40
40
41
41
Comments within the assets.json are allowed and _maintained_ by the tooling. Feel free to leave notes to yourself. They will not be eliminated.
@@ -167,6 +167,19 @@ As you run tests in `recording` or `playback` mode, the `test-proxy` automatical
167
167
168
168
To view the changes before pushing, use one of the one-liners defined below [below](#attempt-to-manually-resolve).
169
169
170
+
### I'm starting entirely fresh with no recordings, what should I do first?
171
+
172
+
All new packages in `azure-sdk` must externalize their recordings, so begin by creating an `assets.json` at your package root.
173
+
174
+
You could...
175
+
176
+
-**Manually** generate it from the example `assets.json`[further up in this document](#the-assetsjson-and-how-it-enables-external-recordings)
177
+
- Utilize the powershell script `eng/common/testproxy/onboarding/generate-assets-json.ps1`**without**`-InitialPush` flag. [The README is here.](/eng/common/testproxy/onboarding/README.md)
178
+
179
+
Given the relative lack of complexity present in an `assets.json`, manual generation is recommended _unless recordings already exist_. In which case [this later section has you covered.](#im-a-dev-who-uses-the-test-proxy-currently-how-do-i-externalize-my-recordings)
180
+
181
+
Once an assets.json with **blank**`Tag` value is present, start your recordings in `Record` mode as normal. Given that there is no tag present in the `assets.json`, the `main` branch will be restored from `azure-sdk-assets`. From there, on successful record-test run, the assets will be in a `test-proxy push`-able state. After that first push, your `tag` will be populated!
182
+
170
183
### My tests don't use the test-proxy at all currently, how do I externalize my recordings?
171
184
172
185
You don't. Your first step is to integrate your test framework with the `test-proxy`.
@@ -189,7 +202,7 @@ Use [the transition script](https://github.com/Azure/azure-sdk-tools/blob/main/e
189
202
190
203
In summary, once an assets.json is present, the shim _must_ be updated to **actually send** a reference to that assets.json inside the `record/start` or `playback/start` requests!
191
204
192
-

205
+

193
206
194
207
### What does this look like in practice?
195
208
@@ -205,7 +218,7 @@ One can see the automatically restored assets repos within the `.assets` folder.
205
218
206
219
The below diagram illustrates how an individual assets.json, language repo, and assets repo relate to each other.
A user can use the `config` verb to access this the location of their assets on disk! Using assets diagram directly as a reference. we can work an example:
211
224
@@ -229,7 +242,7 @@ C:/repo/sdk-for-python/>test-proxy push -a sdk/tables/assets.json
229
242
230
243
So with the above invocation, the _actual_ location of the assets.json would be: `C:/repo/sdk-for-python/sdk/tables/assets.json`.
231
244
232
-
When calling the tool (not `docker` unfortunately , due to `mount` constraints), _absolute_ paths are also supported. In that case, context directory does not matter at all.
245
+
When calling the tool, _absolute_ paths are also supported. In that case, context directory does not matter at all.
233
246
234
247
```text
235
248
test-proxy push -a C:/repo/sdk-for-python/sdk/tables/assets.json
@@ -244,31 +257,6 @@ After running tests in `record` mode.
244
257
1. Confirm lack of secrets (as always with recordings).
245
258
2.`test-proxy push <path-to-assets-json>`
246
259
247
-
> **Important Note** When using `docker` mode with test-proxy push, one will need to invoke the docker container with a couple additional environment variable settings.
Please note that any proxy arguments that include _paths_ will need to be **relative** when calling the docker container to do the work for you. This is due to the fact that the running container stores its files under an **internal** path representation. The repo root will be mounted under the default context-directory of `/srv/testproxy/`_always_ for the running container, so all paths must be expressed relatively from that root to actually resolve.
256
-
257
-
```powershell
258
-
# absolute path to assets json
259
-
C:/repo/sdk-for-python/sdk/tables/assets.json
260
-
261
-
# docker container is run, mounting repo root C:/repo/sdk-for-python/ to /srv/testproxy/. The whole path will no longer align
262
-
# but the relative path from the root of the repo WILL.
263
-
/srv/testproxy/sdk/tables/assets.json
264
-
```
265
-
266
-
So to make a push work for the above scenario, all one must do is only include the path from the root of the repo.
267
-
268
-
```powershell
269
-
docker run --rm -v "C:/repo/sdk-for-python:/srv/testproxy" -e "GIT_TOKEN=myveryrealtoken" -e "GIT_COMMIT_OWNER=scbedd" -e "GIT_COMMIT_EMAIL=scbedd@microsoft.com" azsdkengsys.azurecr.io/engsys/test-proxy:latest test-proxy push -a sdk/tables/assets.json
270
-
```
271
-
272
260
#### An additional note about using `test-proxy push` in codespaces
273
261
274
262
The `test-proxy` can (and is) used to run tests in github codespaces. However, there is a wrinkle when **pushing** from a default codespaces configuration to the assets repository.
@@ -283,7 +271,7 @@ The `azure-sdk` team has chosen to address this difficulty by [applying the foll
283
271
284
272
> **Note** Codespaces created on **forks** do not magically gain write permissions to `azure-sdk-assets`.
285
273
286
-
To push from a codespace on a fork, devs will need to set `GIT_TOKEN` themselves to a PAT that has write access to `azure-sdk-assets`. Effectively the same route as if they wanted to use docker.
274
+
To push from a codespace on a fork, devs will need to set `GIT_TOKEN` themselves to a PAT that has write access to `azure-sdk-assets`.
287
275
288
276
### I am getting weird errors out of my test-proxy operations
0 commit comments