├── .config
└── tsaoptions.json
├── .editorconfig
├── .gitignore
├── .packages
├── Directory.Build.props
├── Directory.Build.targets
└── Directory.Packages.props
├── CODE-OF-CONDUCT.md
├── Directory.Build.props
├── Directory.Build.targets
├── Directory.Packages.props
├── LICENSE.TXT
├── NuGet.config
├── README.md
├── SECURITY.md
├── artifacts
├── Directory.Build.props
├── Directory.Build.targets
└── Directory.Packages.props
├── azure-pipeline-codeql.yml
├── azure-pipelines-pr.yml
├── azure-pipelines.yml
├── dnceng-shared.sln
├── eng
├── PoliCheckExclusions.xml
├── Publishing.props
├── Version.Details.xml
├── Versions.props
├── common
│ ├── BuildConfiguration
│ │ └── build-configuration.json
│ ├── CIBuild.cmd
│ ├── PSScriptAnalyzerSettings.psd1
│ ├── README.md
│ ├── SetupNugetSources.ps1
│ ├── SetupNugetSources.sh
│ ├── build.ps1
│ ├── build.sh
│ ├── cibuild.sh
│ ├── cross
│ │ ├── arm
│ │ │ ├── sources.list.bionic
│ │ │ ├── sources.list.focal
│ │ │ ├── sources.list.jammy
│ │ │ ├── sources.list.jessie
│ │ │ ├── sources.list.xenial
│ │ │ ├── sources.list.zesty
│ │ │ └── tizen
│ │ │ │ └── tizen.patch
│ │ ├── arm64
│ │ │ ├── sources.list.bionic
│ │ │ ├── sources.list.buster
│ │ │ ├── sources.list.focal
│ │ │ ├── sources.list.jammy
│ │ │ ├── sources.list.stretch
│ │ │ ├── sources.list.xenial
│ │ │ ├── sources.list.zesty
│ │ │ └── tizen
│ │ │ │ └── tizen.patch
│ │ ├── armel
│ │ │ ├── armel.jessie.patch
│ │ │ ├── sources.list.jessie
│ │ │ └── tizen
│ │ │ │ └── tizen.patch
│ │ ├── armv6
│ │ │ └── sources.list.buster
│ │ ├── build-android-rootfs.sh
│ │ ├── build-rootfs.sh
│ │ ├── ppc64le
│ │ │ └── sources.list.bionic
│ │ ├── riscv64
│ │ │ └── sources.list.sid
│ │ ├── s390x
│ │ │ └── sources.list.bionic
│ │ ├── tizen-build-rootfs.sh
│ │ ├── tizen-fetch.sh
│ │ └── toolchain.cmake
│ ├── darc-init.ps1
│ ├── darc-init.sh
│ ├── dotnet-install.cmd
│ ├── dotnet-install.ps1
│ ├── dotnet-install.sh
│ ├── enable-cross-org-publishing.ps1
│ ├── generate-locproject.ps1
│ ├── generate-sbom-prep.ps1
│ ├── generate-sbom-prep.sh
│ ├── helixpublish.proj
│ ├── init-tools-native.cmd
│ ├── init-tools-native.ps1
│ ├── init-tools-native.sh
│ ├── internal-feed-operations.ps1
│ ├── internal-feed-operations.sh
│ ├── internal
│ │ ├── Directory.Build.props
│ │ ├── NuGet.config
│ │ └── Tools.csproj
│ ├── loc
│ │ └── P22DotNetHtmlLocalization.lss
│ ├── msbuild.ps1
│ ├── msbuild.sh
│ ├── native
│ │ ├── CommonLibrary.psm1
│ │ ├── common-library.sh
│ │ ├── init-compiler.sh
│ │ ├── init-distro-rid.sh
│ │ ├── init-os-and-arch.sh
│ │ ├── install-cmake-test.sh
│ │ ├── install-cmake.sh
│ │ └── install-tool.ps1
│ ├── pipeline-logging-functions.ps1
│ ├── pipeline-logging-functions.sh
│ ├── post-build
│ │ ├── add-build-to-channel.ps1
│ │ ├── check-channel-consistency.ps1
│ │ ├── nuget-validation.ps1
│ │ ├── post-build-utils.ps1
│ │ ├── publish-using-darc.ps1
│ │ ├── sourcelink-validation.ps1
│ │ ├── symbols-validation.ps1
│ │ └── trigger-subscriptions.ps1
│ ├── retain-build.ps1
│ ├── sdk-task.ps1
│ ├── sdl
│ │ ├── NuGet.config
│ │ ├── configure-sdl-tool.ps1
│ │ ├── execute-all-sdl-tools.ps1
│ │ ├── extract-artifact-archives.ps1
│ │ ├── extract-artifact-packages.ps1
│ │ ├── init-sdl.ps1
│ │ ├── packages.config
│ │ ├── run-sdl.ps1
│ │ ├── sdl.ps1
│ │ └── trim-assets-version.ps1
│ ├── templates-official
│ │ ├── job
│ │ │ ├── job.yml
│ │ │ ├── onelocbuild.yml
│ │ │ ├── publish-build-assets.yml
│ │ │ ├── source-build.yml
│ │ │ └── source-index-stage1.yml
│ │ ├── jobs
│ │ │ ├── codeql-build.yml
│ │ │ ├── jobs.yml
│ │ │ └── source-build.yml
│ │ ├── post-build
│ │ │ ├── common-variables.yml
│ │ │ ├── post-build.yml
│ │ │ ├── setup-maestro-vars.yml
│ │ │ └── trigger-subscription.yml
│ │ ├── steps
│ │ │ ├── add-build-to-channel.yml
│ │ │ ├── build-reason.yml
│ │ │ ├── component-governance.yml
│ │ │ ├── enable-internal-runtimes.yml
│ │ │ ├── execute-codeql.yml
│ │ │ ├── execute-sdl.yml
│ │ │ ├── generate-sbom.yml
│ │ │ ├── get-delegation-sas.yml
│ │ │ ├── get-federated-access-token.yml
│ │ │ ├── publish-logs.yml
│ │ │ ├── retain-build.yml
│ │ │ ├── send-to-helix.yml
│ │ │ └── source-build.yml
│ │ └── variables
│ │ │ ├── pool-providers.yml
│ │ │ └── sdl-variables.yml
│ ├── templates
│ │ ├── job
│ │ │ ├── execute-sdl.yml
│ │ │ ├── job.yml
│ │ │ ├── onelocbuild.yml
│ │ │ ├── publish-build-assets.yml
│ │ │ ├── source-build.yml
│ │ │ └── source-index-stage1.yml
│ │ ├── jobs
│ │ │ ├── codeql-build.yml
│ │ │ ├── jobs.yml
│ │ │ └── source-build.yml
│ │ ├── post-build
│ │ │ ├── common-variables.yml
│ │ │ ├── post-build.yml
│ │ │ ├── setup-maestro-vars.yml
│ │ │ └── trigger-subscription.yml
│ │ ├── steps
│ │ │ ├── add-build-to-channel.yml
│ │ │ ├── build-reason.yml
│ │ │ ├── component-governance.yml
│ │ │ ├── enable-internal-runtimes.yml
│ │ │ ├── execute-codeql.yml
│ │ │ ├── execute-sdl.yml
│ │ │ ├── generate-sbom.yml
│ │ │ ├── get-delegation-sas.yml
│ │ │ ├── get-federated-access-token.yml
│ │ │ ├── publish-logs.yml
│ │ │ ├── retain-build.yml
│ │ │ ├── run-on-unix.yml
│ │ │ ├── run-on-windows.yml
│ │ │ ├── run-script-ifequalelse.yml
│ │ │ ├── send-to-helix.yml
│ │ │ ├── source-build.yml
│ │ │ ├── telemetry-end.yml
│ │ │ └── telemetry-start.yml
│ │ └── variables
│ │ │ ├── pool-providers.yml
│ │ │ └── sdl-variables.yml
│ ├── tools.ps1
│ └── tools.sh
├── helpers.psm1
├── set-version-parameters.ps1
└── test.yaml
├── global.json
├── src
├── CoreHealthMonitor
│ ├── CoreHealthMonitor.cs
│ ├── CoreHealthMonitor.csproj
│ └── DriveMonitorOptions.cs
├── MIcrosoft.DotNet.Internal.Logging
│ ├── FormattableStringFormatter.cs
│ ├── Microsoft.DotNet.Internal.Logging.csproj
│ ├── Operation.cs
│ ├── OperationManager.cs
│ ├── OperationManagerOptions.cs
│ └── ServiceCollectionExtensions.cs
├── Microsoft.AspNetCore.ApiPagination
│ ├── ApiPaginationApplicationModelConvention.cs
│ ├── ApiPaginationMvcBuilderExtensions.cs
│ ├── Microsoft.AspNetCore.ApiPagination.csproj
│ ├── ObjectExtensions.cs
│ └── PaginatedAttribute.cs
├── Microsoft.AspNetCore.ApiVersioning.Analyzers
│ ├── DoNotUseUnversionedTypesInVersionedApis.cs
│ ├── Helpers.cs
│ ├── KnownTypes.cs
│ ├── Microsoft.AspNetCore.ApiVersioning.Analyzers.csproj
│ └── TypeVersionChecker.cs
├── Microsoft.AspNetCore.ApiVersioning.Swashbuckle
│ ├── ConfigureSwaggerVersions.cs
│ ├── HeaderVersioningOperationFilter.cs
│ ├── ISwaggerVersioningScheme.cs
│ ├── Microsoft.AspNetCore.ApiVersioning.Swashbuckle.csproj
│ ├── QueryVersioningOperationFilter.cs
│ ├── SwaggerApiResponseAttribute.cs
│ ├── SwaggerApiVersioningExtensions.cs
│ ├── SwaggerModelBindingOperationFilter.cs
│ └── VersioningOperationFilter.cs
├── Microsoft.AspNetCore.ApiVersioning
│ ├── ApiRemovedAttribute.cs
│ ├── ApiVersioningExtensions.cs
│ ├── ApiVersioningOptions.cs
│ ├── ApiVersioningOptionsExtensions.cs
│ ├── IVersioningScheme.cs
│ ├── Microsoft.AspNetCore.ApiVersioning.csproj
│ ├── RequiredParameterDescriptorProvider.cs
│ ├── Schemes
│ │ ├── HeaderVersioningScheme.cs
│ │ ├── PathVersioningScheme.cs
│ │ └── QueryVersioningScheme.cs
│ ├── SetRequiredModelMetadata.cs
│ ├── SuppressVersionErrorsAttribute.cs
│ ├── VersionedApiConvention.cs
│ └── VersionedControllerProvider.cs
├── Microsoft.DncEng.CommandLineLib
│ ├── Authentication
│ │ ├── InteractiveTokenCredentialProvider.cs
│ │ └── TokenCredentialProvider.cs
│ ├── Command.cs
│ ├── CommandAttribute.cs
│ ├── CommandOptions.cs
│ ├── ConsoleExtensions.cs
│ ├── DefaultCommandRegistry.cs
│ ├── DefaultConsole.cs
│ ├── DefaultConsoleBackend.cs
│ ├── DependencyInjectedConsoleApp.cs
│ ├── ExitCodes.cs
│ ├── FailWithExitCodeException.cs
│ ├── GlobalCommand.cs
│ ├── ICommandOptions.cs
│ ├── ICommandRegistry.cs
│ ├── IConsole.cs
│ ├── IConsoleBackend.cs
│ ├── ISystemClock.cs
│ ├── Microsoft.DncEng.CommandLineLib.csproj
│ ├── SystemClock.cs
│ └── VerbosityLevel.cs
├── Microsoft.DncEng.Configuration.Extensions
│ ├── AppConfigurationConfigMapper.cs
│ ├── ConfigMapper.cs
│ ├── ConfigurationConstants.cs
│ ├── KeyVaultConfigMapper.cs
│ ├── LocalDevTokenCredential.cs
│ ├── MappedJsonConfigurationProvider.cs
│ ├── MappedJsonConfigurationSource.cs
│ ├── Microsoft.DncEng.Configuration.Extensions.csproj
│ ├── RegexConfigMapper.cs
│ ├── SentinelFileLock.cs
│ └── ServiceConfigurationExtensions.cs
├── Microsoft.DotNet.Authentication.Algorithms
│ ├── Microsoft.DotNet.Authentication.Algorithms.csproj
│ └── OneTimePasswordGenerator.cs
├── Microsoft.DotNet.GitHub.Authentication
│ ├── GitHubAppTokenProvider.cs
│ ├── GitHubApplicationClientFactory.cs
│ ├── GitHubClientFactory.cs
│ ├── GitHubClientOptions.cs
│ ├── GitHubHelper.cs
│ ├── GitHubTokenProvider.cs
│ ├── GitHubTokenProviderOptions.cs
│ ├── IGitHubAppTokenProvider.cs
│ ├── IGitHubApplicationClientFactory.cs
│ ├── IGitHubClientFactory.cs
│ ├── IGitHubTokenProvider.cs
│ ├── InMemoryCacheInstallationLookup.cs
│ ├── InstallationLookup.cs
│ ├── Microsoft.DotNet.GitHub.Authentication.csproj
│ └── ServiceCollectionExtensions.cs
├── Microsoft.DotNet.Internal.AkaMsLinks
│ ├── AkaMsLinksManager.cs
│ ├── Microsoft.DotNet.Internal.AkaMsLinks.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
├── Microsoft.DotNet.Internal.DependencyInjection.Testing
│ ├── DependencyInjectionValidation.cs
│ └── Microsoft.DotNet.Internal.DependencyInjection.Testing.csproj
├── Microsoft.DotNet.Internal.DependencyInjection
│ ├── ClientFactory.cs
│ ├── ClientFactoryExtensions.cs
│ ├── IClientFactory.cs
│ ├── Microsoft.DotNet.Internal.DependencyInjection.csproj
│ ├── RefCountedObject.cs
│ ├── ResolvingLazy.cs
│ ├── ServiceCollectionExtensions.cs
│ └── SingleClientFactory.cs
├── Microsoft.DotNet.Internal.Health
│ ├── AzureTableHealthReportProvider.cs
│ ├── AzureTableHealthReportingOptions.cs
│ ├── HealthReport.cs
│ ├── HealthReportExtensions.cs
│ ├── HealthReportTableEntity.cs
│ ├── HealthReporterFactory.cs
│ ├── HealthReportingBuilder.cs
│ ├── HealthStatus.cs
│ ├── IExternalHealthReporter.cs
│ ├── IHealthReportProvider.cs
│ ├── IHealthReporter.cs
│ ├── IHealthReporterFactory.cs
│ ├── IInstanceAccessor.cs
│ ├── IInstanceHealthReporter.cs
│ ├── IServiceHealthReporter.cs
│ ├── InstanceAccessor.cs
│ ├── LogHealthReporter.cs
│ ├── MachineNameInstanceAccessor.cs
│ ├── Microsoft.DotNet.Internal.Health.csproj
│ ├── ServiceFabricHealthReportProvider.cs
│ └── ServiceFabricInstanceAccessor.cs
├── Microsoft.DotNet.Internal.SymbolHelper
│ ├── Microsoft.DotNet.Internal.SymbolHelper.csproj
│ ├── ScopedTracer.cs
│ ├── SymbolPromotionHelper.cs
│ ├── SymbolPublisherOptions.cs
│ ├── SymbolRequestHelpers.cs
│ ├── SymbolUploadHelper.cs
│ └── SymbolUploadHelperFactory.cs
├── Microsoft.DotNet.Internal.Testing.DependencyInjection.Abstractions
│ ├── ConfigureAllParametersAttribute.cs
│ ├── Microsoft.DotNet.Internal.Testing.DependencyInjection.Abstractions.csproj
│ ├── TestDependencyInjectionSetupAttribute.cs
│ └── readme.md
├── Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen
│ ├── ConfigMethod.cs
│ ├── ConfigParameters.cs
│ ├── Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen.csproj
│ ├── SymbolNameHelper.cs
│ ├── TestConfigDeclaration.cs
│ ├── TestDataClassWriter.cs
│ ├── TestDataGenerator.cs
│ └── TestDataReceiver.cs
├── Microsoft.DotNet.Internal.Testing.Utility
│ ├── CountingLogger.cs
│ ├── Microsoft.DotNet.Internal.Testing.Utility.csproj
│ ├── MockHttpClientFactory.cs
│ ├── NUnitLogger.cs
│ ├── StringRegexAssertionExtensions.cs
│ ├── TestAppFactory.cs
│ └── TestClock.cs
├── Microsoft.DotNet.Kusto
│ ├── CsvWriterExtensions.cs
│ ├── IKustoClientProvider.cs
│ ├── KustoClientProvider.cs
│ ├── KustoDataType.cs
│ ├── KustoHelpers.cs
│ ├── KustoOptions.cs
│ ├── KustoParameter.cs
│ ├── KustoQuery.cs
│ ├── KustoServiceCollectionExtensions.cs
│ ├── KustoValue.cs
│ └── Microsoft.DotNet.Kusto.csproj
├── Microsoft.DotNet.Metrics
│ ├── ApplicationInsightsMetricTracker.cs
│ ├── IMetricTracker.cs
│ └── Microsoft.DotNet.Metrics.csproj
├── Microsoft.DotNet.ServiceFabric.ServiceHost
│ ├── Actors
│ │ ├── DelegatedActor.cs
│ │ └── IActorImplementation.cs
│ ├── AppInsightsFlushLifecycle.cs
│ ├── DelegatedService.cs
│ ├── DelegatedStatefulService.cs
│ ├── DelegatedStatelessService.cs
│ ├── DelegatedStatelessWebService.cs
│ ├── Extensions.cs
│ ├── IServiceImplementation.cs
│ ├── Lifecycle.cs
│ ├── LoadReporting
│ │ ├── EmptyServiceLoadReporter.cs
│ │ ├── IServiceLoadReporter.cs
│ │ ├── StatefulServiceLoadReporter.cs
│ │ └── StatelessServiceLoadReporter.cs
│ ├── LoggedServiceRemoting
│ │ ├── ActivityServiceRemotingClient.cs
│ │ ├── ActivityServiceRemotingClientFactory.cs
│ │ ├── ActivityServiceRemotingMessageDispatcher.cs
│ │ ├── AsyncInterceptor.cs
│ │ ├── InvokeInNewScopeInterceptor.cs
│ │ ├── LoggingServiceInterceptor.cs
│ │ ├── LoggingServiceProxyInterceptor.cs
│ │ ├── ServiceHostActorProxy.cs
│ │ ├── ServiceHostProxy.cs
│ │ └── ServiceHostRemoting.cs
│ ├── Microsoft.DotNet.ServiceFabric.ServiceHost.csproj
│ ├── Microsoft.DotNet.ServiceFabric.ServiceHost.csproj.DotSettings
│ ├── RichExceptionTelemetryInitializer.cs
│ ├── ScheduledService
│ │ ├── CronScheduleAttribute.cs
│ │ ├── FuncInvokingJob.cs
│ │ ├── ScheduledService.cs
│ │ └── TimeZones.cs
│ ├── ServiceFabricHelpers.cs
│ ├── ServiceFabricLookup.cs
│ ├── ServiceFabricServiceCollectionExtensions.cs
│ ├── ServiceHost.AI.cs
│ ├── ServiceHost.cs
│ ├── ServiceHostEventListener.cs
│ ├── ServiceHostWebSite.cs
│ └── TemporaryFiles.cs
├── Microsoft.DotNet.Services.Utility
│ ├── AzureDevOpsDelegatingHandler.cs
│ ├── AzureStorageTableEntities.cs
│ ├── DefaultHttpHandlerConfiguration.cs
│ ├── DefaultHttpHandlerConfigurationExtensions.cs
│ ├── ExponentialRetry.cs
│ ├── GitHelpers.cs
│ ├── Microsoft.DotNet.Services.Utility.csproj
│ ├── RetryAfterHandler.cs
│ ├── RetryAllHandler.cs
│ └── obj
│ │ ├── Microsoft.DotNet.Services.Utility.csproj.nuget.dgspec.json
│ │ ├── Microsoft.DotNet.Services.Utility.csproj.nuget.g.props
│ │ ├── Microsoft.DotNet.Services.Utility.csproj.nuget.g.targets
│ │ ├── project.assets.json
│ │ └── project.nuget.cache
├── Microsoft.DotNet.Web.Authentication
│ ├── AccessToken
│ │ ├── GetTokenHashContext.cs
│ │ ├── PersonalAccessTokenAuthenticationExtensions.cs
│ │ ├── PersonalAccessTokenAuthenticationHandler.cs
│ │ ├── PersonalAccessTokenAuthenticationOptions.cs
│ │ ├── PersonalAccessTokenDefaults.cs
│ │ ├── PersonalAccessTokenEvents.cs
│ │ ├── PersonalAccessTokenValidatePrincipalContext.cs
│ │ └── SetTokenHashContext.cs
│ ├── DefaultAuthorizeActionModelConvention.cs
│ ├── GitHub
│ │ ├── GitHubAuthenticationExtensions.cs
│ │ ├── GitHubAuthenticationHandler.cs
│ │ ├── GitHubAuthenticationOptions.cs
│ │ └── GitHubClaimResolver.cs
│ ├── Microsoft.DotNet.Web.Authentication.csproj
│ └── SimpleSigninMiddleware.cs
└── ServiceFabricMocks
│ ├── MockActorStateManager.cs
│ ├── MockReliableDictionary.cs
│ ├── MockReliableQueue.cs
│ ├── MockReliableStateManager.cs
│ ├── MockTransaction.cs
│ ├── ServiceFabricMocks.csproj
│ └── SyncAsyncEnumerable.cs
└── test
├── CoreHealthMonitor.Tests
├── CoreHealthMonitor.Tests.csproj
└── DependencyRegistrationTests.cs
├── Microsoft.DotNet.Authentication.Algorithms.Tests
├── Microsoft.DotNet.Authentication.Algorithms.Tests.csproj
└── OneTimePasswordGeneratorTests.cs
├── Microsoft.DotNet.GitHub.Authentication.Tests
├── GitHubAppTokenProviderTests.cs
└── Microsoft.DotNet.GitHub.Authentication.Tests.csproj
├── Microsoft.DotNet.Internal.AkaMsLinks.Test
├── AkaMsLinksTests.cs
└── Microsoft.DotNet.Internal.AkaMsLinks.Tests.csproj
├── Microsoft.DotNet.Internal.DependencyInjection.Testing.Tests
├── Dependencies.cs
├── DependencyInjectionTestValidation.cs
└── Microsoft.DotNet.Internal.DependencyInjection.Testing.Tests.csproj
├── Microsoft.DotNet.Internal.DependencyInjection.Tests
├── ClientFactoryTests.cs
├── LazyTests.cs
└── Microsoft.DotNet.Internal.DependencyInjection.Tests.csproj
├── Microsoft.DotNet.Internal.Health.Tests
├── AzureTableHealthReportProviderTests.cs
├── HealthReporterFactoryTests.cs
├── Microsoft.DotNet.Internal.Health.Tests.csproj
└── MockHandler.cs
├── Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen.Tests
├── ArrayTests.cs
├── AsyncConfigurationTest.cs
├── DisposeCalledTest.cs
├── Injectable.cs
├── Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen.Tests.csproj
├── MultipleRegistrations.cs
├── NoConfigTest.cs
├── NoParameterValueTest.cs
├── ParameterTests.cs
├── Ref.cs
├── SyncConfigTests.cs
├── TupleTest.cs
└── WithParameterValueTest.cs
├── Microsoft.DotNet.Kusto.Tests
├── CsvWriterTests.cs
├── KustoClientProviderTests.cs
├── KustoHelpersTests.cs
├── Microsoft.DotNet.Kusto.Tests.csproj
└── MockOptionMonitor.cs
├── Microsoft.DotNet.ServiceFabric.ServiceHost.Tests
├── AsyncInterceptorTests.cs
├── DelegatedServiceTest.cs
├── DelegatedStatelessWebServiceStartupTests.cs
├── ExtensionsTests.cs
├── FakeChannel.cs
├── IFakeService.cs
├── InvokeInNewScopeInterceptorTests.cs
├── LoggingServiceInterceptorTests.cs
├── LoggingServiceProxyInterceptorTests.cs
├── Microsoft.DotNet.ServiceFabric.ServiceHost.Tests.csproj
├── MockBuilder.cs
├── ServiceHostTests.cs
└── TemporaryFilesTest.cs
└── Microsoft.DotNet.Web.Authentication.Tests
├── Controllers
├── AnonymousAttributeController.cs
├── AnyAttributeController.cs
├── NoAttributeController.cs
└── RoleAttributeController.cs
├── DefaultAuthorizeActionModelConventionTests.cs
├── DefaultHttpContextExtensions.cs
├── EmptyTestStartup.cs
├── GitHubClaimsResolverTests.cs
├── Microsoft.DotNet.Web.Authentication.Tests.csproj
├── PersonalAccessTokenAuthenticationTests.cs
└── SimpleSigninTests.cs
/.config/tsaoptions.json:
--------------------------------------------------------------------------------
1 | {
2 | "instanceUrl": "https://devdiv.visualstudio.com/",
3 | "template": "TFSDEVDIV",
4 | "projectName": "DEVDIV",
5 | "areaPath": "DevDiv\\NET Fundamentals\\Infrastructure\\Arcade\\SDL",
6 | "iterationPath": "DevDiv",
7 | "notificationAliases": [ "dnceng@microsoft.com" ],
8 | "repositoryName":"dotnet-dnceng-shared",
9 | "codebaseName": "dotnet-dnceng-shared"
10 | }
--------------------------------------------------------------------------------
/.packages/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.packages/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.packages/Directory.Packages.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/CODE-OF-CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | This project has adopted the code of conduct defined by the Contributor Covenant
4 | to clarify expected behavior in our community.
5 |
6 | For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
--------------------------------------------------------------------------------
/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/LICENSE.TXT:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) .NET Foundation
4 |
5 | All rights reserved.
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all
15 | copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE.
24 |
--------------------------------------------------------------------------------
/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This repository has shared libraries and services used by the .NET engineering services team.
--------------------------------------------------------------------------------
/artifacts/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/artifacts/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/artifacts/Directory.Packages.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/eng/PoliCheckExclusions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SWAGGER
5 |
--------------------------------------------------------------------------------
/eng/Publishing.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3
5 |
6 |
--------------------------------------------------------------------------------
/eng/Version.Details.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | https://github.com/dotnet/arcade
8 | 4246a31e5de9de87f760218c4f588cebf4661f45
9 |
10 |
11 | https://github.com/dotnet/arcade
12 | 4246a31e5de9de87f760218c4f588cebf4661f45
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/eng/Versions.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 0.0.99
6 | beta
7 |
8 | false
9 | true
10 | 1.0.0-preview.1
11 |
12 | 8.0.0-beta.25230.1
13 | 17.4.1
14 |
15 |
16 |
17 | Microsoft.DotNet.Build.Tasks.Feed
18 |
19 |
20 |
--------------------------------------------------------------------------------
/eng/common/BuildConfiguration/build-configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "RetryCountLimit": 1,
3 | "RetryByAnyError": false
4 | }
5 |
--------------------------------------------------------------------------------
/eng/common/CIBuild.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*"
--------------------------------------------------------------------------------
/eng/common/PSScriptAnalyzerSettings.psd1:
--------------------------------------------------------------------------------
1 | @{
2 | IncludeRules=@('PSAvoidUsingCmdletAliases',
3 | 'PSAvoidUsingWMICmdlet',
4 | 'PSAvoidUsingPositionalParameters',
5 | 'PSAvoidUsingInvokeExpression',
6 | 'PSUseDeclaredVarsMoreThanAssignments',
7 | 'PSUseCmdletCorrectly',
8 | 'PSStandardDSCFunctionsInResource',
9 | 'PSUseIdenticalMandatoryParametersForDSC',
10 | 'PSUseIdenticalParametersForDSC')
11 | }
--------------------------------------------------------------------------------
/eng/common/README.md:
--------------------------------------------------------------------------------
1 | # Don't touch this folder
2 |
3 | uuuuuuuuuuuuuuuuuuuu
4 | u" uuuuuuuuuuuuuuuuuu "u
5 | u" u$$$$$$$$$$$$$$$$$$$$u "u
6 | u" u$$$$$$$$$$$$$$$$$$$$$$$$u "u
7 | u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u
8 | u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u
9 | u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u
10 | $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $
11 | $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $
12 | $ $$$" ... "$... ...$" ... "$$$ ... "$$$ $
13 | $ $$$u `"$$$$$$$ $$$ $$$$$ $$ $$$ $$$ $
14 | $ $$$$$$uu "$$$$ $$$ $$$$$ $$ """ u$$$ $
15 | $ $$$""$$$ $$$$ $$$u "$$$" u$$ $$$$$$$$ $
16 | $ $$$$....,$$$$$..$$$$$....,$$$$..$$$$$$$$ $
17 | $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $
18 | "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u"
19 | "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u"
20 | "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u"
21 | "u "$$$$$$$$$$$$$$$$$$$$$$$$" u"
22 | "u "$$$$$$$$$$$$$$$$$$$$" u"
23 | "u """""""""""""""""" u"
24 | """"""""""""""""""""
25 |
26 | !!! Changes made in this directory are subject to being overwritten by automation !!!
27 |
28 | The files in this directory are shared by all Arcade repos and managed by automation. If you need to make changes to these files, open an issue or submit a pull request to https://github.com/dotnet/arcade first.
29 |
--------------------------------------------------------------------------------
/eng/common/cibuild.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | source="${BASH_SOURCE[0]}"
4 |
5 | # resolve $SOURCE until the file is no longer a symlink
6 | while [[ -h $source ]]; do
7 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
8 | source="$(readlink "$source")"
9 |
10 | # if $source was a relative symlink, we need to resolve it relative to the path where
11 | # the symlink file was located
12 | [[ $source != /* ]] && source="$scriptroot/$source"
13 | done
14 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
15 |
16 | . "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@
--------------------------------------------------------------------------------
/eng/common/cross/arm/sources.list.bionic:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm/sources.list.focal:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm/sources.list.jammy:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm/sources.list.jessie:
--------------------------------------------------------------------------------
1 | # Debian (sid) # UNSTABLE
2 | deb http://ftp.debian.org/debian/ sid main contrib non-free
3 | deb-src http://ftp.debian.org/debian/ sid main contrib non-free
4 |
--------------------------------------------------------------------------------
/eng/common/cross/arm/sources.list.xenial:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm/sources.list.zesty:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm/tizen/tizen.patch:
--------------------------------------------------------------------------------
1 | diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so
2 | --- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900
3 | +++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900
4 | @@ -2,4 +2,4 @@
5 | Use the shared library, but some functions are only in
6 | the static library, so try that secondarily. */
7 | OUTPUT_FORMAT(elf32-littlearm)
8 | -GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-armhf.so.3 ) )
9 | +GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-armhf.so.3 ) )
10 |
--------------------------------------------------------------------------------
/eng/common/cross/arm64/sources.list.bionic:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm64/sources.list.buster:
--------------------------------------------------------------------------------
1 | deb http://deb.debian.org/debian buster main
2 | deb-src http://deb.debian.org/debian buster main
3 |
4 | deb http://deb.debian.org/debian-security/ buster/updates main
5 | deb-src http://deb.debian.org/debian-security/ buster/updates main
6 |
7 | deb http://deb.debian.org/debian buster-updates main
8 | deb-src http://deb.debian.org/debian buster-updates main
9 |
10 | deb http://deb.debian.org/debian buster-backports main contrib non-free
11 | deb-src http://deb.debian.org/debian buster-backports main contrib non-free
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm64/sources.list.focal:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm64/sources.list.jammy:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm64/sources.list.stretch:
--------------------------------------------------------------------------------
1 | deb http://deb.debian.org/debian stretch main
2 | deb-src http://deb.debian.org/debian stretch main
3 |
4 | deb http://deb.debian.org/debian-security/ stretch/updates main
5 | deb-src http://deb.debian.org/debian-security/ stretch/updates main
6 |
7 | deb http://deb.debian.org/debian stretch-updates main
8 | deb-src http://deb.debian.org/debian stretch-updates main
9 |
10 | deb http://deb.debian.org/debian stretch-backports main contrib non-free
11 | deb-src http://deb.debian.org/debian stretch-backports main contrib non-free
12 |
13 |
--------------------------------------------------------------------------------
/eng/common/cross/arm64/sources.list.xenial:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm64/sources.list.zesty:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/arm64/tizen/tizen.patch:
--------------------------------------------------------------------------------
1 | diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so
2 | --- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900
3 | +++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900
4 | @@ -2,4 +2,4 @@
5 | Use the shared library, but some functions are only in
6 | the static library, so try that secondarily. */
7 | OUTPUT_FORMAT(elf64-littleaarch64)
8 | -GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-aarch64.so.1 ) )
9 | +GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-aarch64.so.1 ) )
10 |
--------------------------------------------------------------------------------
/eng/common/cross/armel/armel.jessie.patch:
--------------------------------------------------------------------------------
1 | diff -u -r a/usr/include/urcu/uatomic/generic.h b/usr/include/urcu/uatomic/generic.h
2 | --- a/usr/include/urcu/uatomic/generic.h 2014-10-22 15:00:58.000000000 -0700
3 | +++ b/usr/include/urcu/uatomic/generic.h 2020-10-30 21:38:28.550000000 -0700
4 | @@ -69,10 +69,10 @@
5 | #endif
6 | #ifdef UATOMIC_HAS_ATOMIC_SHORT
7 | case 2:
8 | - return __sync_val_compare_and_swap_2(addr, old, _new);
9 | + return __sync_val_compare_and_swap_2((uint16_t*) addr, old, _new);
10 | #endif
11 | case 4:
12 | - return __sync_val_compare_and_swap_4(addr, old, _new);
13 | + return __sync_val_compare_and_swap_4((uint32_t*) addr, old, _new);
14 | #if (CAA_BITS_PER_LONG == 64)
15 | case 8:
16 | return __sync_val_compare_and_swap_8(addr, old, _new);
17 | @@ -109,7 +109,7 @@
18 | return;
19 | #endif
20 | case 4:
21 | - __sync_and_and_fetch_4(addr, val);
22 | + __sync_and_and_fetch_4((uint32_t*) addr, val);
23 | return;
24 | #if (CAA_BITS_PER_LONG == 64)
25 | case 8:
26 | @@ -148,7 +148,7 @@
27 | return;
28 | #endif
29 | case 4:
30 | - __sync_or_and_fetch_4(addr, val);
31 | + __sync_or_and_fetch_4((uint32_t*) addr, val);
32 | return;
33 | #if (CAA_BITS_PER_LONG == 64)
34 | case 8:
35 | @@ -187,7 +187,7 @@
36 | return __sync_add_and_fetch_2(addr, val);
37 | #endif
38 | case 4:
39 | - return __sync_add_and_fetch_4(addr, val);
40 | + return __sync_add_and_fetch_4((uint32_t*) addr, val);
41 | #if (CAA_BITS_PER_LONG == 64)
42 | case 8:
43 | return __sync_add_and_fetch_8(addr, val);
44 |
--------------------------------------------------------------------------------
/eng/common/cross/armel/sources.list.jessie:
--------------------------------------------------------------------------------
1 | # Debian (jessie) # Stable
2 | deb http://ftp.debian.org/debian/ jessie main contrib non-free
3 | deb-src http://ftp.debian.org/debian/ jessie main contrib non-free
4 |
--------------------------------------------------------------------------------
/eng/common/cross/armel/tizen/tizen.patch:
--------------------------------------------------------------------------------
1 | diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so
2 | --- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900
3 | +++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900
4 | @@ -2,4 +2,4 @@
5 | Use the shared library, but some functions are only in
6 | the static library, so try that secondarily. */
7 | OUTPUT_FORMAT(elf32-littlearm)
8 | -GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) )
9 | +GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.3 ) )
10 |
--------------------------------------------------------------------------------
/eng/common/cross/armv6/sources.list.buster:
--------------------------------------------------------------------------------
1 | deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
2 | deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
3 |
--------------------------------------------------------------------------------
/eng/common/cross/ppc64le/sources.list.bionic:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/riscv64/sources.list.sid:
--------------------------------------------------------------------------------
1 | deb http://deb.debian.org/debian-ports sid main
2 |
--------------------------------------------------------------------------------
/eng/common/cross/s390x/sources.list.bionic:
--------------------------------------------------------------------------------
1 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
2 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
3 |
4 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
5 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
6 |
7 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
8 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
9 |
10 | deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
11 | deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
12 |
--------------------------------------------------------------------------------
/eng/common/cross/tizen-build-rootfs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ARCH=$1
5 | LINK_ARCH=$ARCH
6 |
7 | case "$ARCH" in
8 | arm)
9 | TIZEN_ARCH="armv7hl"
10 | ;;
11 | armel)
12 | TIZEN_ARCH="armv7l"
13 | LINK_ARCH="arm"
14 | ;;
15 | arm64)
16 | TIZEN_ARCH="aarch64"
17 | ;;
18 | x86)
19 | TIZEN_ARCH="i686"
20 | ;;
21 | x64)
22 | TIZEN_ARCH="x86_64"
23 | LINK_ARCH="x86"
24 | ;;
25 | *)
26 | echo "Unsupported architecture for tizen: $ARCH"
27 | exit 1
28 | esac
29 |
30 | __CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
31 | __TIZEN_CROSSDIR="$__CrossDir/${ARCH}/tizen"
32 |
33 | if [[ -z "$ROOTFS_DIR" ]]; then
34 | echo "ROOTFS_DIR is not defined."
35 | exit 1;
36 | fi
37 |
38 | TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp
39 | mkdir -p $TIZEN_TMP_DIR
40 |
41 | # Download files
42 | echo ">>Start downloading files"
43 | VERBOSE=1 $__CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR $TIZEN_ARCH
44 | echo "<>Start constructing Tizen rootfs"
47 | TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm`
48 | cd $ROOTFS_DIR
49 | for f in $TIZEN_RPM_FILES; do
50 | rpm2cpio $f | cpio -idm --quiet
51 | done
52 | echo "<>Start configuring Tizen rootfs"
59 | ln -sfn asm-${LINK_ARCH} ./usr/include/asm
60 | patch -p1 < $__TIZEN_CROSSDIR/tizen.patch
61 | echo "<\\|?@*"() ]', '_'
11 | $SbomGenerationDir = Join-Path $ManifestDirPath $SafeArtifactName
12 |
13 | Write-Host "Artifact name before : $ArtifactName"
14 | Write-Host "Artifact name after : $SafeArtifactName"
15 |
16 | Write-Host "Creating dir $ManifestDirPath"
17 |
18 | # create directory for sbom manifest to be placed
19 | if (!(Test-Path -path $SbomGenerationDir))
20 | {
21 | New-Item -ItemType Directory -path $SbomGenerationDir
22 | Write-Host "Successfully created directory $SbomGenerationDir"
23 | }
24 | else{
25 | Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder."
26 | }
27 |
28 | Write-Host "Updating artifact name"
29 | Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$SafeArtifactName"
30 |
--------------------------------------------------------------------------------
/eng/common/helixpublish.proj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | msbuild
5 |
6 |
7 |
8 |
9 | %(Identity)
10 |
11 |
12 |
13 |
14 |
15 | $(WorkItemDirectory)
16 | $(WorkItemCommand)
17 | $(WorkItemTimeout)
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/eng/common/init-tools-native.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*"
3 | exit /b %ErrorLevel%
--------------------------------------------------------------------------------
/eng/common/internal/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/eng/common/internal/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/eng/common/msbuild.ps1:
--------------------------------------------------------------------------------
1 | [CmdletBinding(PositionalBinding=$false)]
2 | Param(
3 | [string] $verbosity = 'minimal',
4 | [bool] $warnAsError = $true,
5 | [bool] $nodeReuse = $true,
6 | [switch] $ci,
7 | [switch] $prepareMachine,
8 | [switch] $excludePrereleaseVS,
9 | [string] $msbuildEngine = $null,
10 | [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs
11 | )
12 |
13 | . $PSScriptRoot\tools.ps1
14 |
15 | try {
16 | if ($ci) {
17 | $nodeReuse = $false
18 | }
19 |
20 | MSBuild @extraArgs
21 | }
22 | catch {
23 | Write-Host $_.ScriptStackTrace
24 | Write-PipelineTelemetryError -Category 'Build' -Message $_
25 | ExitWithExitCode 1
26 | }
27 |
28 | ExitWithExitCode 0
--------------------------------------------------------------------------------
/eng/common/msbuild.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | source="${BASH_SOURCE[0]}"
4 |
5 | # resolve $source until the file is no longer a symlink
6 | while [[ -h "$source" ]]; do
7 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
8 | source="$(readlink "$source")"
9 | # if $source was a relative symlink, we need to resolve it relative to the path where the
10 | # symlink file was located
11 | [[ $source != /* ]] && source="$scriptroot/$source"
12 | done
13 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
14 |
15 | verbosity='minimal'
16 | warn_as_error=true
17 | node_reuse=true
18 | prepare_machine=false
19 | extra_args=''
20 |
21 | while (($# > 0)); do
22 | lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")"
23 | case $lowerI in
24 | --verbosity)
25 | verbosity=$2
26 | shift 2
27 | ;;
28 | --warnaserror)
29 | warn_as_error=$2
30 | shift 2
31 | ;;
32 | --nodereuse)
33 | node_reuse=$2
34 | shift 2
35 | ;;
36 | --ci)
37 | ci=true
38 | shift 1
39 | ;;
40 | --preparemachine)
41 | prepare_machine=true
42 | shift 1
43 | ;;
44 | *)
45 | extra_args="$extra_args $1"
46 | shift 1
47 | ;;
48 | esac
49 | done
50 |
51 | . "$scriptroot/tools.sh"
52 |
53 | if [[ "$ci" == true ]]; then
54 | node_reuse=false
55 | fi
56 |
57 | MSBuild $extra_args
58 | ExitWithExitCode 0
59 |
--------------------------------------------------------------------------------
/eng/common/post-build/nuget-validation.ps1:
--------------------------------------------------------------------------------
1 | # This script validates NuGet package metadata information using this
2 | # tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage
3 |
4 | param(
5 | [Parameter(Mandatory=$true)][string] $PackagesPath, # Path to where the packages to be validated are
6 | [Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to
7 | )
8 |
9 | try {
10 | . $PSScriptRoot\post-build-utils.ps1
11 |
12 | $url = 'https://raw.githubusercontent.com/NuGet/NuGetGallery/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1'
13 |
14 | New-Item -ItemType 'directory' -Path ${ToolDestinationPath} -Force
15 |
16 | Invoke-WebRequest $url -OutFile ${ToolDestinationPath}\verify.ps1
17 |
18 | & ${ToolDestinationPath}\verify.ps1 ${PackagesPath}\*.nupkg
19 | }
20 | catch {
21 | Write-Host $_.ScriptStackTrace
22 | Write-PipelineTelemetryError -Category 'NuGetValidation' -Message $_
23 | ExitWithExitCode 1
24 | }
25 |
--------------------------------------------------------------------------------
/eng/common/retain-build.ps1:
--------------------------------------------------------------------------------
1 |
2 | Param(
3 | [Parameter(Mandatory=$true)][int] $buildId,
4 | [Parameter(Mandatory=$true)][string] $azdoOrgUri,
5 | [Parameter(Mandatory=$true)][string] $azdoProject,
6 | [Parameter(Mandatory=$true)][string] $token
7 | )
8 |
9 | $ErrorActionPreference = 'Stop'
10 | Set-StrictMode -Version 2.0
11 |
12 | function Get-AzDOHeaders(
13 | [string] $token)
14 | {
15 | $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":${token}"))
16 | $headers = @{"Authorization"="Basic $base64AuthInfo"}
17 | return $headers
18 | }
19 |
20 | function Update-BuildRetention(
21 | [string] $azdoOrgUri,
22 | [string] $azdoProject,
23 | [int] $buildId,
24 | [string] $token)
25 | {
26 | $headers = Get-AzDOHeaders -token $token
27 | $requestBody = "{
28 | `"keepForever`": `"true`"
29 | }"
30 |
31 | $requestUri = "${azdoOrgUri}/${azdoProject}/_apis/build/builds/${buildId}?api-version=6.0"
32 | write-Host "Attempting to retain build using the following URI: ${requestUri} ..."
33 |
34 | try {
35 | Invoke-RestMethod -Uri $requestUri -Method Patch -Body $requestBody -Header $headers -contentType "application/json"
36 | Write-Host "Updated retention settings for build ${buildId}."
37 | }
38 | catch {
39 | Write-Error "Failed to update retention settings for build: $_.Exception.Response.StatusDescription"
40 | exit 1
41 | }
42 | }
43 |
44 | Update-BuildRetention -azdoOrgUri $azdoOrgUri -azdoProject $azdoProject -buildId $buildId -token $token
45 | exit 0
46 |
--------------------------------------------------------------------------------
/eng/common/sdl/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/eng/common/sdl/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/eng/common/sdl/sdl.ps1:
--------------------------------------------------------------------------------
1 |
2 | function Install-Gdn {
3 | param(
4 | [Parameter(Mandatory=$true)]
5 | [string]$Path,
6 |
7 | [string]$Source = "https://pkgs.dev.azure.com/dnceng/_packaging/Guardian1ESPTUpstreamOrgFeed/nuget/v3/index.json",
8 |
9 | # If omitted, install the latest version of Guardian, otherwise install that specific version.
10 | [string]$Version
11 | )
12 |
13 | $ErrorActionPreference = 'Stop'
14 | Set-StrictMode -Version 2.0
15 | $disableConfigureToolsetImport = $true
16 | $global:LASTEXITCODE = 0
17 |
18 | # `tools.ps1` checks $ci to perform some actions. Since the SDL
19 | # scripts don't necessarily execute in the same agent that run the
20 | # build.ps1/sh script this variable isn't automatically set.
21 | $ci = $true
22 | . $PSScriptRoot\..\tools.ps1
23 |
24 | $argumentList = @("install", "Microsoft.Guardian.Cli.win-x64", "-Source $Source", "-OutputDirectory $Path", "-NonInteractive", "-NoCache")
25 |
26 | if ($Version) {
27 | $argumentList += "-Version $Version"
28 | }
29 |
30 | Start-Process nuget -Verbose -ArgumentList $argumentList -NoNewWindow -Wait
31 |
32 | $gdnCliPath = Get-ChildItem -Filter guardian.cmd -Recurse -Path $Path
33 |
34 | if (!$gdnCliPath)
35 | {
36 | Write-PipelineTelemetryError -Category 'Sdl' -Message 'Failure installing Guardian'
37 | }
38 |
39 | return $gdnCliPath.FullName
40 | }
--------------------------------------------------------------------------------
/eng/common/templates-official/jobs/codeql-build.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md
3 | continueOnError: false
4 | # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job
5 | jobs: []
6 | # Optional: if specified, restore and use this version of Guardian instead of the default.
7 | overrideGuardianVersion: ''
8 |
9 | jobs:
10 | - template: /eng/common/templates-official/jobs/jobs.yml
11 | parameters:
12 | enableMicrobuild: false
13 | enablePublishBuildArtifacts: false
14 | enablePublishTestResults: false
15 | enablePublishBuildAssets: false
16 | enablePublishUsingPipelines: false
17 | enableTelemetry: true
18 |
19 | variables:
20 | - group: Publish-Build-Assets
21 | # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
22 | # sync with the packages.config file.
23 | - name: DefaultGuardianVersion
24 | value: 0.109.0
25 | - name: GuardianPackagesConfigFile
26 | value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
27 | - name: GuardianVersion
28 | value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}
29 |
30 | jobs: ${{ parameters.jobs }}
31 |
32 |
--------------------------------------------------------------------------------
/eng/common/templates-official/post-build/common-variables.yml:
--------------------------------------------------------------------------------
1 | variables:
2 | - group: Publish-Build-Assets
3 |
4 | # Whether the build is internal or not
5 | - name: IsInternalBuild
6 | value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }}
7 |
8 | # Default Maestro++ API Endpoint and API Version
9 | - name: MaestroApiEndPoint
10 | value: "https://maestro.dot.net"
11 | - name: MaestroApiAccessToken
12 | value: $(MaestroAccessToken)
13 | - name: MaestroApiVersion
14 | value: "2020-02-20"
15 |
16 | - name: SourceLinkCLIVersion
17 | value: 3.0.0
18 | - name: SymbolToolVersion
19 | value: 1.0.1
20 |
21 | - name: runCodesignValidationInjection
22 | value: false
23 |
--------------------------------------------------------------------------------
/eng/common/templates-official/post-build/trigger-subscription.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | ChannelId: 0
3 |
4 | steps:
5 | - task: PowerShell@2
6 | displayName: Triggering subscriptions
7 | inputs:
8 | filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1
9 | arguments: -SourceRepo $(Build.Repository.Uri)
10 | -ChannelId ${{ parameters.ChannelId }}
11 | -MaestroApiAccessToken $(MaestroAccessToken)
12 | -MaestroApiEndPoint $(MaestroApiEndPoint)
13 | -MaestroApiVersion $(MaestroApiVersion)
14 |
--------------------------------------------------------------------------------
/eng/common/templates-official/steps/add-build-to-channel.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | ChannelId: 0
3 |
4 | steps:
5 | - task: PowerShell@2
6 | displayName: Add Build to Channel
7 | inputs:
8 | filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1
9 | arguments: -BuildId $(BARBuildId)
10 | -ChannelId ${{ parameters.ChannelId }}
11 | -MaestroApiAccessToken $(MaestroApiAccessToken)
12 | -MaestroApiEndPoint $(MaestroApiEndPoint)
13 | -MaestroApiVersion $(MaestroApiVersion)
14 |
--------------------------------------------------------------------------------
/eng/common/templates-official/steps/build-reason.yml:
--------------------------------------------------------------------------------
1 | # build-reason.yml
2 | # Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons
3 | # to include steps (',' separated).
4 | parameters:
5 | conditions: ''
6 | steps: []
7 |
8 | steps:
9 | - ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}:
10 | - ${{ parameters.steps }}
11 | - ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}:
12 | - ${{ parameters.steps }}
13 |
--------------------------------------------------------------------------------
/eng/common/templates-official/steps/component-governance.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | disableComponentGovernance: false
3 | componentGovernanceIgnoreDirectories: ''
4 |
5 | steps:
6 | - ${{ if eq(parameters.disableComponentGovernance, 'true') }}:
7 | - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true"
8 | displayName: Set skipComponentGovernanceDetection variable
9 | - ${{ if ne(parameters.disableComponentGovernance, 'true') }}:
10 | - task: ComponentGovernanceComponentDetection@0
11 | continueOnError: true
12 | inputs:
13 | ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }}
--------------------------------------------------------------------------------
/eng/common/templates-official/steps/enable-internal-runtimes.yml:
--------------------------------------------------------------------------------
1 | # Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64'
2 | # variable with the base64-encoded SAS token, by default
3 |
4 | parameters:
5 | - name: federatedServiceConnection
6 | type: string
7 | default: 'dotnetbuilds-internal-read'
8 | - name: outputVariableName
9 | type: string
10 | default: 'dotnetbuilds-internal-container-read-token-base64'
11 | - name: expiryInHours
12 | type: number
13 | default: 1
14 | - name: base64Encode
15 | type: boolean
16 | default: true
17 |
18 | steps:
19 | - ${{ if ne(variables['System.TeamProject'], 'public') }}:
20 | - template: /eng/common/templates-official/steps/get-delegation-sas.yml
21 | parameters:
22 | federatedServiceConnection: ${{ parameters.federatedServiceConnection }}
23 | outputVariableName: ${{ parameters.outputVariableName }}
24 | expiryInHours: ${{ parameters.expiryInHours }}
25 | base64Encode: ${{ parameters.base64Encode }}
26 | storageAccount: dotnetbuilds
27 | container: internal
28 | permissions: rl
29 |
--------------------------------------------------------------------------------
/eng/common/templates-official/steps/get-federated-access-token.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | - name: federatedServiceConnection
3 | type: string
4 | - name: outputVariableName
5 | type: string
6 | - name: stepName
7 | type: string
8 | default: 'getFederatedAccessToken'
9 | - name: condition
10 | type: string
11 | default: ''
12 | # Resource to get a token for. Common values include:
13 | # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps
14 | # - 'https://storage.azure.com/' for storage
15 | # Defaults to Azure DevOps
16 | - name: resource
17 | type: string
18 | default: '499b84ac-1321-427f-aa17-267ca6975798'
19 | - name: isStepOutputVariable
20 | type: boolean
21 | default: false
22 |
23 | steps:
24 | - task: AzureCLI@2
25 | displayName: 'Getting federated access token for feeds'
26 | name: ${{ parameters.stepName }}
27 | ${{ if ne(parameters.condition, '') }}:
28 | condition: ${{ parameters.condition }}
29 | inputs:
30 | azureSubscription: ${{ parameters.federatedServiceConnection }}
31 | scriptType: 'pscore'
32 | scriptLocation: 'inlineScript'
33 | inlineScript: |
34 | $accessToken = az account get-access-token --query accessToken --resource ${{ parameters.resource }} --output tsv
35 | if ($LASTEXITCODE -ne 0) {
36 | Write-Error "Failed to get access token for resource '${{ parameters.resource }}'"
37 | exit 1
38 | }
39 | Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value"
40 | Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken"
--------------------------------------------------------------------------------
/eng/common/templates-official/steps/publish-logs.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | StageLabel: ''
3 | JobLabel: ''
4 |
5 | steps:
6 | - task: Powershell@2
7 | displayName: Prepare Binlogs to Upload
8 | inputs:
9 | targetType: inline
10 | script: |
11 | New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/
12 | Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/
13 | continueOnError: true
14 | condition: always()
15 |
16 | - task: 1ES.PublishBuildArtifacts@1
17 | displayName: Publish Logs
18 | inputs:
19 | PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs'
20 | PublishLocation: Container
21 | ArtifactName: PostBuildLogs
22 | continueOnError: true
23 | condition: always()
24 |
--------------------------------------------------------------------------------
/eng/common/templates-official/steps/retain-build.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | # Optional azure devops PAT with build execute permissions for the build's organization,
3 | # only needed if the build that should be retained ran on a different organization than
4 | # the pipeline where this template is executing from
5 | Token: ''
6 | # Optional BuildId to retain, defaults to the current running build
7 | BuildId: ''
8 | # Azure devops Organization URI for the build in the https://dev.azure.com/ format.
9 | # Defaults to the organization the current pipeline is running on
10 | AzdoOrgUri: '$(System.CollectionUri)'
11 | # Azure devops project for the build. Defaults to the project the current pipeline is running on
12 | AzdoProject: '$(System.TeamProject)'
13 |
14 | steps:
15 | - task: powershell@2
16 | inputs:
17 | targetType: 'filePath'
18 | filePath: eng/common/retain-build.ps1
19 | pwsh: true
20 | arguments: >
21 | -AzdoOrgUri: ${{parameters.AzdoOrgUri}}
22 | -AzdoProject ${{parameters.AzdoProject}}
23 | -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }}
24 | -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}}
25 | displayName: Enable permanent build retention
26 | env:
27 | SYSTEM_ACCESSTOKEN: $(System.AccessToken)
28 | BUILD_ID: $(Build.BuildId)
--------------------------------------------------------------------------------
/eng/common/templates-official/variables/sdl-variables.yml:
--------------------------------------------------------------------------------
1 | variables:
2 | # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
3 | # sync with the packages.config file.
4 | - name: DefaultGuardianVersion
5 | value: 0.109.0
6 | - name: GuardianPackagesConfigFile
7 | value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
--------------------------------------------------------------------------------
/eng/common/templates/jobs/codeql-build.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md
3 | continueOnError: false
4 | # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job
5 | jobs: []
6 | # Optional: if specified, restore and use this version of Guardian instead of the default.
7 | overrideGuardianVersion: ''
8 |
9 | jobs:
10 | - template: /eng/common/templates/jobs/jobs.yml
11 | parameters:
12 | enableMicrobuild: false
13 | enablePublishBuildArtifacts: false
14 | enablePublishTestResults: false
15 | enablePublishBuildAssets: false
16 | enablePublishUsingPipelines: false
17 | enableTelemetry: true
18 |
19 | variables:
20 | - group: Publish-Build-Assets
21 | # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
22 | # sync with the packages.config file.
23 | - name: DefaultGuardianVersion
24 | value: 0.109.0
25 | - name: GuardianPackagesConfigFile
26 | value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
27 | - name: GuardianVersion
28 | value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}
29 |
30 | jobs: ${{ parameters.jobs }}
31 |
32 |
--------------------------------------------------------------------------------
/eng/common/templates/post-build/common-variables.yml:
--------------------------------------------------------------------------------
1 | variables:
2 | - group: Publish-Build-Assets
3 |
4 | # Whether the build is internal or not
5 | - name: IsInternalBuild
6 | value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }}
7 |
8 | # Default Maestro++ API Endpoint and API Version
9 | - name: MaestroApiEndPoint
10 | value: "https://maestro.dot.net"
11 | - name: MaestroApiAccessToken
12 | value: $(MaestroAccessToken)
13 | - name: MaestroApiVersion
14 | value: "2020-02-20"
15 |
16 | - name: SourceLinkCLIVersion
17 | value: 3.0.0
18 | - name: SymbolToolVersion
19 | value: 1.0.1
20 |
21 | - name: runCodesignValidationInjection
22 | value: false
23 |
--------------------------------------------------------------------------------
/eng/common/templates/post-build/trigger-subscription.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | ChannelId: 0
3 |
4 | steps:
5 | - task: PowerShell@2
6 | displayName: Triggering subscriptions
7 | inputs:
8 | filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1
9 | arguments: -SourceRepo $(Build.Repository.Uri)
10 | -ChannelId ${{ parameters.ChannelId }}
11 | -MaestroApiAccessToken $(MaestroAccessToken)
12 | -MaestroApiEndPoint $(MaestroApiEndPoint)
13 | -MaestroApiVersion $(MaestroApiVersion)
14 |
--------------------------------------------------------------------------------
/eng/common/templates/steps/add-build-to-channel.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | ChannelId: 0
3 |
4 | steps:
5 | - task: PowerShell@2
6 | displayName: Add Build to Channel
7 | inputs:
8 | filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1
9 | arguments: -BuildId $(BARBuildId)
10 | -ChannelId ${{ parameters.ChannelId }}
11 | -MaestroApiAccessToken $(MaestroApiAccessToken)
12 | -MaestroApiEndPoint $(MaestroApiEndPoint)
13 | -MaestroApiVersion $(MaestroApiVersion)
14 |
--------------------------------------------------------------------------------
/eng/common/templates/steps/build-reason.yml:
--------------------------------------------------------------------------------
1 | # build-reason.yml
2 | # Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons
3 | # to include steps (',' separated).
4 | parameters:
5 | conditions: ''
6 | steps: []
7 |
8 | steps:
9 | - ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}:
10 | - ${{ parameters.steps }}
11 | - ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}:
12 | - ${{ parameters.steps }}
13 |
--------------------------------------------------------------------------------
/eng/common/templates/steps/component-governance.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | disableComponentGovernance: false
3 | componentGovernanceIgnoreDirectories: ''
4 |
5 | steps:
6 | - ${{ if eq(parameters.disableComponentGovernance, 'true') }}:
7 | - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true"
8 | displayName: Set skipComponentGovernanceDetection variable
9 | - ${{ if ne(parameters.disableComponentGovernance, 'true') }}:
10 | - task: ComponentGovernanceComponentDetection@0
11 | continueOnError: true
12 | inputs:
13 | ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }}
--------------------------------------------------------------------------------
/eng/common/templates/steps/enable-internal-runtimes.yml:
--------------------------------------------------------------------------------
1 | # Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64'
2 | # variable with the base64-encoded SAS token, by default
3 |
4 | parameters:
5 | - name: federatedServiceConnection
6 | type: string
7 | default: 'dotnetbuilds-internal-read'
8 | - name: outputVariableName
9 | type: string
10 | default: 'dotnetbuilds-internal-container-read-token-base64'
11 | - name: expiryInHours
12 | type: number
13 | default: 1
14 | - name: base64Encode
15 | type: boolean
16 | default: true
17 |
18 | steps:
19 | - ${{ if ne(variables['System.TeamProject'], 'public') }}:
20 | - template: /eng/common/templates/steps/get-delegation-sas.yml
21 | parameters:
22 | federatedServiceConnection: ${{ parameters.federatedServiceConnection }}
23 | outputVariableName: ${{ parameters.outputVariableName }}
24 | expiryInHours: ${{ parameters.expiryInHours }}
25 | base64Encode: ${{ parameters.base64Encode }}
26 | storageAccount: dotnetbuilds
27 | container: internal
28 | permissions: rl
29 |
--------------------------------------------------------------------------------
/eng/common/templates/steps/get-federated-access-token.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | - name: federatedServiceConnection
3 | type: string
4 | - name: outputVariableName
5 | type: string
6 | - name: stepName
7 | type: string
8 | default: 'getFederatedAccessToken'
9 | - name: condition
10 | type: string
11 | default: ''
12 | # Resource to get a token for. Common values include:
13 | # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps
14 | # - 'https://storage.azure.com/' for storage
15 | # Defaults to Azure DevOps
16 | - name: resource
17 | type: string
18 | default: '499b84ac-1321-427f-aa17-267ca6975798'
19 | - name: isStepOutputVariable
20 | type: boolean
21 | default: false
22 |
23 | steps:
24 | - task: AzureCLI@2
25 | displayName: 'Getting federated access token for feeds'
26 | name: ${{ parameters.stepName }}
27 | ${{ if ne(parameters.condition, '') }}:
28 | condition: ${{ parameters.condition }}
29 | inputs:
30 | azureSubscription: ${{ parameters.federatedServiceConnection }}
31 | scriptType: 'pscore'
32 | scriptLocation: 'inlineScript'
33 | inlineScript: |
34 | $accessToken = az account get-access-token --query accessToken --resource ${{ parameters.resource }} --output tsv
35 | if ($LASTEXITCODE -ne 0) {
36 | Write-Error "Failed to get access token for resource '${{ parameters.resource }}'"
37 | exit 1
38 | }
39 | Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value"
40 | Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken"
--------------------------------------------------------------------------------
/eng/common/templates/steps/publish-logs.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | StageLabel: ''
3 | JobLabel: ''
4 |
5 | steps:
6 | - task: Powershell@2
7 | displayName: Prepare Binlogs to Upload
8 | inputs:
9 | targetType: inline
10 | script: |
11 | New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/
12 | Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/
13 | continueOnError: true
14 | condition: always()
15 |
16 | - task: PublishBuildArtifacts@1
17 | displayName: Publish Logs
18 | inputs:
19 | PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs'
20 | PublishLocation: Container
21 | ArtifactName: PostBuildLogs
22 | continueOnError: true
23 | condition: always()
24 |
--------------------------------------------------------------------------------
/eng/common/templates/steps/retain-build.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | # Optional azure devops PAT with build execute permissions for the build's organization,
3 | # only needed if the build that should be retained ran on a different organization than
4 | # the pipeline where this template is executing from
5 | Token: ''
6 | # Optional BuildId to retain, defaults to the current running build
7 | BuildId: ''
8 | # Azure devops Organization URI for the build in the https://dev.azure.com/ format.
9 | # Defaults to the organization the current pipeline is running on
10 | AzdoOrgUri: '$(System.CollectionUri)'
11 | # Azure devops project for the build. Defaults to the project the current pipeline is running on
12 | AzdoProject: '$(System.TeamProject)'
13 |
14 | steps:
15 | - task: powershell@2
16 | inputs:
17 | targetType: 'filePath'
18 | filePath: eng/common/retain-build.ps1
19 | pwsh: true
20 | arguments: >
21 | -AzdoOrgUri: ${{parameters.AzdoOrgUri}}
22 | -AzdoProject ${{parameters.AzdoProject}}
23 | -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }}
24 | -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}}
25 | displayName: Enable permanent build retention
26 | env:
27 | SYSTEM_ACCESSTOKEN: $(System.AccessToken)
28 | BUILD_ID: $(Build.BuildId)
--------------------------------------------------------------------------------
/eng/common/templates/steps/run-on-unix.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | agentOs: ''
3 | steps: []
4 |
5 | steps:
6 | - ${{ if ne(parameters.agentOs, 'Windows_NT') }}:
7 | - ${{ parameters.steps }}
8 |
--------------------------------------------------------------------------------
/eng/common/templates/steps/run-on-windows.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | agentOs: ''
3 | steps: []
4 |
5 | steps:
6 | - ${{ if eq(parameters.agentOs, 'Windows_NT') }}:
7 | - ${{ parameters.steps }}
8 |
--------------------------------------------------------------------------------
/eng/common/templates/steps/run-script-ifequalelse.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | # if parameter1 equals parameter 2, run 'ifScript' command, else run 'elsescript' command
3 | parameter1: ''
4 | parameter2: ''
5 | ifScript: ''
6 | elseScript: ''
7 |
8 | # name of script step
9 | name: Script
10 |
11 | # display name of script step
12 | displayName: If-Equal-Else Script
13 |
14 | # environment
15 | env: {}
16 |
17 | # conditional expression for step execution
18 | condition: ''
19 |
20 | steps:
21 | - ${{ if and(ne(parameters.ifScript, ''), eq(parameters.parameter1, parameters.parameter2)) }}:
22 | - script: ${{ parameters.ifScript }}
23 | name: ${{ parameters.name }}
24 | displayName: ${{ parameters.displayName }}
25 | env: ${{ parameters.env }}
26 | condition: ${{ parameters.condition }}
27 |
28 | - ${{ if and(ne(parameters.elseScript, ''), ne(parameters.parameter1, parameters.parameter2)) }}:
29 | - script: ${{ parameters.elseScript }}
30 | name: ${{ parameters.name }}
31 | displayName: ${{ parameters.displayName }}
32 | env: ${{ parameters.env }}
33 | condition: ${{ parameters.condition }}
--------------------------------------------------------------------------------
/eng/common/templates/variables/sdl-variables.yml:
--------------------------------------------------------------------------------
1 | variables:
2 | # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
3 | # sync with the packages.config file.
4 | - name: DefaultGuardianVersion
5 | value: 0.109.0
6 | - name: GuardianPackagesConfigFile
7 | value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
--------------------------------------------------------------------------------
/eng/helpers.psm1:
--------------------------------------------------------------------------------
1 | ##############################
2 | #.SYNOPSIS
3 | # Wrapper for git.exe that handles errors and warnings the powershell way
4 | #
5 | ##############################
6 | function git
7 | {
8 | [cmdletbinding()]
9 | param(
10 | [Parameter(ValueFromRemainingArguments=$true)] $params
11 | )
12 | $ErrorActionPreference = "Continue"
13 | $allOutput = & git.exe $params 2>&1
14 |
15 | $allOutput | ForEach-Object {
16 | if ($_ -is [System.Management.Automation.ErrorRecord])
17 | {
18 | $message = $_.Exception.Message
19 | if ($message -match '^warning: ')
20 | {
21 | Write-Warning $message
22 | }
23 | else
24 | {
25 | Write-Error $message
26 | }
27 | }
28 | else
29 | {
30 | Write-Output $_
31 | }
32 | }
33 | }
34 |
35 | Export-ModuleMember -Function @(
36 | 'git'
37 | )
38 |
--------------------------------------------------------------------------------
/eng/test.yaml:
--------------------------------------------------------------------------------
1 | steps:
2 |
3 | - task: DotNetCoreCLI@2
4 | displayName: Test C# (dotnet test)
5 | inputs:
6 | command: custom
7 | projects: |
8 | $(Build.SourcesDirectory)\dnceng-shared.sln
9 | custom: test
10 | arguments: >
11 | --configuration $(_BuildConfig)
12 | --filter "TestCategory!=PostDeployment&TestCategory!=Nightly&TestCategory!=PreDeployment"
13 | --no-build
14 | --logger "trx;LogFilePrefix=TestResults-"
15 | -v normal
16 | --
17 | "RunConfiguration.ResultsDirectory=$(Build.ArtifactStagingDirectory)\TestResults"
18 | RunConfiguration.MapCpuCount=4
19 | env:
20 | NUGET_PACKAGES: $(Build.SourcesDirectory)/.packages
21 | condition: succeededOrFailed()
22 |
23 | - task: PublishTestResults@2
24 | displayName: Publish Core Test Results
25 | condition: succeededOrFailed()
26 | inputs:
27 | testRunner: VSTest
28 | testResultsFiles: '**/TestResults-*'
29 | searchFolder: $(Build.ArtifactStagingDirectory)\TestResults
30 | testRunTitle: Basic Tests
31 | mergeTestResults: true
32 | configuration: $(_BuildConfig)
33 |
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "8.0.115",
4 | "allowPrerelease": true,
5 | "rollForward": "minor"
6 | },
7 | "tools": {
8 | "dotnet": "8.0.115",
9 | "runtimes": {
10 | "dotnet": [
11 | "3.1.32",
12 | "6.0.14"
13 | ]
14 | }
15 | },
16 | "msbuild-sdks": {
17 | "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25230.1"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/CoreHealthMonitor/CoreHealthMonitor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | true
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/CoreHealthMonitor/DriveMonitorOptions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace CoreHealthMonitor;
5 |
6 | public class DriveMonitorOptions
7 | {
8 | public long MinimumFreeSpaceBytes { get; set; }
9 | }
10 |
--------------------------------------------------------------------------------
/src/MIcrosoft.DotNet.Internal.Logging/FormattableStringFormatter.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using Microsoft.Extensions.Logging;
6 |
7 | namespace Microsoft.DotNet.Internal.Logging;
8 |
9 | internal static class FormattableStringFormatter
10 | {
11 | private class FormattingLogger : ILogger, IDisposable
12 | {
13 | public string LastLog;
14 |
15 | public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
16 | {
17 | LastLog = formatter(state, exception);
18 | }
19 |
20 | public bool IsEnabled(LogLevel logLevel)
21 | {
22 | return true;
23 | }
24 |
25 | public IDisposable BeginScope(TState state)
26 | {
27 | return this;
28 | }
29 |
30 | public void Dispose()
31 | {
32 | }
33 | }
34 |
35 | public static string Format(string logFormatString, object[] args)
36 | {
37 | var logger = new FormattingLogger();
38 | logger.Log(LogLevel.Error, logFormatString, args);
39 | return logger.LastLog;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/MIcrosoft.DotNet.Internal.Logging/Microsoft.DotNet.Internal.Logging.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/MIcrosoft.DotNet.Internal.Logging/OperationManagerOptions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.Internal.Logging;
5 |
6 | public class OperationManagerOptions
7 | {
8 | public bool ShouldStartActivity { get; set; } = true;
9 | public bool ShouldCreateLoggingScope { get; set; } = true;
10 | }
11 |
--------------------------------------------------------------------------------
/src/MIcrosoft.DotNet.Internal.Logging/ServiceCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using Microsoft.Extensions.DependencyInjection;
6 |
7 | namespace Microsoft.DotNet.Internal.Logging;
8 |
9 | public static class ServiceCollectionExtensions
10 | {
11 | public static IServiceCollection AddOperationTracking(
12 | this IServiceCollection collection,
13 | Action configure)
14 | {
15 | collection.AddSingleton();
16 | collection.AddOptions();
17 | collection.Configure(configure);
18 | return collection;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiPagination/ApiPaginationApplicationModelConvention.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Reflection;
5 | using Microsoft.AspNetCore.Mvc.ApplicationModels;
6 |
7 | namespace Microsoft.AspNetCore.ApiPagination;
8 |
9 | public class ApiPaginationApplicationModelConvention : IApplicationModelConvention
10 | {
11 | public void Apply(ApplicationModel application)
12 | {
13 | foreach (ControllerModel controller in application.Controllers)
14 | {
15 | foreach (ActionModel action in controller.Actions)
16 | {
17 | var paginatedAttribute = action.ActionMethod.GetCustomAttribute();
18 | if (paginatedAttribute != null)
19 | {
20 | foreach (ParameterModel param in paginatedAttribute.CreateParameterModels())
21 | {
22 | param.Action = action;
23 | action.Parameters.Add(param);
24 | }
25 | }
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiPagination/ApiPaginationMvcBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using JetBrains.Annotations;
5 | using Microsoft.AspNetCore.Mvc;
6 | using Microsoft.Extensions.DependencyInjection;
7 |
8 | namespace Microsoft.AspNetCore.ApiPagination;
9 |
10 | [PublicAPI]
11 | public static class ApiPaginationMvcBuilderExtensions
12 | {
13 | public static IMvcBuilder AddApiPagination(this IMvcBuilder builder)
14 | {
15 | return builder.AddMvcOptions(ConfigureMvcOptions);
16 | }
17 |
18 | private static void ConfigureMvcOptions(MvcOptions options)
19 | {
20 | options.Conventions.Add(new ApiPaginationApplicationModelConvention());
21 | }
22 |
23 | public static IMvcCoreBuilder AddApiPagination(this IMvcCoreBuilder builder)
24 | {
25 | return builder.AddMvcOptions(ConfigureMvcOptions);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiPagination/Microsoft.AspNetCore.ApiPagination.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning.Analyzers/KnownTypes.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using Microsoft.CodeAnalysis;
5 |
6 | namespace Microsoft.AspNetCore.ApiVersioning.Analyzers;
7 |
8 | internal class KnownTypes
9 | {
10 | public KnownTypes(Compilation compilation)
11 | {
12 | Controller = compilation.GetTypeByMetadataName("Microsoft.AspNetCore.Mvc.Controller");
13 | Type = compilation.GetTypeByMetadataName("System.Type");
14 | ApiVersionAttribute =
15 | compilation.GetTypeByMetadataName("Microsoft.AspNetCore.ApiVersioning.ApiVersionAttribute");
16 | ProducesResponseTypeAttribute =
17 | compilation.GetTypeByMetadataName("Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute");
18 | }
19 |
20 | public ITypeSymbol Type { get; }
21 | public ITypeSymbol Controller { get; }
22 | public ITypeSymbol ApiVersionAttribute { get; }
23 | public ITypeSymbol ProducesResponseTypeAttribute { get; }
24 |
25 | public bool HaveRequired()
26 | {
27 | return Type != null && Controller != null && ApiVersionAttribute != null &&
28 | ProducesResponseTypeAttribute != null;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning.Analyzers/Microsoft.AspNetCore.ApiVersioning.Analyzers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | false
6 | true
7 |
8 | true
9 | $(NoWarn);RS2008
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning.Swashbuckle/ISwaggerVersioningScheme.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using JetBrains.Annotations;
5 | using Microsoft.OpenApi.Models;
6 | using Swashbuckle.AspNetCore.SwaggerGen;
7 |
8 | namespace Microsoft.AspNetCore.ApiVersioning.Swashbuckle;
9 |
10 | [PublicAPI]
11 | public interface ISwaggerVersioningScheme
12 | {
13 | void Apply(OpenApiOperation operation, OperationFilterContext context, string version);
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning.Swashbuckle/Microsoft.AspNetCore.ApiVersioning.Swashbuckle.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning.Swashbuckle/SwaggerApiResponseAttribute.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using System.Net;
6 | using Swashbuckle.AspNetCore.Annotations;
7 |
8 | namespace Microsoft.AspNetCore.ApiVersioning.Swashbuckle;
9 |
10 | ///
11 | /// Implementation of that is not inherited.
12 | ///
13 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
14 | public class SwaggerApiResponseAttribute : SwaggerResponseAttribute
15 | {
16 | public SwaggerApiResponseAttribute(int statusCode, string description = null, Type type = null) : base(statusCode, description, type)
17 | {
18 | }
19 |
20 | public SwaggerApiResponseAttribute(HttpStatusCode statusCode, string description = null, Type type = null) :
21 | this((int) statusCode, description, type)
22 | {
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning.Swashbuckle/SwaggerModelBindingOperationFilter.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Linq;
5 | using Microsoft.AspNetCore.Mvc.ApiExplorer;
6 | using Microsoft.OpenApi.Models;
7 | using Swashbuckle.AspNetCore.SwaggerGen;
8 |
9 | namespace Microsoft.AspNetCore.ApiVersioning.Swashbuckle;
10 |
11 | public class SwaggerModelBindingOperationFilter : IOperationFilter
12 | {
13 | public void Apply(OpenApiOperation operation, OperationFilterContext context)
14 | {
15 | foreach (OpenApiParameter parameter in operation.Parameters)
16 | {
17 | // For some reason Swashbuckle doesn't honor ModelMetadata.IsRequired for parameters
18 | ApiParameterDescription apiParamDesc =
19 | context.ApiDescription.ParameterDescriptions.FirstOrDefault(p => p.Name == parameter.Name);
20 | if (apiParamDesc != null && apiParamDesc.ModelMetadata.IsRequired)
21 | {
22 | parameter.Required = true;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning.Swashbuckle/VersioningOperationFilter.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using JetBrains.Annotations;
5 | using Microsoft.OpenApi.Models;
6 | using Swashbuckle.AspNetCore.Swagger;
7 | using Swashbuckle.AspNetCore.SwaggerGen;
8 |
9 | namespace Microsoft.AspNetCore.ApiVersioning.Swashbuckle;
10 |
11 | [UsedImplicitly(ImplicitUseKindFlags.InstantiatedWithFixedConstructorSignature)]
12 | internal class VersioningOperationFilter : IOperationFilter
13 | {
14 | private readonly ISwaggerVersioningScheme _scheme;
15 |
16 | public VersioningOperationFilter(ISwaggerVersioningScheme scheme)
17 | {
18 | _scheme = scheme;
19 | }
20 |
21 | public void Apply(OpenApiOperation operation, OperationFilterContext context)
22 | {
23 | string version = context.ApiDescription.ActionDescriptor.RouteValues["version"];
24 | _scheme.Apply(operation, context, version);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/ApiRemovedAttribute.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.AspNetCore.ApiVersioning;
7 |
8 | [AttributeUsage(AttributeTargets.Method)]
9 | public class ApiRemovedAttribute : Attribute
10 | {
11 | }
12 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/ApiVersioningExtensions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using JetBrains.Annotations;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.ApiExplorer;
8 | using Microsoft.AspNetCore.Mvc.ApplicationModels;
9 | using Microsoft.Extensions.DependencyInjection;
10 | using Microsoft.Extensions.Options;
11 |
12 | namespace Microsoft.AspNetCore.ApiVersioning;
13 |
14 | public static class ApiVersioningExtensions
15 | {
16 | [PublicAPI]
17 | public static IServiceCollection AddApiVersioning(
18 | this IServiceCollection services,
19 | Action configureOptions)
20 | {
21 | return services.AddSingleton()
22 | .AddSingleton()
23 | .AddSingleton, ApiVersioningMvcOptionsSetup>()
24 | .AddTransient()
25 | .Configure(configureOptions);
26 | }
27 | }
28 |
29 | public class ApiVersioningMvcOptionsSetup : IConfigureOptions
30 | {
31 | private readonly VersionedApiConvention _apiConvention;
32 |
33 | public ApiVersioningMvcOptionsSetup(VersionedApiConvention apiConvention)
34 | {
35 | _apiConvention = apiConvention;
36 | }
37 |
38 | public void Configure(MvcOptions options)
39 | {
40 | options.Conventions.Add(_apiConvention);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/ApiVersioningOptions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using System.Reflection;
6 | using JetBrains.Annotations;
7 | using Microsoft.AspNetCore.ApiVersioning.Schemes;
8 |
9 | namespace Microsoft.AspNetCore.ApiVersioning;
10 |
11 | [PublicAPI]
12 | public class ApiVersioningOptions
13 | {
14 | public Func GetVersion { get; set; } = DefaultGetVersion;
15 | public Func GetName { get; set; } = DefaultGetName;
16 | public IVersioningScheme VersioningScheme { get; set; } = new PathVersioningScheme();
17 |
18 | [CanBeNull]
19 | public static string DefaultGetVersion(TypeInfo controllerType)
20 | {
21 | var attribute = controllerType.GetCustomAttribute(false);
22 | return attribute?.Version;
23 | }
24 |
25 | [NotNull]
26 | private static string DefaultGetName(TypeInfo controllerType)
27 | {
28 | return controllerType.Name.Substring(0, controllerType.Name.Length - 10);
29 | }
30 | }
31 |
32 | [PublicAPI]
33 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
34 | public class ApiVersionAttribute : Attribute
35 | {
36 | public ApiVersionAttribute(string version)
37 | {
38 | Version = version;
39 | }
40 |
41 | public string Version { get; }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/ApiVersioningOptionsExtensions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using JetBrains.Annotations;
5 | using Microsoft.AspNetCore.ApiVersioning.Schemes;
6 |
7 | namespace Microsoft.AspNetCore.ApiVersioning;
8 |
9 | [PublicAPI]
10 | public static class ApiVersioningOptionsExtensions
11 | {
12 | public static ApiVersioningOptions VersionByHeader(this ApiVersioningOptions options)
13 | {
14 | return options.VersionByHeader("X-Api-Version");
15 | }
16 |
17 | public static ApiVersioningOptions VersionByHeader(this ApiVersioningOptions options, string headerName)
18 | {
19 | options.VersioningScheme = new HeaderVersioningScheme(headerName);
20 | return options;
21 | }
22 |
23 | public static ApiVersioningOptions VersionByQuery(this ApiVersioningOptions options)
24 | {
25 | return options.VersionByQuery("api-version");
26 | }
27 |
28 | public static ApiVersioningOptions VersionByQuery(this ApiVersioningOptions options, string parameterName)
29 | {
30 | options.VersioningScheme = new QueryVersioningScheme(parameterName);
31 | return options;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/IVersioningScheme.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using Microsoft.AspNetCore.Mvc.ApplicationModels;
5 |
6 | namespace Microsoft.AspNetCore.ApiVersioning;
7 |
8 | public interface IVersioningScheme
9 | {
10 | void Apply(SelectorModel model, string version);
11 | }
12 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/Microsoft.AspNetCore.ApiVersioning.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/Schemes/HeaderVersioningScheme.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using Microsoft.AspNetCore.Mvc.ActionConstraints;
5 | using Microsoft.AspNetCore.Mvc.ApplicationModels;
6 |
7 | namespace Microsoft.AspNetCore.ApiVersioning.Schemes;
8 |
9 | public class HeaderVersioningScheme : IVersioningScheme
10 | {
11 | public HeaderVersioningScheme(string headerName)
12 | {
13 | HeaderName = headerName;
14 | }
15 |
16 | public string HeaderName { get; }
17 |
18 | public void Apply(SelectorModel model, string version)
19 | {
20 | AttributeRouteModel attributeRouteModel = model.AttributeRouteModel;
21 | attributeRouteModel.Template = "api/" + attributeRouteModel.Template;
22 | model.ActionConstraints.Add(new Constraint(HeaderName, version));
23 | }
24 |
25 | private class Constraint : IActionConstraint
26 | {
27 | private readonly string _headerName;
28 | private readonly string _version;
29 |
30 | public Constraint(string headerName, string version)
31 | {
32 | _headerName = headerName;
33 | _version = version;
34 | }
35 |
36 | public bool Accept(ActionConstraintContext context)
37 | {
38 | return context.RouteContext.HttpContext.Request.Headers[_headerName] == _version;
39 | }
40 |
41 | public int Order { get; } = 100;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/Schemes/PathVersioningScheme.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using Microsoft.AspNetCore.Mvc.ApplicationModels;
5 |
6 | namespace Microsoft.AspNetCore.ApiVersioning.Schemes;
7 |
8 | public class PathVersioningScheme : IVersioningScheme
9 | {
10 | public void Apply(SelectorModel model, string version)
11 | {
12 | AttributeRouteModel attributeRouteModel = model.AttributeRouteModel;
13 | attributeRouteModel.Template = $"api/{version}/{attributeRouteModel.Template}";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.AspNetCore.ApiVersioning/SuppressVersionErrorsAttribute.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.AspNetCore.ApiVersioning;
7 |
8 | ///
9 | /// This attribute marks the attributed type as "versioned" so the roslyn analyzer won't warn about it.
10 | /// This should only be used on types that never change and are shared by all api versions, like error models.
11 | ///
12 | [AttributeUsage(AttributeTargets.Class)]
13 | public class SuppressVersionErrorsAttribute : Attribute
14 | {
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/Authentication/TokenCredentialProvider.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Collections.Generic;
5 | using System.Threading.Tasks;
6 | using Azure.Core;
7 | using Azure.Identity;
8 | using Microsoft.DncEng.Configuration.Extensions;
9 |
10 | namespace Microsoft.DncEng.CommandLineLib.Authentication;
11 |
12 | public class TokenCredentialProvider
13 | {
14 | private readonly IConsole _console;
15 | private readonly InteractiveTokenCredentialProvider _interactiveTokenCredentialProvider;
16 |
17 | public TokenCredentialProvider(IConsole console, InteractiveTokenCredentialProvider interactiveTokenCredentialProvider)
18 | {
19 | _console = console;
20 | _interactiveTokenCredentialProvider = interactiveTokenCredentialProvider;
21 | }
22 |
23 | public async Task GetCredentialAsync()
24 | {
25 | var creds = new List
26 | {
27 | new DefaultAzureCredential(new DefaultAzureCredentialOptions()
28 | {
29 | TenantId = ConfigurationConstants.MsftAdTenantId,
30 | })
31 | };
32 |
33 | if (_console.IsInteractive)
34 | {
35 | creds.Add(await _interactiveTokenCredentialProvider.GetCredentialAsync());
36 | }
37 |
38 | return new ChainedTokenCredential(creds.ToArray());
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/CommandOptions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Microsoft.DncEng.CommandLineLib;
8 |
9 | public class CommandOptions : ICommandOptions
10 | {
11 | private readonly Dictionary _options = new Dictionary();
12 |
13 | public T GetOptions()
14 | {
15 | return (T) _options[typeof(T)];
16 | }
17 |
18 | public void RegisterOptions(Command options)
19 | {
20 | _options.Add(options.GetType(), options);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/DefaultConsoleBackend.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using System.IO;
6 | using System.Threading.Tasks;
7 |
8 | namespace Microsoft.DncEng.CommandLineLib;
9 |
10 | public class DefaultConsoleBackend : IConsoleBackend
11 | {
12 | public TextWriter Out => Console.Out;
13 | public TextWriter Error => Console.Error;
14 | public TextReader In => Console.In;
15 |
16 | public void SetColor(ConsoleColor color)
17 | {
18 | Console.ForegroundColor = color;
19 | }
20 |
21 | public void ResetColor()
22 | {
23 | Console.ResetColor();
24 | }
25 |
26 | public Task ReadLineAsync()
27 | {
28 | return Console.In.ReadLineAsync();
29 | }
30 |
31 | public async Task PromptAsync(string message)
32 | {
33 | // Purge the input buffer so piped in or previously typed text doesn't count
34 | while (Console.KeyAvailable)
35 | {
36 | Console.ReadKey(true);
37 | }
38 |
39 | await Console.Out.WriteAsync(message);
40 |
41 | string line = await Console.In.ReadLineAsync();
42 | return line;
43 | }
44 |
45 | public bool IsInteractive => !(Console.IsOutputRedirected || Console.IsInputRedirected || Console.IsErrorRedirected);
46 | }
47 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/ExitCodes.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DncEng.CommandLineLib;
5 |
6 | public class ExitCodes
7 | {
8 | public const int Success = 0;
9 | public const int UnknownArgument = 1;
10 | public const int MissingCommand = 2;
11 | public const int RequiredParameter = 3;
12 | public const int UnhandledException = 4;
13 | public const int Break = 5;
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/FailWithExitCodeException.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.DncEng.CommandLineLib;
7 |
8 | public class FailWithExitCodeException : Exception
9 | {
10 | public int ExitCode { get; }
11 | public bool ShowMessage { get; }
12 |
13 | public FailWithExitCodeException(int exitCode, string message = null) : base(message)
14 | {
15 | ShowMessage = !string.IsNullOrEmpty(message);
16 | ExitCode = exitCode;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/GlobalCommand.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using Mono.Options;
5 |
6 | namespace Microsoft.DncEng.CommandLineLib;
7 |
8 | public class GlobalCommand : Command
9 | {
10 | public override OptionSet GetOptions()
11 | {
12 | return new OptionSet
13 | {
14 | {
15 | "verbose|v", "Increase logging verbosity up to 2 (default 1)",
16 | v => Verbosity = BumpVerbosity(Verbosity)
17 | },
18 | {
19 | "quiet|q", "Suppress most output (except critical failures or prompts)",
20 | q => Verbosity = VerbosityLevel.Quiet
21 | },
22 | {"help|h|?", "Show help", h => Help = true},
23 | };
24 | }
25 |
26 | public bool Help { get; set; }
27 | public VerbosityLevel Verbosity { get; set; } = VerbosityLevel.Normal;
28 |
29 | private static VerbosityLevel BumpVerbosity(VerbosityLevel verbosity)
30 | {
31 | verbosity++;
32 | if (verbosity > VerbosityLevel.Verbose)
33 | {
34 | verbosity = VerbosityLevel.Verbose;
35 | }
36 |
37 | return verbosity;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/ICommandOptions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DncEng.CommandLineLib;
5 |
6 | ///
7 | /// Used to get the value of other command options, such as
8 | ///
9 | ///
10 | public interface ICommandOptions
11 | {
12 | ///
13 | /// Get the parsed options for the given command type.
14 | /// If this command was not part of the current execution, and Exception is thrown
15 | ///
16 | /// Type of command to fetch
17 | /// If the given option type has not been parsed
18 | /// The parsed command options
19 | T GetOptions();
20 | }
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/ICommandRegistry.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Microsoft.DncEng.CommandLineLib;
8 |
9 | public interface ICommandRegistry
10 | {
11 | IReadOnlyDictionary GetValidCommandAtScope(Type scope = null);
12 | }
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/IConsoleBackend.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using System.IO;
6 | using System.Threading.Tasks;
7 |
8 | namespace Microsoft.DncEng.CommandLineLib;
9 |
10 | public interface IConsoleBackend
11 | {
12 | TextWriter Out { get; }
13 | TextWriter Error { get; }
14 | TextReader In { get; }
15 | void SetColor(ConsoleColor color);
16 | void ResetColor();
17 | Task PromptAsync(string message);
18 | bool IsInteractive { get; }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/ISystemClock.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.DncEng.CommandLineLib;
7 |
8 | public interface ISystemClock
9 | {
10 | DateTimeOffset UtcNow { get; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/Microsoft.DncEng.CommandLineLib.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/SystemClock.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.DncEng.CommandLineLib;
7 |
8 | public class SystemClock : ISystemClock
9 | {
10 | public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
11 | }
12 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.CommandLineLib/VerbosityLevel.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DncEng.CommandLineLib;
5 |
6 | public enum VerbosityLevel
7 | {
8 | Quiet = 0,
9 | Normal = 1,
10 | Verbose = 2,
11 | }
12 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.Configuration.Extensions/ConfigurationConstants.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DncEng.Configuration.Extensions;
5 |
6 | public static class ConfigurationConstants
7 | {
8 | public static string KeyVaultUriConfigurationKey => "KeyVaultUri";
9 | public static string AppConfigurationUriConfigurationKey => "AppConfigurationUri";
10 | public static string ManagedIdentityIdConfigurationKey => "Secrets:ManagedIdentityId";
11 | public static string ReloadTimeSecondsConfigurationKey => "Secrets:ReloadTimeSeconds";
12 |
13 | public static string MsftAdTenantId => "72f988bf-86f1-41af-91ab-2d7cd011db47";
14 |
15 | // This group name must be kept in sync with 2 other places
16 | // - The ApplicationManifest.xml for the MaestroApplication service fabric
17 | // - The bootstrap.ps1 script, where this group gets created
18 | public static string ConfigurationAccessGroupName = "DncEngConfigurationUsers";
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.Configuration.Extensions/MappedJsonConfigurationSource.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using Microsoft.Extensions.Configuration;
6 | using Microsoft.Extensions.Configuration.Json;
7 |
8 | namespace Microsoft.DncEng.Configuration.Extensions;
9 |
10 | public class MappedJsonConfigurationSource : JsonConfigurationSource
11 | {
12 | private readonly TimeSpan _reloadTime;
13 | private readonly Func _mapFunc;
14 | private readonly IServiceProvider _serviceProvider;
15 |
16 | public MappedJsonConfigurationSource(
17 | TimeSpan reloadTime,
18 | Func mapFunc,
19 | IServiceProvider serviceProvider)
20 | {
21 | _reloadTime = reloadTime;
22 | _mapFunc = mapFunc;
23 | _serviceProvider = serviceProvider;
24 | }
25 |
26 | public override IConfigurationProvider Build(IConfigurationBuilder builder)
27 | {
28 | EnsureDefaults(builder);
29 | return new MappedJsonConfigurationProvider(this, _reloadTime, _mapFunc, _serviceProvider);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.Configuration.Extensions/Microsoft.DncEng.Configuration.Extensions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;net8.0
5 |
6 | true
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DncEng.Configuration.Extensions/RegexConfigMapper.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using System.Text.RegularExpressions;
6 |
7 | namespace Microsoft.DncEng.Configuration.Extensions;
8 |
9 | public static class RegexConfigMapper
10 | {
11 | public static Func Create(Regex regex, Func keyMapper)
12 | {
13 | return value =>
14 | {
15 | if (value == null)
16 | return null;
17 |
18 | return regex.Replace(value, match =>
19 | {
20 | string key = match.Groups["key"].Value;
21 | return keyMapper(key);
22 | });
23 | };
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Authentication.Algorithms/Microsoft.DotNet.Authentication.Algorithms.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | false
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/GitHubApplicationClientFactory.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Threading.Tasks;
5 | using Octokit;
6 |
7 | namespace Microsoft.DotNet.GitHub.Authentication;
8 |
9 | public class GitHubApplicationClientFactory : IGitHubApplicationClientFactory
10 | {
11 | private readonly IGitHubClientFactory _clientFactory;
12 | private readonly IGitHubTokenProvider _tokenProvider;
13 |
14 | public GitHubApplicationClientFactory(IGitHubClientFactory clientFactory, IGitHubTokenProvider tokenProvider)
15 | {
16 | _clientFactory = clientFactory;
17 | _tokenProvider = tokenProvider;
18 | }
19 |
20 | public async Task CreateGitHubClientAsync(string owner, string repo)
21 | {
22 | return _clientFactory.CreateGitHubClient(await _tokenProvider.GetTokenForRepository(owner, repo));
23 | }
24 |
25 | public IGitHubClient CreateGitHubAppClient()
26 | {
27 | return _clientFactory.CreateGitHubClient(_tokenProvider.GetTokenForApp(), AuthenticationType.Bearer);
28 | }
29 |
30 | public IGitHubClient CreateGitHubAppClient(string name)
31 | {
32 | return _clientFactory.CreateGitHubClient(_tokenProvider.GetTokenForApp(name), AuthenticationType.Bearer);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/GitHubClientFactory.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using Microsoft.Extensions.Options;
5 | using Octokit;
6 | using System;
7 |
8 | namespace Microsoft.DotNet.GitHub.Authentication;
9 |
10 | public class GitHubClientFactory : IGitHubClientFactory
11 | {
12 | private readonly IOptionsMonitor _githubClientOptions;
13 |
14 | public GitHubClientFactory(IOptionsMonitor githubClientOptions)
15 | {
16 | _githubClientOptions = githubClientOptions;
17 | }
18 |
19 | public GitHubClientOptions Options => _githubClientOptions.CurrentValue;
20 |
21 | public IGitHubClient CreateGitHubClient(string token)
22 | {
23 | return CreateGitHubClient(token, AuthenticationType.Oauth);
24 | }
25 |
26 | public IGitHubClient CreateGitHubClient(string token, AuthenticationType type)
27 | {
28 | if (Options?.ProductHeader == null)
29 | {
30 | throw new InvalidOperationException($"A {nameof(GitHubClientOptions.ProductHeader)} is required for a GitHub client, but the value in {nameof(GitHubClientOptions)} is null.");
31 | }
32 |
33 | var client = new GitHubClient(Options.ProductHeader);
34 |
35 | if (!string.IsNullOrEmpty(token))
36 | {
37 | client.Credentials = new Credentials(token, type);
38 | }
39 |
40 | return client;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/GitHubClientOptions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using Octokit;
5 |
6 | namespace Microsoft.DotNet.GitHub.Authentication;
7 |
8 | public class GitHubClientOptions
9 | {
10 | public ProductHeaderValue ProductHeader { get; set; }
11 | public string[] AllowOrgs { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/GitHubHelper.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.GitHub.Authentication;
5 |
6 | public static class GitHubHelper
7 | {
8 | public static string GetRepositoryUrl(string organization, string repository) => $"https://github.com/{organization}/{repository}";
9 | }
10 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/GitHubTokenProviderOptions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.GitHub.Authentication;
5 |
6 | public class GitHubTokenProviderOptions
7 | {
8 | public string PrivateKey { get; set; }
9 | public int GitHubAppId { get; set; }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/IGitHubAppTokenProvider.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.GitHub.Authentication;
5 |
6 | public interface IGitHubAppTokenProvider
7 | {
8 | string GetAppToken();
9 |
10 | ///
11 | /// Get an app token using the configuration that corresponds to the logical name specified by .
12 | ///
13 | string GetAppToken(string name);
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/IGitHubApplicationClientFactory.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Threading.Tasks;
5 | using Octokit;
6 |
7 | namespace Microsoft.DotNet.GitHub.Authentication;
8 |
9 | public interface IGitHubApplicationClientFactory
10 | {
11 | Task CreateGitHubClientAsync(string owner, string repo);
12 | IGitHubClient CreateGitHubAppClient();
13 |
14 | ///
15 | /// Creates a GitHub App client configured the configuration that corresponds to the logical name specified by .
16 | ///
17 | IGitHubClient CreateGitHubAppClient(string name);
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/IGitHubClientFactory.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Net.Http;
5 | using Octokit;
6 |
7 | namespace Microsoft.DotNet.GitHub.Authentication;
8 |
9 | public interface IGitHubClientFactory
10 | {
11 | IGitHubClient CreateGitHubClient(string token);
12 | IGitHubClient CreateGitHubClient(string token, AuthenticationType type);
13 | }
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/IGitHubTokenProvider.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Threading.Tasks;
5 |
6 | namespace Microsoft.DotNet.GitHub.Authentication;
7 |
8 | public interface IGitHubTokenProvider
9 | {
10 | Task GetTokenForInstallationAsync(long installationId);
11 | Task GetTokenForRepository(string repositoryUrl);
12 | string GetTokenForApp();
13 | string GetTokenForApp(string name);
14 | void InvalidateTokenCacheAsync(long installationId);
15 | }
16 |
17 | public static class GitHubTokenProviderExtensions
18 | {
19 | public static Task GetTokenForRepository(this IGitHubTokenProvider provider, string organization, string repository)
20 | {
21 | return provider.GetTokenForRepository(GitHubHelper.GetRepositoryUrl(organization, repository));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/InstallationLookup.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Threading.Tasks;
5 |
6 | namespace Microsoft.DotNet.GitHub.Authentication;
7 |
8 | public interface IInstallationLookup
9 | {
10 | Task GetInstallationId(string repositoryUrl);
11 | Task IsOrganizationSupported(string org);
12 | }
13 |
14 | public static class InstallationLookup
15 | {
16 | public static Task GetInstallationId(this IInstallationLookup lookup, string organization, string repository)
17 | {
18 | return lookup.GetInstallationId(GitHubHelper.GetRepositoryUrl(organization, repository));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/Microsoft.DotNet.GitHub.Authentication.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | false
6 | true
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.GitHub.Authentication/ServiceCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using Microsoft.DotNet.GitHub.Authentication;
5 | using Microsoft.Extensions.DependencyInjection;
6 |
7 | namespace Microsoft.DotNet.GitHub.Authentication;
8 |
9 | public static class ServiceCollectionExtensions
10 | {
11 | public static IServiceCollection AddGitHubTokenProvider(this IServiceCollection services)
12 | {
13 | return services
14 | .AddSingleton()
15 | .AddSingleton();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.AkaMsLinks/Microsoft.DotNet.Internal.AkaMsLinks.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 | false
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.AkaMsLinks/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Runtime.CompilerServices;
5 |
6 | [assembly: InternalsVisibleTo("Microsoft.DotNet.Internal.AkaMsLinks.Tests")]
7 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.DependencyInjection.Testing/Microsoft.DotNet.Internal.DependencyInjection.Testing.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.DependencyInjection/IClientFactory.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.Internal.DependencyInjection;
5 |
6 | public interface IClientFactory
7 | {
8 | Reference GetClient(string name);
9 | }
10 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.DependencyInjection/Microsoft.DotNet.Internal.DependencyInjection.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.DependencyInjection/RefCountedObject.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using System.Threading;
6 |
7 | namespace Microsoft.DotNet.Internal.DependencyInjection;
8 |
9 | public sealed class RefCountedObject
10 | {
11 | private int _refCount;
12 |
13 | public RefCountedObject(T value)
14 | {
15 | _refCount = 0;
16 | Value = value;
17 | }
18 |
19 | public T Value { get; }
20 |
21 | public void AddRef()
22 | {
23 | Interlocked.Increment(ref _refCount);
24 | }
25 |
26 | public void Release()
27 | {
28 | var newRefCount = Interlocked.Decrement(ref _refCount);
29 | if (newRefCount == 0)
30 | {
31 | if (Value is IDisposable disposable)
32 | {
33 | disposable.Dispose();
34 | }
35 | else if (Value is IAsyncDisposable asyncDisposable)
36 | {
37 | asyncDisposable.DisposeAsync().AsTask().GetAwaiter().GetResult();
38 | }
39 | }
40 | }
41 | }
42 |
43 | public struct Reference : IDisposable
44 | {
45 | private readonly RefCountedObject _referencedObject;
46 |
47 | public Reference(RefCountedObject value)
48 | {
49 | value.AddRef();
50 | _referencedObject = value;
51 | }
52 |
53 | public T Value => _referencedObject.Value;
54 |
55 | public void Dispose()
56 | {
57 | _referencedObject.Release();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.DependencyInjection/ResolvingLazy.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using Microsoft.Extensions.DependencyInjection;
6 |
7 | namespace Microsoft.DotNet.Internal.DependencyInjection;
8 |
9 | internal class ResolvingLazy : Lazy
10 | {
11 | public ResolvingLazy(IServiceProvider services) : base(services.GetRequiredService)
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.DependencyInjection/SingleClientFactory.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.Internal.DependencyInjection;
5 |
6 | public class SingleClientFactory : IClientFactory
7 | {
8 | private readonly RefCountedObject _client;
9 |
10 | public SingleClientFactory(T client)
11 | {
12 | _client = new RefCountedObject(client);
13 | }
14 |
15 | public Reference GetClient(string name)
16 | {
17 | return new Reference(_client);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/AzureTableHealthReportingOptions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.Internal.Health;
5 |
6 | public class AzureTableHealthReportingOptions
7 | {
8 | public const string HealthReportSettingsSection = "HealthReportSettings";
9 |
10 | public string StorageAccountTablesUri { get; set; }
11 | public string TableName { get; set; }
12 | public string ManagedIdentityClientId { get; set; }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/HealthReport.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.DotNet.Internal.Health;
7 |
8 | public class HealthReport
9 | {
10 | public HealthReport(string serviceName, string instance, string subStatusName, HealthStatus health, string message, DateTimeOffset asOf)
11 | {
12 | Service= serviceName;
13 | Instance = instance;
14 | SubStatus = subStatusName;
15 | Health = health;
16 | Message = message;
17 | AsOf = asOf;
18 | }
19 |
20 | public string Service { get; }
21 | public string Instance { get; }
22 | public string SubStatus{ get; }
23 | public HealthStatus Health { get; }
24 | public string Message { get; }
25 | public DateTimeOffset AsOf { get; }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/HealthReportTableEntity.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using Azure;
6 | using Azure.Data.Tables;
7 |
8 | namespace Microsoft.DotNet.Internal.Health;
9 | internal class HealthReportTableEntity : ITableEntity
10 | {
11 | public string PartitionKey { get; set; }
12 | public string RowKey { get; set; }
13 | public DateTimeOffset? Timestamp { get; set; }
14 | public ETag ETag { get; set; }
15 | public HealthStatus Status { get; set; }
16 | public string Message { get; set; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/HealthStatus.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.Internal.Health;
5 |
6 | public enum HealthStatus
7 | {
8 | Invalid = 0,
9 | Healthy,
10 | Warning,
11 | Error,
12 |
13 | Unknown,
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/IExternalHealthReporter.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Collections.Generic;
5 | using System.Threading.Tasks;
6 |
7 | namespace Microsoft.DotNet.Internal.Health;
8 |
9 | public interface IExternalHealthReporter : IHealthReporter
10 | {
11 | Task> GetServiceStatusAsync();
12 | }
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/IHealthReportProvider.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Collections.Generic;
5 | using System.Threading.Tasks;
6 |
7 | namespace Microsoft.DotNet.Internal.Health;
8 |
9 | public interface IHealthReportProvider
10 | {
11 | Task UpdateStatusAsync(string serviceName, string instance, string subStatusName, HealthStatus status, string message);
12 | Task> GetAllStatusAsync(string serviceName);
13 | }
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/IHealthReporter.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Threading.Tasks;
5 |
6 | namespace Microsoft.DotNet.Internal.Health;
7 |
8 | public interface IHealthReporter
9 | {
10 | Task UpdateStatusAsync(string subStatus, HealthStatus status, string message);
11 | }
12 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/IHealthReporterFactory.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.Internal.Health;
5 |
6 | public interface IHealthReporterFactory
7 | {
8 | IServiceHealthReporter ForService();
9 | IInstanceHealthReporter ForInstance();
10 | IExternalHealthReporter ForExternal(string serviceName);
11 | }
12 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/IInstanceAccessor.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.Internal.Health;
5 |
6 | public interface IInstanceAccessor
7 | {
8 | string GetCurrentInstanceName();
9 | }
10 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/IInstanceHealthReporter.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using JetBrains.Annotations;
5 |
6 | namespace Microsoft.DotNet.Internal.Health;
7 |
8 | public interface IInstanceHealthReporter<[UsedImplicitly] TService> : IHealthReporter
9 | {
10 | }
11 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/IServiceHealthReporter.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using JetBrains.Annotations;
5 |
6 | namespace Microsoft.DotNet.Internal.Health;
7 |
8 | public interface IServiceHealthReporter<[UsedImplicitly] T> : IHealthReporter
9 | {
10 | }
11 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/InstanceAccessor.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Fabric;
5 |
6 | namespace Microsoft.DotNet.Internal.Health;
7 |
8 | public class InstanceAccessor : IInstanceAccessor
9 | {
10 | private readonly IInstanceAccessor _impl;
11 |
12 | public InstanceAccessor(ServiceContext context)
13 | {
14 | _impl = new ServiceFabricInstanceAccessor(context);
15 | }
16 |
17 | public InstanceAccessor()
18 | {
19 | _impl = new MachineNameInstanceAccessor();
20 | }
21 |
22 | public string GetCurrentInstanceName()
23 | {
24 | return _impl.GetCurrentInstanceName();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/MachineNameInstanceAccessor.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.DotNet.Internal.Health;
7 |
8 | public class MachineNameInstanceAccessor : IInstanceAccessor
9 | {
10 | public string GetCurrentInstanceName()
11 | {
12 | return Environment.MachineName;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/Microsoft.DotNet.Internal.Health.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | true
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Health/ServiceFabricInstanceAccessor.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Fabric;
5 |
6 | namespace Microsoft.DotNet.Internal.Health;
7 |
8 | public class ServiceFabricInstanceAccessor : IInstanceAccessor
9 | {
10 | private readonly ServiceContext _context;
11 |
12 | public ServiceFabricInstanceAccessor(ServiceContext context)
13 | {
14 | _context = context;
15 | }
16 |
17 | public string GetCurrentInstanceName()
18 | {
19 | return _context.ReplicaOrInstanceId.ToString();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.SymbolHelper/Microsoft.DotNet.Internal.SymbolHelper.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | true
6 | true
7 |
8 |
9 |
10 |
12 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.SymbolHelper/SymbolRequestHelpers.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | #nullable enable
4 |
5 | using System;
6 | using Microsoft.SymbolStore;
7 |
8 | namespace Microsoft.DotNet.Internal.SymbolHelper;
9 |
10 | internal static class SymbolRequestHelpers
11 | {
12 | internal static void ValidateRequestName(string? name, ITracer logger)
13 | {
14 | if (name is null or "")
15 | {
16 | logger.Error("Can't create a request with an empty name.");
17 | throw new ArgumentException("Name must be specified", nameof(name));
18 | }
19 |
20 | if (name.Contains('+'))
21 | {
22 | // This is a restriction of the symbol request pipeline and not of symbol.exe
23 | // we share this between upload and promotion to prevent downstream issues.
24 | logger.Error("Requests can't contain '+' in their name");
25 | throw new ArgumentException("Request can't contain a '+'", nameof(name));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.DependencyInjection.Abstractions/ConfigureAllParametersAttribute.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.DotNet.Internal.Testing.DependencyInjection.Abstractions;
7 |
8 | [AttributeUsage(AttributeTargets.Method)]
9 | public class ConfigureAllParametersAttribute : Attribute
10 | {
11 | }
12 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.DependencyInjection.Abstractions/Microsoft.DotNet.Internal.Testing.DependencyInjection.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | false
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.DependencyInjection.Abstractions/TestDependencyInjectionSetupAttribute.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using JetBrains.Annotations;
6 |
7 | namespace Microsoft.DotNet.Internal.Testing.DependencyInjection.Abstractions;
8 |
9 | [AttributeUsage(AttributeTargets.Class)]
10 | [MeansImplicitUse(ImplicitUseKindFlags.InstantiatedWithFixedConstructorSignature, ImplicitUseTargetFlags.WithMembers)]
11 | public class TestDependencyInjectionSetupAttribute : Attribute
12 | {
13 | }
14 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen/ConfigParameters.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | namespace Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen;
5 |
6 | internal class ConfigParameters
7 | {
8 | public ConfigParameters(string name, string type, bool isNullable)
9 | {
10 | Name = name;
11 | Type = type;
12 | IsNullable = isNullable;
13 | }
14 |
15 | public string Name { get; }
16 | public string Type { get; }
17 | public bool IsNullable { get; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen/Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netstandard2.0
4 |
5 | true
6 | false
7 | false
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen/TestConfigDeclaration.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Collections.Generic;
5 | using Microsoft.CodeAnalysis;
6 | using Microsoft.CodeAnalysis.CSharp.Syntax;
7 |
8 | namespace Microsoft.DotNet.Internal.Testing.DependencyInjectionCodeGen;
9 |
10 | internal class TestConfigDeclaration
11 | {
12 | public TestConfigDeclaration(
13 | string namespaceName,
14 | string parentName,
15 | ISymbol declaringClassSymbol,
16 | ClassDeclarationSyntax classDeclarationSyntax)
17 | {
18 | NamespaceName = namespaceName;
19 | ParentName = parentName;
20 | DeclaringClassSymbol = declaringClassSymbol;
21 | ClassDeclarationSyntax = classDeclarationSyntax;
22 | ConfigClassName = declaringClassSymbol.Name;
23 | }
24 |
25 | public string NamespaceName { get; }
26 | public string ParentName { get; }
27 | public ISymbol DeclaringClassSymbol { get; }
28 | public ClassDeclarationSyntax ClassDeclarationSyntax { get; }
29 | public string ConfigClassName { get; }
30 | public List Methods { get; } = new List();
31 | }
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.Utility/Microsoft.DotNet.Internal.Testing.Utility.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.Utility/NUnitLogger.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 | using Microsoft.Extensions.Logging;
6 | using NUnit.Framework;
7 |
8 | namespace Microsoft.DotNet.Internal.Testing.Utility;
9 |
10 | public class NUnitLogger : ILogger, ILoggerProvider
11 | {
12 | public void Dispose()
13 | {
14 | }
15 |
16 | public ILogger CreateLogger(string categoryName)
17 | {
18 | return this;
19 | }
20 |
21 | public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
22 | {
23 | TestContext.WriteLine($"{logLevel} : {eventId} : {formatter(state, exception)}");
24 | }
25 |
26 | public bool IsEnabled(LogLevel logLevel)
27 | {
28 | return true;
29 | }
30 |
31 | public IDisposable BeginScope(TState state)
32 | {
33 | return this;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.Utility/StringRegexAssertionExtensions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Text.RegularExpressions;
5 | using AwesomeAssertions;
6 | using AwesomeAssertions.Primitives;
7 |
8 | namespace Microsoft.DotNet.Internal.Testing.Utility;
9 |
10 | public static class StringRegexAssertionExtensions{
11 | public static AndConstraint MatchRegex(
12 | this StringAssertions stringAssertion,
13 | Regex regularExpression,
14 | string because = "",
15 | params object[] becauseArgs
16 | )
17 | {
18 | stringAssertion.Subject.Should().NotBeNull(
19 | $"Expected string to match regex {regularExpression}{(because != string.Empty ? " because " + because : string.Empty)}, but it was .");
20 |
21 | regularExpression.IsMatch(stringAssertion.Subject).Should().BeTrue(
22 | $"Expected string to match regex {regularExpression}{(because != string.Empty ? " because " + because : string.Empty)}, but {stringAssertion.Subject} does not match.");
23 |
24 | return new AndConstraint(stringAssertion);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Internal.Testing.Utility/TestClock.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Microsoft.DotNet.Internal.Testing.Utility;
7 |
8 | public class TestClock : TimeProvider, Extensions.Internal.ISystemClock
9 | {
10 | public static readonly DateTime BaseTime = DateTime.Parse("2001-02-03T16:05:06Z");
11 | public DateTimeOffset UtcNow { get; set; } = BaseTime;
12 | }
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Kusto/IKustoClientProvider.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 |
4 | using System.Threading.Tasks;
5 | using System.Data;
6 | using System.Collections.Generic;
7 |
8 | namespace Microsoft.DotNet.Kusto;
9 |
10 | public interface IKustoClientProvider
11 | {
12 | Task ExecuteKustoQueryAsync(KustoQuery query);
13 |
14 | IAsyncEnumerable