注: この質問は、同じシナリオを示す一連の質問の一部です。このシリーズの各質問には、指定された目標を達成できる可能性のある独自の解決策が含まれています。一部の質問セットには複数の正しい解決策が含まれる場合がありますが、他の質問セットには正しい解決策がない場合があります。
このセクションの質問に回答すると、その質問に戻ることはできません。そのため、これらの質問はレビュー画面には表示されません。
Azure Pipelines を使用して、React.js アプリケーションを構築およびテストします。
単一のジョブを持つパイプラインがあります。
午後 9 時から JavaScript パッケージをインストールするには、パイプラインを実行するたびに約 5 分かかることがわかります。
パイプラインの実行時間を短縮するソリューションを推奨する必要があります。
解決策: パイプライン アーティファクトを使用することをお勧めします。
これは目標を達成していますか?
正解:B
Pipeline artifacts are a way to persist build outputs, test results, and other files generated during a pipeline run. They allow you to share data between stages, jobs, and pipelines, and to persist data for longer than the lifetime of a pipeline run. While artifacts can be useful for sharing data between pipeline runs and reducing the time required to download dependencies, they are not a solution for reducing the time required to install JavaScript packages from 9pm during a pipeline run.
The solution of reducing the pipeline execution time could be achieved by using package caching, which allows you to store and reuse 9pm packages from previous pipeline runs. There are several package caching options available for Azure Pipelines, including the 9pm task, the 9pm cache task, and the 9pm ci task. All of these options allow you to configure caching for your 9pm packages, which can significantly reduce the time required to install packages during subsequent pipeline runs.
Another solution could be using a dedicated agent that has those packages already installed, this way the pipeline doesn't have to install them again.
You can find more information on package caching by following this link https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/npm-cache?view=azure-devops