Skip to content

Commit

Permalink
Fix naming issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell committed Sep 30, 2023
1 parent 7008ec6 commit 6cb409a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cSpell.words": [
"azuredevops",
"fabrikam",
"Kubernetes"
]
}
3 changes: 3 additions & 0 deletions docs/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ The parameters file (`dependabot.parameters.json`):
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "dependabot-fabrikam"
},
"githubToken": {
"value": "#{DependabotGithubToken}#"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public async Task ConsumeAsync(EventContext<TriggerUpdateJobsEvent> context, Can
// create the job
job = new UpdateJob
{
Id = $"job_{KSUID.Ksuid.Generate()}",
// no prefixing/formatting because we use this to create azure resources which have name restrictions
Id = FlakeId.Id.Create().ToString(),

Created = DateTimeOffset.UtcNow,
Status = UpdateJobStatus.Scheduled,
Expand Down
1 change: 1 addition & 0 deletions server/Tingle.Dependabot/Tingle.Dependabot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<PackageReference Include="Azure.Monitor.Query" Version="1.2.0" />
<PackageReference Include="Azure.ResourceManager.AppContainers" Version="1.1.0" />
<PackageReference Include="DistributedLock.FileSystem" Version="1.0.1" />
<PackageReference Include="FlakeId" Version="1.1.2" /> <!-- TODO: replace with Tingle.Extensions.Primitives -->
<PackageReference Include="Ksuid" Version="1.0.0" /> <!-- TODO: replace with Tingle.Extensions.Primitives -->
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
Expand Down
5 changes: 3 additions & 2 deletions server/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ param location string = resourceGroup().location
@minLength(5)
@maxLength(24)
@description('Name of the resources. Make sure it is unique e.g. dependabotcontoso to avoid conflicts or failures')
param name string
param name string = 'dependabot'

@description('JSON array string fo projects to setup. E.g. [{"url":"https://dev.azure.com/tingle/dependabot","token":"dummy","AutoComplete":true}]')
param projectSetups string = '[]'
Expand All @@ -22,7 +22,8 @@ var fileShares = [
{ name: 'working-dir', writeable: true }
]

var storageAccountName = name == 'dependabot' ? 'dependabotstore' : name // dependabot is not available as of 2023-Sep-25 so we change just for the public deployment
// dependabot is not available as of 2023-Sep-25 so we change just for the public deployment
var storageAccountName = replace(replace((name == 'dependabot' ? 'dependabotstore' : name), '-', ''), '_', '') // remove underscores and hyphens
var sqlServerAdministratorLogin = uniqueString(resourceGroup().id) // e.g. zecnx476et7xm (13 characters)
var sqlServerAdministratorLoginPassword = '${skip(uniqueString(resourceGroup().id), 5)}%${uniqueString('sql-password', resourceGroup().id)}' // e.g. abcde%zecnx476et7xm (19 characters)
var queueNames = [
Expand Down
3 changes: 2 additions & 1 deletion server/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"name": {
"type": "string",
"defaultValue": "dependabot",
"minLength": 5,
"maxLength": 24,
"metadata": {
Expand Down Expand Up @@ -77,7 +78,7 @@
"writeable": true
}
],
"storageAccountName": "[if(equals(parameters('name'), 'dependabot'), 'dependabotstore', parameters('name'))]",
"storageAccountName": "[replace(replace(if(equals(parameters('name'), 'dependabot'), 'dependabotstore', parameters('name')), '-', ''), '_', '')]",
"sqlServerAdministratorLogin": "[uniqueString(resourceGroup().id)]",
"sqlServerAdministratorLoginPassword": "[format('{0}%{1}', skip(uniqueString(resourceGroup().id), 5), uniqueString('sql-password', resourceGroup().id))]",
"queueNames": [
Expand Down

0 comments on commit 6cb409a

Please sign in to comment.