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

Move JsonConfigurationJob to Jobs.Common / Migrate ArchivePackages to JsonConfig #515

Merged
merged 5 commits into from
Aug 7, 2018

Conversation

chenriksson
Copy link
Member

@chenriksson chenriksson commented Aug 3, 2018

Part of https://github.com/NuGet/Engineering/issues/1560. Depends on #505

Includes the following:

  • Moves bulk of JsonConfigurationJob into NuGet.Jobs.Common, for use by legacy jobs
  • Updates validation jobs use db helpers from Jobs.Common helpers for NuGet.Services.Sql #505
    • JsonConfigurationJob registers databases when GalleryDbConfiguration or ValidationDbConfiguration is found
  • Updates ArchivePackages.Job to descend from JsonConfigurationJob
    • Requires new "Configuration" and "GalleryDatabaseAddress" Octopus config. Will remove old config only after these changes RI'd to master and deployed to prod.

Testing should include the following jobs:

  • ArchivePackages (Verified on DEV)
  • Revalidate
  • ProcessSignature
  • RebootSearchInstance
  • SubscriptionProcessor
  • RevalidateCertificate


Source = CloudStorageAccount.Parse(
JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.Source));
Configuration = _serviceProvider.GetRequiredService<InitializationConfiguration>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All command-line options for legacy jobs will be moved to a custom InitializationConfiguration, from json config.

public string Version { get; set; }
public string Hash { get; set; }
public DateTime? LastEdited { get; set; }
public DateTime? Published { get; set; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup - just moving classes into separate source files.

@@ -75,16 +82,14 @@
<PackageReference Include="Newtonsoft.Json">
<Version>9.0.1</Version>
</PackageReference>
<PackageReference Include="NuGet.Services.Sql">
<Version>2.27.0</Version>
</PackageReference>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need direct dependency from Jobs.Common now.

@@ -7,7 +7,7 @@ cd bin

title #{Jobs.archivepackages.Title}

start /w archivepackages.exe -VaultName "#{Deployment.Azure.KeyVault.VaultName}" -ClientId "#{Deployment.Azure.KeyVault.ClientId}" -CertificateThumbprint "#{Deployment.Azure.KeyVault.CertificateThumbprint}" -PackageDatabase "#{Jobs.archivepackages.PackageDatabase}" -Source "#{Jobs.archivepackages.Source}" -PrimaryDestination "#{Jobs.archivepackages.PrimaryDestination}" -SecondaryDestination "#{Jobs.archivepackages.SecondaryDestination}" -Sleep "#{Jobs.archivepackages.Sleep}" -InstrumentationKey "#{Jobs.archivepackages.ApplicationInsightsInstrumentationKey}"
start /w archivepackages.exe -Configuration "#{Jobs.archivepackages.Configuration}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add "-Configuration" octopus config now, and remove old config after RI and prod deployments are complete.


namespace NuGet.Jobs.Validation
namespace NuGet.Jobs
{
public abstract class JsonConfigurationJob : JobBase
Copy link
Member Author

@chenriksson chenriksson Aug 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old JsonConfigurationJob is now split into Jobs.Common > JsonConfigurationJob and Validation.Common.Job > ValidationJobBase, based on needs of legacy / validation jobs.

"KeyVault_ValidateCertificate": true,
"KeyVault_StoreName": "My",
"KeyVault_StoreLocation": "LocalMachine"
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job config could eventually move to NuGetDeployment, as we do with Orchestrator. For now, I don't want to modify build / deployment infrastructure.

@chenriksson chenriksson changed the title Move JsonConfigurationJob to Jobs.Common Move JsonConfigurationJob to Jobs.Common / Migrate ArchivePackages to JsonConfig Aug 3, 2018
@@ -7,7 +7,7 @@ cd bin

title #{Jobs.archivepackages.Title}

start /w archivepackages.exe -VaultName "#{Deployment.Azure.KeyVault.VaultName}" -ClientId "#{Deployment.Azure.KeyVault.ClientId}" -CertificateThumbprint "#{Deployment.Azure.KeyVault.CertificateThumbprint}" -PackageDatabase "#{Jobs.archivepackages.PackageDatabase}" -Source "#{Jobs.archivepackages.Source}" -PrimaryDestination "#{Jobs.archivepackages.PrimaryDestination}" -SecondaryDestination "#{Jobs.archivepackages.SecondaryDestination}" -Sleep "#{Jobs.archivepackages.Sleep}" -InstrumentationKey "#{Jobs.archivepackages.ApplicationInsightsInstrumentationKey}"
start /w archivepackages.exe -Configuration "#{Jobs.archivepackages.Configuration}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, so instrumentation key now comes through JSON configuration? I think some of the validation jobs need this fix right?

Copy link
Member Author

@chenriksson chenriksson Aug 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted to keep -Sleep and -InstrumentationKey in Octopus... wasn't plumbed through to the JobRunner. Can investigate more once I move onto job deployments.

It does look like the Revalidate job has an "AppInsights" section, which could probably be extracted into Jobs.Common and reused.

},

"GalleryDb": {
"ConnectionString": "Data Source=tcp:#{Jobs.validation.GalleryDatabaseAddress};Initial Catalog=nuget-dev-0-v2gallery;Integrated Security=False;User ID=$$Dev-GalleryDBReadOnly-UserName$$;Password=$$Dev-GalleryDBReadOnly-Password$$;Connect Timeout=30;Encrypt=True"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix GalleryDatabaseAddress prefix

base.ConfigureDefaultJobServices(services, configurationRoot);

//services.AddSingleton(new TelemetryClient());
//services.AddTransient<ITelemetryClient, TelemetryClientWrapper>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove and keep in JsonConfigurationJob

Copy link
Contributor

@agr agr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@chenriksson chenriksson changed the base branch from chenriks-jobscommon-sql to dev August 7, 2018 12:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants