Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
/ NuGet.Jobs Public archive

Commit

Permalink
Add the initial project for Owners2AzureSearch (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelverhagen committed Apr 8, 2019
1 parent c6a095e commit 17e4640
Show file tree
Hide file tree
Showing 18 changed files with 240 additions and 74 deletions.
19 changes: 17 additions & 2 deletions NuGet.Services.Metadata.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26719.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.28804.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{C86C6DEE-84E1-4E4E-8868-6755D7A8E0E4}"
EndProject
Expand Down Expand Up @@ -56,6 +56,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuGet.Services.SearchServic
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuGet.Services.SearchService.Tests", "tests\NuGet.Services.SearchService.Tests\NuGet.Services.SearchService.Tests.csproj", "{F009209D-A663-45E1-87E8-158569A0F097}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuGet.Jobs.Owners2AzureSearch", "src\NuGet.Jobs.Owners2AzureSearch\NuGet.Jobs.Owners2AzureSearch.csproj", "{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -302,6 +304,18 @@ Global
{F009209D-A663-45E1-87E8-158569A0F097}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F009209D-A663-45E1-87E8-158569A0F097}.Release|x64.ActiveCfg = Release|Any CPU
{F009209D-A663-45E1-87E8-158569A0F097}.Release|x64.Build.0 = Release|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Debug|x64.ActiveCfg = Debug|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Debug|x64.Build.0 = Debug|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Release|Any CPU.Build.0 = Release|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Release|x64.ActiveCfg = Release|Any CPU
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -327,6 +341,7 @@ Global
{1F3BC053-796C-4A35-88F4-955A0F142197} = {F1C83FD9-A498-483E-ADFA-B55D82A14965}
{DD089AB9-6AB3-4ACA-8D63-C95A7935B2A7} = {97E23323-BA7A-48F0-A578-858B82B6D8FB}
{F009209D-A663-45E1-87E8-158569A0F097} = {F1C83FD9-A498-483E-ADFA-B55D82A14965}
{F81A7CA6-97D4-4958-A9C1-FF94FCA283CB} = {C86C6DEE-84E1-4E4E-8868-6755D7A8E0E4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D3AB83E9-02B4-4FFA-A2D0-637F0B97E626}
Expand Down
4 changes: 3 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Invoke-BuildStep 'Set version metadata in AssemblyInfo.cs' {
"src\NuGet.Services.AzureSearch\Properties\AssemblyInfo.g.cs", `
"src\NuGet.Jobs.Db2AzureSearch\Properties\AssemblyInfo.g.cs", `
"src\NuGet.Jobs.Catalog2AzureSearch\Properties\AssemblyInfo.g.cs", `
"src\NuGet.Jobs.Owners2AzureSearch\Properties\AssemblyInfo.g.cs", `
"src\NuGet.Services.SearchService\Properties\AssemblyInfo.g.cs"

Foreach ($assemblyInfo in $assemblyInfos) {
Expand Down Expand Up @@ -121,7 +122,8 @@ Invoke-BuildStep 'Creating artifacts' {
"src\Ng\MonitoringProcessor.nuspec", `
"src\Ng\Ng.Operations.nuspec", `
"src\NuGet.Jobs.Db2AzureSearch\NuGet.Jobs.Db2AzureSearch.nuspec", `
"src\NuGet.Jobs.Catalog2AzureSearch\NuGet.Jobs.Catalog2AzureSearch.nuspec"
"src\NuGet.Jobs.Catalog2AzureSearch\NuGet.Jobs.Catalog2AzureSearch.nuspec", `
"src\NuGet.Jobs.Owners2AzureSearch\NuGet.Jobs.Owners2AzureSearch.nuspec"

$nuspecPackages | ForEach-Object {
New-Package (Join-Path $PSScriptRoot $_) -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@
<None Include="App.config" />
<None Include="NuGet.Jobs.Catalog2AzureSearch.nuspec" />
<None Include="Scripts\Functions.ps1" />
<None Include="Scripts\NuGet.Jobs.Catalog2AzureSearch.cmd" />
<None Include="Scripts\PostDeploy.ps1" />
<None Include="Scripts\PreDeploy.ps1" />
<None Include="Scripts\RunE2ETests.ps1" />
<None Include="Settings\octopus.json" />
<None Include="Scripts\nssm.exe" />
</ItemGroup>
Expand Down Expand Up @@ -83,9 +81,6 @@
</PropertyGroup>
<Import Project="$(SignPath)\sign.targets" Condition="Exists('$(SignPath)\sign.targets')" />
<Import Project="$(SignPath)\sign.microbuild.targets" Condition="Exists('$(SignPath)\sign.microbuild.targets')" />
<ItemGroup>
<PowerShellScriptsToSign Include="RunE2ETests.ps1" />
</ItemGroup>
<Import Project="$(SignPath)\sign.scripts.targets" Condition="Exists('$(SignPath)\sign.scripts.targets')" />
<Import Project="..\..\sign.thirdparty.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
</metadata>
<files>
<file src="bin\$configuration$\*.*" target="bin" />
<file src="Scripts\*.cmd" />
<file src="Scripts\*.ps1" />
<file src="Scripts\nssm.exe" />
<file src="Settings\*.json" target="bin" />
</files>
</package>

This file was deleted.

47 changes: 0 additions & 47 deletions src/NuGet.Jobs.Catalog2AzureSearch/Scripts/RunE2ETests.ps1

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
<ItemGroup>
<None Include="App.config" />
<None Include="NuGet.Jobs.Db2AzureSearch.nuspec" />
<None Include="Scripts\NuGet.Jobs.Db2AzureSearch.cmd" />
<None Include="Scripts\PostDeploy.ps1" />
<None Include="Settings\octopus.json" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
<files>
<file src="bin\$configuration$\*.*" target="bin" />
<file src="Scripts\*.ps1" />
<file src="Settings\*.json" target="bin" />
</files>
</package>
6 changes: 6 additions & 0 deletions src/NuGet.Jobs.Owners2AzureSearch/App.config
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>
38 changes: 38 additions & 0 deletions src/NuGet.Jobs.Owners2AzureSearch/Job.cs
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));
}
}
}
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>
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>
14 changes: 14 additions & 0 deletions src/NuGet.Jobs.Owners2AzureSearch/Program.cs
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();
}
}
}
9 changes: 9 additions & 0 deletions src/NuGet.Jobs.Owners2AzureSearch/Properties/AssemblyInfo.cs
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")]
30 changes: 30 additions & 0 deletions src/NuGet.Jobs.Owners2AzureSearch/Scripts/Functions.ps1
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.
}
18 changes: 18 additions & 0 deletions src/NuGet.Jobs.Owners2AzureSearch/Scripts/PostDeploy.ps1
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.
Loading

0 comments on commit 17e4640

Please sign in to comment.