Created
May 31, 2021 13:15
-
-
Save rick-roche/c083ba72e9acd7635cff3c2757ee04bf to your computer and use it in GitHub Desktop.
Azure Pipelines and Dependabot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schedules: | |
- cron: "0 4 * * 1" | |
displayName: 'Weekly Run' | |
always: true | |
branches: | |
include: | |
- main | |
trigger: none | |
variables: | |
- name: imageToCache | |
value: tingle/dependabot-azure-devops:0.4 | |
stages: | |
- stage: CheckDependencies | |
displayName: 'Check Dependencies' | |
jobs: | |
- job: Dependabot | |
displayName: 'Run Dependabot' | |
pool: | |
vmImage: 'ubuntu-latest' | |
steps: | |
- task: CreateWorkItem@1 | |
displayName: 'Create User Story for Dependabot' | |
inputs: | |
workItemType: 'User Story' | |
title: 'Update Dependencies' | |
fieldMappings: | | |
Tags=dependabot; dependencies | |
areaPath: 'your\area' | |
iterationPath: 'your\iteration' | |
preventDuplicates: true | |
keyFields: | | |
System.AreaPath | |
System.IterationPath | |
System.Title | |
createOutputs: true | |
outputVariables: | | |
workItemId=ID | |
- task: Cache@2 | |
inputs: | |
key: docker | "${{ variables.imageToCache }}" | |
path: $(Pipeline.Workspace)/docker | |
cacheHitVar: DOCKER_CACHE_HIT | |
displayName: Cache Docker images | |
- script: | | |
docker load -i $(Pipeline.Workspace)/docker/cache.tar | |
displayName: Restore Docker image | |
condition: and(not(canceled()), eq(variables.DOCKER_CACHE_HIT, 'true')) | |
- script: | | |
mkdir -p $(Pipeline.Workspace)/docker | |
docker pull -q ${{ variables.imageToCache }} | |
docker save -o $(Pipeline.Workspace)/docker/cache.tar ${{ variables.imageToCache }} | |
displayName: Save Docker image | |
condition: and(not(canceled()), or(failed(), ne(variables.DOCKER_CACHE_HIT, 'true'))) | |
- task: dependabot@1 | |
displayName: 'Run Dependabot' | |
inputs: | |
packageManager: 'nuget' | |
targetBranch: 'main' | |
openPullRequestsLimit: 10 | |
workItemId: $(workItemId) | |
setAutoComplete: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment