Skip to content

Commit cc63a67

Browse files
committed
blocking
1 parent 754ed19 commit cc63a67

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

docs/pipelines/artifacts/caching-nuget.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ monikerRange: 'azure-devops'
1313

1414
**Azure DevOps Services**
1515

16-
With pipeline caching, you can reduce your build time by caching your dependencies to be reused in later runs. In this article, you'll learn how to use the [Cache task](/azure/devops/pipelines/tasks/reference/cache-v2) to cache and restore your NuGet packages.
16+
With pipeline caching, you can reduce your build time by caching your dependencies to be reused in later runs. In this article, you learn how to use the [Cache task](/azure/devops/pipelines/tasks/reference/cache-v2) to cache and restore your NuGet packages.
1717

1818
> [!NOTE]
19-
> Pipeline caching is supported in agent pool jobs for both YAML and Classic pipelines. However, it is not supported in Classic release pipelines.
19+
> Pipeline caching is not supported in Classic release pipelines.
2020
2121
## Lock dependencies
2222

@@ -120,7 +120,7 @@ steps:
120120
configuration: '$(buildConfiguration)'
121121
```
122122

123-
This approach is also valid for .NET Core projects if your project uses *packages.lock.json* to lock package versions. You can enable this by setting `RestorePackagesWithLockFile` to `True` in your *.Csproj* file, or by using the following command: `dotnet restore --use-lock-file`.
123+
This approach is also valid for .NET Core projects if your project uses *packages.lock.json* to lock package versions. You can enable this by setting `RestorePackagesWithLockFile` to `True` in your * Csproj* file, or by using the following command: `dotnet restore --use-lock-file`.
124124

125125
## Related articles
126126

docs/pipelines/release/caching.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pipeline caching can help reduce build time by allowing the outputs or downloade
1818
Caching can be effective at improving build time provided the time to restore and save the cache is less than the time to produce the output again from scratch. Because of this, caching may not be effective in all scenarios and may actually have a negative impact on build time.
1919

2020
> [!NOTE]
21-
> Pipeline caching is supported in agent pool jobs for both YAML and Classic pipelines. However, it is not supported in Classic release pipelines.
21+
> Pipeline caching is not supported in Classic release pipelines.
2222
2323
### When to use artifacts versus caching
2424

@@ -29,7 +29,7 @@ Pipeline caching and [pipeline artifacts](../artifacts/pipeline-artifacts.md) pe
2929
* **Use pipeline caching** when you want to improve build time by reusing files from previous runs (and not having these files won't impact the job's ability to run).
3030

3131
> [!NOTE]
32-
> Pipeline caching and pipeline artifacts are free for all tiers (free and paid). see [Artifacts storage consumption](../../artifacts/artifact-storage.md) for more details.
32+
> Pipeline caching and pipeline artifacts are free for all tiers (free and paid). See [Artifacts storage consumption](../../artifacts/artifact-storage.md) for more details.
3333
3434
## Cache task: how it works
3535

@@ -40,7 +40,7 @@ When a cache step is encountered during a run, the task restores the cache based
4040
After all steps in the job have run and assuming a **successful** job status, a special **"Post-job: Cache"** step is automatically added and triggered for each **"restore cache"** step that wasn't skipped. This step is responsible for **saving the cache**.
4141

4242
> [!NOTE]
43-
> Caches are immutable, meaning that once a cache is created, its contents cannot be changed.
43+
> Caches are immutable, meaning once a cache is created, its content is unchangeable.
4444
4545
### Configure the Cache task
4646

@@ -139,15 +139,17 @@ steps:
139139

140140
In this example, the cache task attempts to find if the key exists in the cache. If the key doesn't exist in the cache, it tries to use the first restore key `yarn | $(Agent.OS)`.
141141
This attempts to search for all keys that either exactly match that key or has that key as a prefix. A prefix hit can happen if there was a different `yarn.lock` hash segment.
142-
For example, if the following key `yarn | $(Agent.OS) | old-yarn.lock` was in the cache where the `old-yarn.lock` yielded a different hash than `yarn.lock`, the restore key will yield a partial hit.
142+
For example, if the following key `yarn | $(Agent.OS) | old-yarn.lock` was in the cache where the `old-yarn.lock` yielded a different hash than `yarn.lock`, the restore key would yield a partial hit.
143143
If there's a miss on the first restore key, it will then use the next restore key `yarn` which will try to find any key that starts with `yarn`. For prefix hits, the result yields the most recently created cache key as the result.
144144

145145
> [!NOTE]
146-
> A pipeline can have one or more caching task(s). There is no limit on the caching storage capacity, and jobs and tasks from the same pipeline can access and share the same cache.
146+
> A pipeline can have one or more caching tasks. There's no limit on the caching storage capacity, and jobs and tasks from the same pipeline can access and share the same cache.
147147

148148
## Cache isolation and security
149149

150-
To ensure isolation between caches from different pipelines and different branches, every cache belongs to a logical container called a scope. Scopes provide a security boundary that ensures a job from one pipeline cannot access the caches from a different pipeline, and a job building a PR has read access to the caches for the PR's target branch (for the same pipeline), but cannot write (create) caches in the target branch's scope.
150+
To ensure isolation between caches from different pipelines and different branches, every cache belongs to a logical container called a scope. Scopes provide a security boundary that ensures:
151+
1. A job from one pipeline can't access the caches from a different pipeline, and
152+
1. A job building a PR has read access to the caches for the PR's target branch (for the same pipeline), but can't write (create) caches in the target branch's scope.
151153

152154
When a cache step is encountered during a run, the cache identified by the key is requested from the server. The server then looks for a cache with this key from the scopes visible to the job, and returns the cache (if available). On cache save (at the end of the job), a cache is written to the scope representing the pipeline and branch. See below for more details.
153155

@@ -179,11 +181,11 @@ When a cache step is encountered during a run, the cache identified by the key i
179181
| `master` branch | Yes | No |
180182

181183
> [!TIP]
182-
> Because caches are already scoped to a project, pipeline, and branch, there is no need to include any project, pipeline, or branch identifiers in the cache key.
184+
> Because caches are already scoped to a project, pipeline, and branch, there's no need to include any project, pipeline, or branch identifiers in the cache key.
183185

184186
## Conditioning on cache restoration
185187

186-
In some scenarios, the successful restoration of the cache should cause a different set of steps to be run. For example, a step that installs dependencies can be skipped if the cache was restored. This is possible using the `cacheHitVar` task input. Setting this input to the name of an environment variable causes the variable to be set to `true` when there's a cache hit, `inexact` on a restore key cache hit, otherwise it is set to `false`. This variable can then be referenced in a [step condition](../process/conditions.md) or from within a script.
188+
In some scenarios, the successful restoration of the cache should cause a different set of steps to be run. For example, a step that installs dependencies can be skipped if the cache was restored. This is possible using the `cacheHitVar` task input. Setting this input to the name of an environment variable causes the variable to be set to `true` when there's a cache hit, `inexact` on a restore key cache hit, otherwise it's set to `false`. This variable can then be referenced in a [step condition](../process/conditions.md) or from within a script.
187189

188190
In the following example, the `install-deps.sh` step is skipped when the cache is restored:
189191

@@ -408,7 +410,7 @@ steps:
408410
displayName: Cache NuGet packages
409411
```
410412

411-
This approach is also valid for .NET Core projects if your project uses *packages.lock.json* to lock package versions. You can enable this by setting `RestorePackagesWithLockFile` to `True` in your *.csproj* file, or by using the following command: `dotnet restore --use-lock-file`.
413+
This approach is also valid for .NET Core projects if your project uses *packages.lock.json* to lock package versions. You can enable this by setting `RestorePackagesWithLockFile` to `True` in your *Csproj* file, or by using the following command: `dotnet restore --use-lock-file`.
412414

413415
## Node.js/npm
414416

0 commit comments

Comments
 (0)