This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the initial project for Owners2AzureSearch (#497)
Progress on NuGet/NuGetGallery#6475
- Loading branch information
1 parent
c6a095e
commit 17e4640
Showing
18 changed files
with
240 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/NuGet.Jobs.Catalog2AzureSearch/Scripts/NuGet.Jobs.Catalog2AzureSearch.cmd
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
src/NuGet.Jobs.Catalog2AzureSearch/Scripts/RunE2ETests.ps1
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Net; | ||
using System.Threading.Tasks; | ||
using Autofac; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using NuGet.Services.AzureSearch; | ||
|
||
namespace NuGet.Jobs | ||
{ | ||
public class Job : JsonConfigurationJob | ||
{ | ||
private const string ConfigurationSectionName = "Owners2AzureSearch"; | ||
|
||
public override async Task Run() | ||
{ | ||
ServicePointManager.DefaultConnectionLimit = 64; | ||
ServicePointManager.MaxServicePointIdleTime = 10000; | ||
|
||
await Task.Yield(); | ||
} | ||
|
||
protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder) | ||
{ | ||
containerBuilder.AddAzureSearch(); | ||
} | ||
|
||
protected override void ConfigureJobServices(IServiceCollection services, IConfigurationRoot configurationRoot) | ||
{ | ||
services.AddAzureSearch(); | ||
|
||
services.Configure<AzureSearchJobConfiguration>(configurationRoot.GetSection(ConfigurationSectionName)); | ||
services.Configure<AzureSearchConfiguration>(configurationRoot.GetSection(ConfigurationSectionName)); | ||
} | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
src/NuGet.Jobs.Owners2AzureSearch/NuGet.Jobs.Owners2AzureSearch.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>NuGet.Jobs</RootNamespace> | ||
<AssemblyName>NuGet.Jobs.Owners2AzureSearch</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.CSharp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Job.cs" /> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.*.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="NuGet.Jobs.Owners2AzureSearch.nuspec" /> | ||
<None Include="Scripts\Functions.ps1" /> | ||
<None Include="Scripts\PostDeploy.ps1" /> | ||
<None Include="Scripts\PreDeploy.ps1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="MicroBuild.Core"> | ||
<Version>0.3.0</Version> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\NuGet.Services.AzureSearch\NuGet.Services.AzureSearch.csproj"> | ||
<Project>{1a53fe3d-8041-4773-942f-d73aef5b82b2}</Project> | ||
<Name>NuGet.Services.AzureSearch</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Scripts\nssm.exe" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<PropertyGroup> | ||
<SignPath>..\..\build</SignPath> | ||
<SignPath Condition="'$(BUILD_SOURCESDIRECTORY)' != ''">$(BUILD_SOURCESDIRECTORY)\build</SignPath> | ||
<SignPath Condition="'$(NuGetBuildPath)' != ''">$(NuGetBuildPath)</SignPath> | ||
<SignType Condition="'$(SignType)' == ''">none</SignType> | ||
</PropertyGroup> | ||
<Import Project="$(SignPath)\sign.targets" Condition="Exists('$(SignPath)\sign.targets')" /> | ||
<Import Project="$(SignPath)\sign.microbuild.targets" Condition="Exists('$(SignPath)\sign.microbuild.targets')" /> | ||
<Import Project="$(SignPath)\sign.scripts.targets" Condition="Exists('$(SignPath)\sign.scripts.targets')" /> | ||
<Import Project="..\..\sign.thirdparty.targets" /> | ||
</Project> |
16 changes: 16 additions & 0 deletions
16
src/NuGet.Jobs.Owners2AzureSearch/NuGet.Jobs.Owners2AzureSearch.nuspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<package> | ||
<metadata> | ||
<id>NuGet.Jobs.Owners2AzureSearch</id> | ||
<version>$version$</version> | ||
<authors>.NET Foundation</authors> | ||
<owners>.NET Foundation</owners> | ||
<description>NuGet.Jobs.Owners2AzureSearch</description> | ||
<copyright>Copyright .NET Foundation</copyright> | ||
</metadata> | ||
<files> | ||
<file src="bin\$configuration$\*.*" target="bin" /> | ||
<file src="Scripts\*.ps1" /> | ||
<file src="Scripts\nssm.exe" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace NuGet.Jobs | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
var job = new Job(); | ||
JobRunner.Run(job, args).GetAwaiter().GetResult(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("NuGet.Jobs.Owners2AzureSearch")] | ||
[assembly: ComVisible(false)] | ||
[assembly: Guid("f81a7ca6-97d4-4958-a9c1-ff94fca283cb")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Function Uninstall-NuGetService() { | ||
Param ([string]$ServiceName) | ||
|
||
if (Get-Service $ServiceName -ErrorAction SilentlyContinue) | ||
{ | ||
Write-Host Removing service $ServiceName... | ||
Stop-Service $ServiceName -Force | ||
sc.exe delete $ServiceName | ||
Write-Host Removed service $ServiceName. | ||
} else { | ||
Write-Host Skipping removal of service $ServiceName - no such service exists. | ||
} | ||
} | ||
|
||
Function Install-NuGetService() { | ||
Param ([string]$ServiceName, [string]$ServiceTitle, [string]$ScriptToRun) | ||
|
||
Write-Host Installing service $ServiceName... | ||
|
||
$installService = "nssm install $ServiceName $ScriptToRun" | ||
cmd /C $installService | ||
|
||
Set-Service -Name $ServiceName -DisplayName "$ServiceTitle - $ServiceName" -Description "Runs $ServiceTitle." -StartupType Automatic | ||
sc.exe failure $ServiceName reset= 30 actions= restart/5000 | ||
|
||
# Run service | ||
net start $ServiceName | ||
|
||
Write-Host Installed service $ServiceName. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
. .\Functions.ps1 | ||
|
||
$jobsToInstall = $OctopusParameters["Jobs.ServiceNames"].Split("{,}") | ||
|
||
Write-Host Installing services... | ||
|
||
$currentDirectory = [string](Get-Location) | ||
|
||
$jobsToInstall.Split("{;}") | %{ | ||
$serviceName = $_ | ||
$serviceTitle = $OctopusParameters["Jobs.$serviceName.Title"] | ||
$scriptToRun = $OctopusParameters["Jobs.$serviceName.Script"] | ||
$scriptToRun = "$currentDirectory\$scriptToRun" | ||
|
||
Install-NuGetService -ServiceName $serviceName -ServiceTitle $serviceTitle -ScriptToRun $scriptToRun | ||
} | ||
|
||
Write-Host Installed services. |
Oops, something went wrong.