├── docker ├── event-handler.sh ├── test-workload.sh ├── startup-script.test.sh ├── Dockerfile.prod ├── startup-script.prd.sh ├── Dockerfile.test ├── create-prd-image-local.bat └── README.md ├── assets ├── Main_Flow.jpg ├── Container_Structure.jpg ├── ACI_Orchestration_Flow.jpg └── Container_Structure_BIG.jpg ├── .github ├── FUNDING.yml └── workflows │ ├── functions-ci.yml │ ├── build-test-image.yml │ └── build-prod-image.yml ├── DependabotOrchestrator ├── DependabotOrchestrator │ ├── Properties │ │ ├── serviceDependencies.json │ │ └── serviceDependencies.local.json │ ├── host.json │ ├── Extensions │ │ └── EnumExtensions.cs │ ├── Model │ │ ├── PackageManagerType.cs │ │ ├── Constants.cs │ │ ├── DependabotSource.cs │ │ └── Settings.cs │ ├── JobFinishedEventHandler.cs │ ├── DependabotOrchestrator.csproj │ ├── .gitignore │ ├── DependabotOrchestrator.cs │ └── Managers │ │ └── AzureManager.cs └── DependabotOrchestrator.sln ├── examples ├── ExamplePayload.json └── settings.example.json ├── README.md └── .gitignore /docker/event-handler.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | curl -X POST $JOBCOMPLETE_FUNCTION_URL/$ORCHESTRATOR_INSTANCE_ID -------------------------------------------------------------------------------- /assets/Main_Flow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/HEAD/assets/Main_Flow.jpg -------------------------------------------------------------------------------- /assets/Container_Structure.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/HEAD/assets/Container_Structure.jpg -------------------------------------------------------------------------------- /docker/test-workload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo Waiting 1 minutes to simulate actual workload 4 | 5 | sleep 1m 6 | 7 | echo Work completed -------------------------------------------------------------------------------- /assets/ACI_Orchestration_Flow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/HEAD/assets/ACI_Orchestration_Flow.jpg -------------------------------------------------------------------------------- /assets/Container_Structure_BIG.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/HEAD/assets/Container_Structure_BIG.jpg -------------------------------------------------------------------------------- /docker/startup-script.test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo Executing workload 4 | /Test/test-workload.sh 5 | 6 | echo Raising the Job Finished event 7 | /Test/event-handler.sh -------------------------------------------------------------------------------- /docker/Dockerfile.prod: -------------------------------------------------------------------------------- 1 | FROM dependabot-script-local 2 | 3 | COPY ["startup-script.prd.sh", "."] 4 | 5 | COPY ["event-handler.sh", "."] 6 | 7 | ENTRYPOINT ["bash", "startup-script.prd.sh"] -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [n3wt0n] 4 | patreon: CoderDave 5 | custom: ["https://www.paypal.me/dabenveg", "https://buymeacoffee.com/CoderDave"] 6 | -------------------------------------------------------------------------------- /docker/startup-script.prd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo Executing workload 4 | bundle exec ruby generic-update-script.rb |& tee /output/dependabot-output.txt 5 | 6 | echo Raising the Job Finished event 7 | ./event-handler.sh |& tee /output/event-handler-output.txt -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/Properties/serviceDependencies.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "appInsights1": { 4 | "type": "appInsights" 5 | }, 6 | "storage1": { 7 | "type": "storage", 8 | "connectionId": "AzureWebJobsStorage" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "logging": { 4 | "applicationInsights": { 5 | "samplingSettings": { 6 | "isEnabled": true, 7 | "excludedTypes": "Request" 8 | } 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/Properties/serviceDependencies.local.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "appInsights1": { 4 | "type": "appInsights.sdk" 5 | }, 6 | "storage1": { 7 | "type": "storage.emulator", 8 | "connectionId": "AzureWebJobsStorage" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/Extensions/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DependabotOrchestrator.Extensions 4 | { 5 | public static class EnumExtensions 6 | { 7 | public static string Name (this Enum obj) 8 | => Enum.GetName(obj.GetType(), obj); 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /docker/Dockerfile.test: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | COPY ["startup-script.test.sh", "Test/"] 4 | RUN ["chmod", "+x", "Test/startup-script.test.sh"] 5 | 6 | COPY ["test-workload.sh", "Test/"] 7 | RUN ["chmod", "+x", "Test/test-workload.sh"] 8 | 9 | COPY ["event-handler.sh", "Test/"] 10 | RUN ["chmod", "+x", "Test/event-handler.sh"] 11 | 12 | RUN apk --no-cache add curl 13 | 14 | ENTRYPOINT ["sh", "Test/startup-script.test.sh"] -------------------------------------------------------------------------------- /docker/create-prd-image-local.bat: -------------------------------------------------------------------------------- 1 | :: Use this file only to create a "test" image locally. To create a production image, the GitHub Actions workflow is used instead 2 | 3 | mkdir .\dependabotimage 4 | cd .\dependabotimage 5 | 6 | git clone https://github.com/dependabot/dependabot-script.git . 7 | 8 | docker build -t "dependabot-script-local" -f Dockerfile . 9 | 10 | cd .. 11 | rmdir .\dependabotimage /S /Q 12 | 13 | docker build -t "dependabot-azuredevops-atscale" -f Dockerfile.prod . -------------------------------------------------------------------------------- /examples/ExamplePayload.json: -------------------------------------------------------------------------------- 1 | //.NET 2 | [{ 3 | "repoUri": "https://dev.azure.com/dbtek/DependabotTest1/_git/DependabotTest1NET", 4 | "packageManager": 11, 5 | "dependencyPath": "/", 6 | "branch": null, 7 | "pullRequestAssignee": null 8 | }] 9 | 10 | 11 | //PYTHON 12 | [{ 13 | "repoUri": "https://dev.azure.com/dbtek/DependabotTest1/_git/DependabotTest1PYTHON", 14 | "packageManager": 12, 15 | "dependencyPath": "/", 16 | "branch": null, 17 | "pullRequestAssignee": null 18 | }] -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/Model/PackageManagerType.cs: -------------------------------------------------------------------------------- 1 | namespace DependabotOrchestrator.Model 2 | { 3 | public enum PackageManagerType 4 | { 5 | bundler, 6 | cargo, 7 | composer, 8 | dep, 9 | docker, 10 | elm, 11 | go_modules, 12 | gradle, 13 | hex, 14 | maven, 15 | npm_and_yarn, 16 | nuget, 17 | pip, 18 | submodules, 19 | terraform 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/Model/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace DependabotOrchestrator.Model 2 | { 3 | public class Constants 4 | { 5 | public const string DefaultContainerGroupName = "dpbrunner"; 6 | public const string ContainerImageName = "n3wt0n/dependabot-azuredevops-atscale"; 7 | public const string TestContainerImageName = "n3wt0n/dependabot-azuredevops-atscale-testimage"; 8 | public const string DefaultContainerImageTag = "latest"; 9 | public const int DefaultMaxParallelism = 3; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | ### WINDOWS DEVELOPERS 2 | 3 | Before committing changes on this folder's `*.sh` files, execute: 4 | 5 | ```bash 6 | git update-index --chmod=+x docker/event-handler.sh 7 | git update-index --chmod=+x docker/startup-script.prd.sh 8 | git update-index --chmod=+x docker/startup-script.test.sh 9 | git update-index --chmod=+x docker/test-workload.sh 10 | ``` 11 | 12 | To check permissions: 13 | 14 | ```bash 15 | git ls-files -s -- *.sh 16 | ``` 17 | 18 | All files should have permission `100755` 19 | 20 | Otherwise the scripts won;t run in the PROD container -------------------------------------------------------------------------------- /examples/settings.example.json: -------------------------------------------------------------------------------- 1 | { 2 | "IsEncrypted": false, 3 | "Values": { 4 | "AzureWebJobsStorage": "STORAGE_ACCOUNT_CONNECTION_STRING", 5 | "FUNCTIONS_WORKER_RUNTIME": "dotnet", 6 | "ServicePrincipalClientID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 7 | "ServicePrincipalClientSecret": "CLIENT_SECRET", 8 | "ServicePrincipalTenantID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 9 | "SubscriptionID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 10 | "ResourceGroupName": "AZURE_RESOURCE_GROUP", 11 | "ContainerGroupName": "CONTAINER_GROUP_NAME_FOR_ACI", 12 | "AzureDevOpsAccessToken": "AZURE_DEVOPS_PAT", 13 | "GitHubAccessToken": "GITHUB_PAT", 14 | "MaxParallelism": 3, 15 | "UseTestImage": false 16 | } 17 | } -------------------------------------------------------------------------------- /.github/workflows/functions-ci.yml: -------------------------------------------------------------------------------- 1 | name: Functions CI 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | paths: 9 | - DependabotOrchestrator/** 10 | pull_request: 11 | branches: 12 | - main 13 | paths: 14 | - DependabotOrchestrator/** 15 | 16 | jobs: 17 | build: 18 | 19 | runs-on: ubuntu-latest 20 | defaults: 21 | run: 22 | working-directory: DependabotOrchestrator 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | 27 | - name: Setup .NET 28 | uses: actions/setup-dotnet@v1 29 | with: 30 | dotnet-version: 3.1.x 31 | 32 | - name: Restore dependencies 33 | run: dotnet restore 34 | 35 | - name: Build 36 | run: dotnet build --no-restore 37 | 38 | - name: Test 39 | run: dotnet test --no-build --verbosity normal 40 | -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/JobFinishedEventHandler.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.Azure.WebJobs; 4 | using Microsoft.Azure.WebJobs.Extensions.DurableTask; 5 | using Microsoft.Azure.WebJobs.Extensions.Http; 6 | using System.Threading.Tasks; 7 | 8 | namespace DependabotOrchestrator 9 | { 10 | public static class JobFinishedEventHandler 11 | { 12 | [FunctionName("JobFinishedEventHandler")] 13 | public static async Task EventHandler( 14 | [HttpTrigger(AuthorizationLevel.Function, "post", Route = "jobfinished/{instanceid}")] HttpRequest req, 15 | [DurableClient] IDurableOrchestrationClient client, 16 | string instanceid) 17 | { 18 | await client.RaiseEventAsync(instanceid, "Job_Finished"); 19 | return new OkResult(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.github/workflows/build-test-image.yml: -------------------------------------------------------------------------------- 1 | name: Test Docker Image CI 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | paths: 9 | - docker/** 10 | pull_request: 11 | branches: 12 | - main 13 | paths: 14 | - docker/** 15 | 16 | env: 17 | imageName: dependabot-azuredevops-atscale-testimage 18 | registryName: n3wt0n 19 | 20 | jobs: 21 | 22 | buildAndPush: 23 | name: Build and Push image 24 | runs-on: ubuntu-latest 25 | defaults: 26 | run: 27 | working-directory: docker 28 | 29 | steps: 30 | - uses: actions/checkout@v2 31 | - name: Build the Docker image 32 | run: docker build . --file Dockerfile.test -t $registryName/$imageName:${{ github.run_id }} -t $registryName/$imageName:latest 33 | - name: Login to Docker 34 | run: docker login -u $registryName -p ${{ secrets.DOCKER_HUB_PAT }} 35 | - name: Push the Docker image to Docker Hub 36 | run: docker push --all-tags $registryName/$imageName 37 | -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/DependabotOrchestrator.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp3.1 4 | v3 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | PreserveNewest 18 | Never 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/Model/DependabotSource.cs: -------------------------------------------------------------------------------- 1 | using DependabotOrchestrator.Extensions; 2 | using System; 3 | using System.Linq; 4 | 5 | namespace DependabotOrchestrator.Model 6 | { 7 | public class DependabotSource 8 | { 9 | private readonly string[] AzDoHosts = { "dev.azure.com", ".visualstudio.com" }; 10 | 11 | public Uri RepoUri { get; set; } 12 | public PackageManagerType PackageManager { get; set; } 13 | public string DependencyPath { get; set; } 14 | public string Branch { get; set; } 15 | public string PullRequestAssignee { get; set; } 16 | 17 | /*VIEWMODEL PROPERTIES*/ 18 | 19 | public string InstanceID { get; set; } 20 | 21 | public string ProjectPath 22 | => AzDoHosts.Any(s => RepoUri.ToString().Contains(s)) 23 | ? RepoUri.AbsolutePath.TrimStart('/') 24 | : ProjectPath; 25 | 26 | public string RepoName 27 | => ProjectPath.Substring(ProjectPath.LastIndexOf('/') + 1); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31321.278 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DependabotOrchestrator", "DependabotOrchestrator\DependabotOrchestrator.csproj", "{DD23BEE5-8BE9-4352-8886-1E051F6E32F9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {DD23BEE5-8BE9-4352-8886-1E051F6E32F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {DD23BEE5-8BE9-4352-8886-1E051F6E32F9}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {DD23BEE5-8BE9-4352-8886-1E051F6E32F9}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {DD23BEE5-8BE9-4352-8886-1E051F6E32F9}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {10F06CF6-9A29-4617-9CBC-0B137637A92D} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /.github/workflows/build-prod-image.yml: -------------------------------------------------------------------------------- 1 | name: Prod Docker Image CI 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | paths: 9 | - docker/** 10 | pull_request: 11 | branches: 12 | - main 13 | paths: 14 | - docker/** 15 | 16 | env: 17 | imageName: dependabot-azuredevops-atscale 18 | registryName: n3wt0n 19 | 20 | jobs: 21 | 22 | buildAndPush: 23 | name: Build and Push image 24 | runs-on: ubuntu-latest 25 | defaults: 26 | run: 27 | working-directory: docker 28 | 29 | steps: 30 | - uses: actions/checkout@v2 31 | 32 | - name: Checkout Dependabot-script code 33 | run: git clone https://github.com/dependabot/dependabot-script.git 34 | 35 | - name: Build Dependabot-script image 36 | run: | 37 | cd dependabot-script 38 | docker build -t "dependabot-script-local" -f Dockerfile . 39 | 40 | - name: Build the Docker image 41 | run: docker build . --file Dockerfile.prod -t $registryName/$imageName:${{ github.run_id }} -t $registryName/$imageName:latest 42 | 43 | - name: Login to Docker 44 | run: docker login -u $registryName -p ${{ secrets.DOCKER_HUB_PAT }} 45 | 46 | - name: Push the Docker image to Docker Hub 47 | run: docker push --all-tags $registryName/$imageName 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dependabot for Azure DevOps at Scale 2 | [![Functions CI](https://github.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/actions/workflows/functions-ci.yml/badge.svg)](https://github.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/actions/workflows/functions-ci.yml) 3 | [![Test Docker Image CI](https://github.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/actions/workflows/build-test-image.yml/badge.svg)](https://github.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/actions/workflows/build-test-image.yml) 4 | [![Prod Docker Image CI](https://github.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/actions/workflows/build-prod-image.yml/badge.svg)](https://github.com/n3wt0n/Dependabot-for-Azure-DevOps-at-Scale/actions/workflows/build-prod-image.yml) 5 | 6 | This project allows you to run [GitHub Dependabot](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies) to scan Azure DevOps repositories, via Azure Pipelines, thanks to Azure Functions. 7 | 8 | ## Current Status: _Development In Progress_ 9 | 10 | Component | Status| Notes 11 | :----- | :-----| :----- 12 | __Orchestrator Trigger__ | 100% | 13 | __Main Orchestrator__ | 90% | 14 | __ACI Orchestrator__ | 90% | 15 | __ACI - Creation__ | 100% | Currently pulling only from public registry 16 | __ACI - Check Status__ | 0% | 17 | __ACI - Event Handler__ | 80% | Missing: should report differently between success and failure 18 | __ACI - Deletion__ | 100% | 19 | __In-container event handler__ | 50% | 20 | __Container Image - Test image__ | 100% | 21 | __Container Image - Production Image__ | 95% | Huge size 22 | __Deployment Scripts__ | 0% | 23 | 24 | ## How it works 25 | 26 | [Description TBC] 27 | 28 | ![Main Flow](/assets/Main_Flow.jpg) 29 | 30 | [Description TBC] 31 | 32 | ![ACI Orchestrator Flow](/assets/ACI_Orchestration_Flow.jpg) 33 | 34 | > Note: because of the container image size, it currently takes about 3 to 4 minutes for the ACI Container Group to pull it and start 35 | 36 | ### Prerequisites 37 | 38 | - PAT on Azure DevOps 39 | - PAT on GitHub 40 | - Service Principal in Azure to create ACI 41 | - Resource Group in Azure 42 | 43 | ## Container 44 | 45 | To support the flow above, a modified version of the [Dependabot Script container](https://github.com/dependabot/dependabot-script) is used. 46 | 47 | It takes the original, and add the components needed to check the execution of the job and report back to the orchestrator. 48 | 49 | ![Main Flow](/assets/Container_Structure.jpg) 50 | 51 | The container image is hosted in __Docker Hub__ and it's called [dependabot-azuredevops-atscale](https://hub.docker.com/r/n3wt0n/dependabot-azuredevops-atscale) 52 | 53 | If you want to test it out manually: 54 | 55 | ```bash 56 | docker pull n3wt0n/dependabot-azuredevops-atscale 57 | 58 | docker run --rm \ 59 | --env "PROJECT_PATH=organization/project/_git/repo-name" \ 60 | --env "DIRECTORY_PATH=folder/containing/dependencies" \ 61 | --env "BRANCH=branch_to_scan" \ 62 | --env "AZURE_ACCESS_TOKEN=XXX_PAT_XXX" \ 63 | --env "PULL_REQUEST_ASSIGNEE=username" \ 64 | --env "GITHUB_ACCESS_TOKEN=xxx_PAT_xxx" \ 65 | --env "PACKAGE_MANAGER=bundler" \ 66 | n3wt0n/dependabot-azuredevops-atscale 67 | ``` 68 | 69 | ### Environment Variables 70 | 71 | Variable Name | Default | Notes 72 | :------------ | :--------------- | :---- 73 | `DIRECTORY_PATH` | `/` | Directory where the base dependency files are. 74 | `PACKAGE_MANAGER` | `bundler` | Valid values: `bundler`, `cargo`, `composer`, `dep`, `docker`, `elm`, `go_modules`, `gradle`, `hex`, `maven`, `npm_and_yarn`, `nuget`, `pip` (includes pipenv), `submodules`, `terraform` 75 | `PROJECT_PATH` | N/A (__Required__) | Path to repository. Format `//_git/`. 76 | `BRANCH` | N/A (Optional) | Branch to fetch manifest from and open pull requests against. 77 | `PULL_REQUESTS_ASSIGNEE` | N/A (Optional) | User to assign to the created pull request. 78 | `AZURE_ACCESS_TOKEN` | N/A (__Required__) | Personal Access Token (PAT) with access to Azure DevOps, with permissions to read the repo content and create pull requests 79 | `GITHUB_ACCESS_TOKEN` | N/A (Optional) | Personal Access Token (PAT) used just for Authentication purposes `*` 80 | 81 | `*` without this token, you may receive errors of request throttling or blocked requests when checking against dependencies hosted on GitHub. 82 | -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # Azure Functions localsettings file 5 | local.settings.json 6 | 7 | # User-specific files 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | [Ll]og/ 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | # Uncomment if you have tasks that create the project's static files in wwwroot 31 | #wwwroot/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | # NUNIT 38 | *.VisualState.xml 39 | TestResult.xml 40 | 41 | # Build Results of an ATL Project 42 | [Dd]ebugPS/ 43 | [Rr]eleasePS/ 44 | dlldata.c 45 | 46 | # DNX 47 | project.lock.json 48 | project.fragment.lock.json 49 | artifacts/ 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # NCrunch 117 | _NCrunch_* 118 | .*crunch*.local.xml 119 | nCrunchTemp_* 120 | 121 | # MightyMoose 122 | *.mm.* 123 | AutoTest.Net/ 124 | 125 | # Web workbench (sass) 126 | .sass-cache/ 127 | 128 | # Installshield output folder 129 | [Ee]xpress/ 130 | 131 | # DocProject is a documentation generator add-in 132 | DocProject/buildhelp/ 133 | DocProject/Help/*.HxT 134 | DocProject/Help/*.HxC 135 | DocProject/Help/*.hhc 136 | DocProject/Help/*.hhk 137 | DocProject/Help/*.hhp 138 | DocProject/Help/Html2 139 | DocProject/Help/html 140 | 141 | # Click-Once directory 142 | publish/ 143 | 144 | # Publish Web Output 145 | *.[Pp]ublish.xml 146 | *.azurePubxml 147 | # TODO: Comment the next line if you want to checkin your web deploy settings 148 | # but database connection strings (with potential passwords) will be unencrypted 149 | #*.pubxml 150 | *.publishproj 151 | 152 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 153 | # checkin your Azure Web App publish settings, but sensitive information contained 154 | # in these scripts will be unencrypted 155 | PublishScripts/ 156 | 157 | # NuGet Packages 158 | *.nupkg 159 | # The packages folder can be ignored because of Package Restore 160 | **/packages/* 161 | # except build/, which is used as an MSBuild target. 162 | !**/packages/build/ 163 | # Uncomment if necessary however generally it will be regenerated when needed 164 | #!**/packages/repositories.config 165 | # NuGet v3's project.json files produces more ignoreable files 166 | *.nuget.props 167 | *.nuget.targets 168 | 169 | # Microsoft Azure Build Output 170 | csx/ 171 | *.build.csdef 172 | 173 | # Microsoft Azure Emulator 174 | ecf/ 175 | rcf/ 176 | 177 | # Windows Store app package directories and files 178 | AppPackages/ 179 | BundleArtifacts/ 180 | Package.StoreAssociation.xml 181 | _pkginfo.txt 182 | 183 | # Visual Studio cache files 184 | # files ending in .cache can be ignored 185 | *.[Cc]ache 186 | # but keep track of directories ending in .cache 187 | !*.[Cc]ache/ 188 | 189 | # Others 190 | ClientBin/ 191 | ~$* 192 | *~ 193 | *.dbmdl 194 | *.dbproj.schemaview 195 | *.jfm 196 | *.pfx 197 | *.publishsettings 198 | node_modules/ 199 | orleans.codegen.cs 200 | 201 | # Since there are multiple workflows, uncomment next line to ignore bower_components 202 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 203 | #bower_components/ 204 | 205 | # RIA/Silverlight projects 206 | Generated_Code/ 207 | 208 | # Backup & report files from converting an old project file 209 | # to a newer Visual Studio version. Backup files are not needed, 210 | # because we have git ;-) 211 | _UpgradeReport_Files/ 212 | Backup*/ 213 | UpgradeLog*.XML 214 | UpgradeLog*.htm 215 | 216 | # SQL Server files 217 | *.mdf 218 | *.ldf 219 | 220 | # Business Intelligence projects 221 | *.rdl.data 222 | *.bim.layout 223 | *.bim_*.settings 224 | 225 | # Microsoft Fakes 226 | FakesAssemblies/ 227 | 228 | # GhostDoc plugin setting file 229 | *.GhostDoc.xml 230 | 231 | # Node.js Tools for Visual Studio 232 | .ntvs_analysis.dat 233 | 234 | # Visual Studio 6 build log 235 | *.plg 236 | 237 | # Visual Studio 6 workspace options file 238 | *.opt 239 | 240 | # Visual Studio LightSwitch build output 241 | **/*.HTMLClient/GeneratedArtifacts 242 | **/*.DesktopClient/GeneratedArtifacts 243 | **/*.DesktopClient/ModelManifest.xml 244 | **/*.Server/GeneratedArtifacts 245 | **/*.Server/ModelManifest.xml 246 | _Pvt_Extensions 247 | 248 | # Paket dependency manager 249 | .paket/paket.exe 250 | paket-files/ 251 | 252 | # FAKE - F# Make 253 | .fake/ 254 | 255 | # JetBrains Rider 256 | .idea/ 257 | *.sln.iml 258 | 259 | # CodeRush 260 | .cr/ 261 | 262 | # Python Tools for Visual Studio (PTVS) 263 | __pycache__/ 264 | *.pyc -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/DependabotOrchestrator.cs: -------------------------------------------------------------------------------- 1 | using DependabotOrchestrator.Managers; 2 | using DependabotOrchestrator.Model; 3 | using Microsoft.Azure.WebJobs; 4 | using Microsoft.Azure.WebJobs.Extensions.DurableTask; 5 | using Microsoft.Azure.WebJobs.Extensions.Http; 6 | using Microsoft.Extensions.Logging; 7 | using Newtonsoft.Json; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Net.Http; 12 | using System.Threading; 13 | using System.Threading.Tasks; 14 | 15 | namespace DependabotOrchestrator 16 | { 17 | public static class DependabotOrchestrator 18 | { 19 | 20 | [FunctionName("Orchestrator_HttpStart")] 21 | public static async Task HttpStart([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestMessage req, 22 | [DurableClient] IDurableOrchestrationClient starter, ILogger logger) 23 | { 24 | var sources = JsonConvert.DeserializeObject>(await req.Content.ReadAsStringAsync()); 25 | 26 | if (!sources.Any()) 27 | return new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest); 28 | 29 | Settings.Init(logger); 30 | 31 | string instanceId = await starter.StartNewAsync("Orchestrator", sources); 32 | 33 | logger.LogInformation($"Started orchestration with ID = '{instanceId}'."); 34 | 35 | return starter.CreateCheckStatusResponse(req, instanceId); 36 | } 37 | 38 | [FunctionName("Orchestrator")] 39 | public static async Task Orchestrator([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger logger) 40 | { 41 | 42 | var maxParallelism = Settings.MaxParallelism; 43 | 44 | var sources = context.GetInput>(); 45 | 46 | logger.LogInformation($"Starting Parallel ACI Orchestrators - Max Parallelism: {maxParallelism} - Total tasks: {sources.Count()}"); 47 | 48 | var parallelTasks = new HashSet(); 49 | foreach (var source in sources) 50 | { 51 | if (parallelTasks.Count >= maxParallelism) 52 | { 53 | Task finished = await Task.WhenAny(parallelTasks); 54 | parallelTasks.Remove(finished); 55 | } 56 | 57 | //parallelTasks.Add(context.CallActivityAsync(functionName, item)); 58 | parallelTasks.Add(context.CallSubOrchestratorAsync("ACILifecycleOrchestrator", source)); 59 | } 60 | 61 | await Task.WhenAll(parallelTasks); 62 | } 63 | 64 | [FunctionName("ACILifecycleOrchestrator")] 65 | public static async Task> ACILifecycleOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context) 66 | { 67 | var outputs = new List(); 68 | var source = context.GetInput(); 69 | 70 | source.InstanceID = context.InstanceId; 71 | 72 | var containerGroupName = await context.CallActivityAsync("CreateACIGroup", source); 73 | 74 | // This activity function calls into the container. scenarios could be check some status, or do something specifically by calling out api endpoint 75 | if (await context.CallActivityAsync("CheckExecution", containerGroupName)) 76 | { 77 | //Wait for the Job Finished event from the ACI container once its done with its job, or for a timeoute of 1h 78 | using (var timeoutCts = new CancellationTokenSource()) 79 | { 80 | // The job has 60 minutes to complete 81 | DateTime expiration = context.CurrentUtcDateTime.AddMinutes(60); 82 | Task timeoutTask = context.CreateTimer(expiration, timeoutCts.Token); 83 | 84 | Task jobCompletedTask = context.WaitForExternalEvent("Job_Finished"); 85 | 86 | Task winner = await Task.WhenAny(jobCompletedTask, timeoutTask); 87 | if (winner == jobCompletedTask) 88 | { 89 | //It worked! Now? 90 | } 91 | 92 | if (!timeoutTask.IsCompleted) 93 | timeoutCts.Cancel(); // All pending timers must be complete or canceled before the function exits. 94 | } 95 | 96 | //This function deletes the ACI group once its done with its job or the timeout expired 97 | await context.CallActivityAsync("DeleteACIGroup", containerGroupName); 98 | } 99 | 100 | //TODO: set this properly 101 | return outputs; 102 | } 103 | 104 | [FunctionName("CreateACIGroup")] 105 | public static async Task CreateAciGroup([ActivityTrigger] DependabotSource source, ILogger logger) 106 | { 107 | logger.LogInformation($"Start Creating ContainerGroup"); 108 | 109 | return await AzureManager.CreateContainerGroupAsync(source, logger); 110 | } 111 | 112 | [FunctionName("CheckExecution")] 113 | public static bool CheckExecution([ActivityTrigger] string containerGroupName, ILogger log) 114 | => true; //TODO 115 | 116 | [FunctionName("DeleteACIGroup")] 117 | public static async Task Orchestrator_Delete_ACI_Group([ActivityTrigger] string containerGroupName, ILogger logger) 118 | { 119 | logger.LogInformation($"Start Deleting ContainerGroup {containerGroupName}."); 120 | 121 | await AzureManager.DeleteContainerGroupAsync(containerGroupName, logger); 122 | } 123 | 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/Model/Settings.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using System; 3 | 4 | namespace DependabotOrchestrator.Model 5 | { 6 | public class Settings 7 | { 8 | private static ILogger _logger; 9 | 10 | public static string SubscriptionID { get; private set; } 11 | public static string ServicePrincipalClientID { get; private set; } 12 | public static string ServicePrincipalClientSecret { get; private set; } 13 | public static string ServicePrincipalTenantID { get; private set; } 14 | public static string ResourceGroupName { get; private set; } 15 | public static string ContainerGroupName { get; private set; } 16 | private static string ContainerImageTag { get; set; } 17 | public static int MaxParallelism { get; private set; } 18 | public static string AzureDevOpsAccessToken { get; private set; } 19 | public static string GitHubAccessToken { get; private set; } 20 | public static bool UseTestImage { get; private set; } 21 | public static string FunctionsBaseUrl { get; private set; } 22 | 23 | 24 | public static string FullContainerImageName { get; private set; } 25 | 26 | public static void Init(ILogger logger) 27 | { 28 | _logger = logger; 29 | 30 | SubscriptionID = Environment.GetEnvironmentVariable("SubscriptionID"); 31 | if (string.IsNullOrWhiteSpace(SubscriptionID)) 32 | { 33 | _logger.LogError("SubscriptionID environment variable is null"); 34 | throw new ArgumentNullException("SubscriptionID environment variable is null"); 35 | } 36 | 37 | ServicePrincipalClientID = Environment.GetEnvironmentVariable("ServicePrincipalClientID"); 38 | if (string.IsNullOrWhiteSpace(ServicePrincipalClientID)) 39 | { 40 | _logger.LogError("ServicePrincipalClientID environment variable is null"); 41 | throw new ArgumentNullException("ServicePrincipalClientID environment variable is null"); 42 | } 43 | 44 | ServicePrincipalClientSecret = Environment.GetEnvironmentVariable("ServicePrincipalClientSecret"); 45 | if (string.IsNullOrWhiteSpace(ServicePrincipalClientSecret)) 46 | { 47 | _logger.LogError("ServicePrincipalClientSecret environment variable is null"); 48 | throw new ArgumentNullException("ServicePrincipalClientSecret environment variable is null"); 49 | } 50 | 51 | ServicePrincipalTenantID = Environment.GetEnvironmentVariable("ServicePrincipalTenantID"); 52 | if (string.IsNullOrWhiteSpace(ServicePrincipalTenantID)) 53 | { 54 | _logger.LogError("ServicePrincipalTenantID environment variable is null"); 55 | throw new ArgumentNullException("ServicePrincipalTenantID environment variable is null"); 56 | } 57 | 58 | ResourceGroupName = Environment.GetEnvironmentVariable("ResourceGroupName"); 59 | if (string.IsNullOrWhiteSpace(ResourceGroupName)) 60 | { 61 | _logger.LogError("ResourceGroupName environment variable is null"); 62 | throw new ArgumentNullException("ResourceGroupName environment variable is null"); 63 | } 64 | 65 | //ContainerImageTag = Environment.GetEnvironmentVariable("ContainerImageTag"); 66 | //if (string.IsNullOrWhiteSpace(ContainerImageTag)) 67 | //{ 68 | // _logger.LogWarning("ContainerImageTag environment variable is null. Reverting to default"); 69 | ContainerImageTag = Constants.DefaultContainerImageTag; 70 | //} 71 | 72 | if (int.TryParse(Environment.GetEnvironmentVariable("MaxParallelism"), out int paralles) && paralles >= 0) 73 | MaxParallelism = paralles; 74 | else 75 | { 76 | _logger.LogWarning("MaxParallelism environment variable is null or invalid. Reverting to default"); 77 | MaxParallelism = Constants.DefaultMaxParallelism; 78 | } 79 | 80 | ContainerGroupName = Environment.GetEnvironmentVariable("ContainerGroupName"); 81 | if (string.IsNullOrWhiteSpace(ContainerGroupName)) 82 | { 83 | _logger.LogWarning("ContainerGroupName environment variable is null. Reverting to default"); 84 | ContainerGroupName = Constants.DefaultContainerGroupName; 85 | } 86 | ContainerGroupName = ContainerGroupName.ToLower(); 87 | 88 | AzureDevOpsAccessToken = Environment.GetEnvironmentVariable("AzureDevOpsAccessToken"); 89 | if (string.IsNullOrWhiteSpace(AzureDevOpsAccessToken)) 90 | { 91 | _logger.LogError("AzureDevOpsAccessToken environment variable is null"); 92 | throw new ArgumentNullException("AzureDevOpsAccessToken environment variable is null"); 93 | } 94 | 95 | GitHubAccessToken = Environment.GetEnvironmentVariable("GitHubAccessToken"); 96 | if (string.IsNullOrWhiteSpace(ContainerGroupName)) 97 | _logger.LogWarning("GitHubAccessToken environment variable is null. Won' be used, you may incur in API limits"); 98 | 99 | bool.TryParse(Environment.GetEnvironmentVariable("UseTestImage"), out bool useTestImage); 100 | UseTestImage = useTestImage; 101 | 102 | FullContainerImageName = $"{(UseTestImage ? Constants.TestContainerImageName : Constants.ContainerImageName)}:{ContainerImageTag}".ToLower(); 103 | 104 | FunctionsBaseUrl = $"https://{Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME")}/api"; 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /DependabotOrchestrator/DependabotOrchestrator/Managers/AzureManager.cs: -------------------------------------------------------------------------------- 1 | using DependabotOrchestrator.Extensions; 2 | using DependabotOrchestrator.Model; 3 | using Microsoft.Azure.Management.ContainerInstance.Fluent; 4 | using Microsoft.Azure.Management.Fluent; 5 | using Microsoft.Azure.Management.ResourceManager.Fluent; 6 | using Microsoft.Azure.Management.ResourceManager.Fluent.Authentication; 7 | using Microsoft.Azure.Management.ResourceManager.Fluent.Core; 8 | using Microsoft.Extensions.Logging; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Threading.Tasks; 12 | 13 | namespace DependabotOrchestrator.Managers 14 | { 15 | public static class AzureManager 16 | { 17 | private static IAzure GetAzureClient() 18 | { 19 | var creds = new AzureCredentialsFactory().FromServicePrincipal(Settings.ServicePrincipalClientID, Settings.ServicePrincipalClientSecret, Settings.ServicePrincipalTenantID, AzureEnvironment.AzureGlobalCloud); 20 | return Microsoft.Azure.Management.Fluent.Azure.Authenticate(creds).WithSubscription(Settings.SubscriptionID); 21 | } 22 | 23 | /// 24 | /// Creates a container group with a single container. 25 | /// 26 | /// DependabotSource object 27 | /// 28 | /// Container Group Name 29 | public static async Task CreateContainerGroupAsync(DependabotSource source, ILogger logger) 30 | { 31 | var azure = GetAzureClient(); 32 | 33 | //Add a random number to the ContainerGroup name to avoid conflicts 34 | var containerGroupName = $"{Settings.ContainerGroupName}-{source.RepoName}-{source.PackageManager.Name()}{DateTime.Now.Millisecond}".ToLower(); 35 | 36 | logger.LogInformation($"\nCreating container group '{containerGroupName}'..."); 37 | 38 | // Get the resource group's region 39 | IResourceGroup resGroup = await azure.ResourceGroups.GetByNameAsync(Settings.ResourceGroupName); 40 | Region azureRegion = resGroup.Region; 41 | 42 | var environmentVariables = new Dictionary 43 | { 44 | { "DIRECTORY_PATH", source.DependencyPath }, 45 | { "PACKAGE_MANAGER", source.PackageManager.Name() }, 46 | { "PROJECT_PATH", source.ProjectPath }, 47 | { "AZURE_ACCESS_TOKEN", Settings.AzureDevOpsAccessToken }, 48 | { "ORCHESTRATOR_INSTANCE_ID", source.InstanceID }, 49 | { "JOBCOMPLETE_FUNCTION_URL", $"{Settings.FunctionsBaseUrl}/jobfinished" } 50 | }; 51 | 52 | if (!string.IsNullOrWhiteSpace(source.Branch)) 53 | environmentVariables.Add("BRANCH", source.Branch); 54 | 55 | if (!string.IsNullOrWhiteSpace(source.PullRequestAssignee)) 56 | environmentVariables.Add("PULL_REQUEST_ASSIGNEE", source.PullRequestAssignee); 57 | 58 | if (!string.IsNullOrWhiteSpace(Settings.GitHubAccessToken)) 59 | environmentVariables.Add("GITHUB_ACCESS_TOKEN", Settings.GitHubAccessToken); 60 | 61 | // Create the container group 62 | try 63 | { 64 | var containerGroup = await azure.ContainerGroups.Define(containerGroupName) 65 | .WithRegion(azureRegion) 66 | .WithExistingResourceGroup(resGroup.Name) 67 | .WithLinux() 68 | //.WithPrivateImageRegistry(Environment.GetEnvironmentVariable("a"), Environment.GetEnvironmentVariable("b"), Environment.GetEnvironmentVariable("c")) 69 | .WithPublicImageRegistryOnly() 70 | .WithNewAzureFileShareVolume("sharedfs","dependabotsharedabenveg") //used for test and debug purposes 71 | //.WithoutVolume() 72 | .DefineContainerInstance(containerGroupName) 73 | .WithImage(Settings.FullContainerImageName) 74 | .WithExternalTcpPort(80) 75 | .WithCpuCoreCount(1.0) 76 | .WithMemorySizeInGB(1) 77 | .WithEnvironmentVariables(environmentVariables) 78 | .WithVolumeMountSetting("sharedfs","/output") //used for test and debug purposes 79 | .Attach() 80 | .WithDnsPrefix(containerGroupName) 81 | .WithRestartPolicy(Microsoft.Azure.Management.ContainerInstance.Fluent.Models.ContainerGroupRestartPolicy.Never) 82 | .CreateAsync(); 83 | 84 | logger.LogInformation($"\nCreation of container group '{containerGroupName}' completed!"); 85 | logger.LogInformation($"Once DNS has propagated, container group '{containerGroup.Name}' will be reachable at http://{containerGroup.Fqdn}"); 86 | return containerGroup.Name; 87 | } 88 | catch (Exception ex) 89 | { 90 | 91 | throw; 92 | } 93 | } 94 | 95 | /// 96 | /// Deletes the specified container group. 97 | /// 98 | /// The name of the container group to delete. 99 | /// 100 | public static async Task DeleteContainerGroupAsync(string containerGroupName, ILogger logger) 101 | { 102 | var azure = GetAzureClient(); 103 | 104 | IContainerGroup containerGroup = null; 105 | 106 | while (containerGroup == null) 107 | { 108 | containerGroup = await azure.ContainerGroups.GetByResourceGroupAsync(Settings.ResourceGroupName, containerGroupName); 109 | 110 | SdkContext.DelayProvider.Delay(1000); 111 | } 112 | 113 | logger.LogInformation($"Deleting container group '{containerGroupName}'..."); 114 | 115 | await azure.ContainerGroups.DeleteByIdAsync(containerGroup.Id); 116 | 117 | logger.LogInformation($"Container group '{containerGroupName}' deleted"); 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | --------------------------------------------------------------------------------