Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version alignment #722

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ The deployment exposes the following parameters that can be tuned to suit the se
|notificationsPassword|The password used to authenticate incoming requests from Azure DevOps|No|<auto-generated>|
|dockerImageRegistry|The docker registry to use when pulling the docker containers if needed. By default this will GitHub Container Registry. This can be useful if the container needs to come from an internal docker registry mirror or alternative source for testing. If the registry requires authentication ensure to assign `acrPull` permissions to the managed identity.<br />Example: `contoso.azurecr.io`|No|`ghcr.io`|
|serverImageRepository|The docker container repository to use when pulling the server docker container. This can be useful if the default container requires customizations such as custom certs.|No|`tinglesoftware/dependabot-server`|
|serverImageTag|The image tag to use when pulling the docker container. A tag also defines the version. You should avoid using `latest`. Example: `0.1.0`|No|&lt;version-downloaded&gt;|
|updaterImageTag|The image tag to use when pulling the updater docker container. A tag also defines the version. You should avoid using `latest`. Example: `0.1.0`|No|&lt;version-downloaded&gt;|
|serverImageTag|The image tag to use when pulling the docker container. A tag also defines the version. You should avoid using `latest`. Example: `1.1.0`|No|&lt;version-downloaded&gt;|
|updaterImageTag|The image tag to use when pulling the updater docker container. A tag also defines the version. You should avoid using `latest`. Example: `1.1.0`|No|&lt;version-downloaded&gt;|
|minReplicas|The minimum number of replicas to required for the deployment. Given that scheduling runs in process, this value cannot be less than `1`. This may change in the future.|No|1|
|maxReplicas|The maximum number of replicas when automatic scaling engages. In most cases, you do not need more than 1.|No|1|

Expand Down
8 changes: 3 additions & 5 deletions extension/task/utils/getDockerImageTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ export default function getDockerImageTag(): string {
throw new Error("Invalid dependabot config object");
}

// we only pull the minor version, the major is fixed for two reasons:
// 1. The docker version and the task version are not aligned
// 2. Major docker changes mostly require major changes in the task
const versionMajor = obj["version"]["Major"];
const versionMinor = obj["version"]["Minor"];
if (!!!versionMinor) throw new Error("Minor version could not be parsed from the file");
if (!!!versionMajor || !!!versionMinor) throw new Error("Major and/or Minor version could not be parsed from the file");

dockerImageTag = `0.${versionMinor}`;
dockerImageTag = `${versionMajor}.${versionMinor}`;
}

return dockerImageTag;
Expand Down
12 changes: 6 additions & 6 deletions server/Tingle.Dependabot.Tests/Workflow/UpdateRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ public void ConvertPlaceholder_Works()
}

[Theory]
[InlineData("contoso.azurecr.io/tinglesoftware/dependabot-updater-nuget:0.11", true, "contoso.azurecr.io")]
[InlineData("fabrikam.azurecr.io/tinglesoftware/dependabot-updater-nuget:0.11", true, "fabrikam.azurecr.io")]
[InlineData("dependabot.azurecr.io/tinglesoftware/dependabot-updater-nuget:0.11", true, "dependabot.azurecr.io")]
[InlineData("ghcr.io/tinglesoftware/dependabot-updater-nuget:0.11", false, null)]
[InlineData("tingle/dependabot-updater-nuget:0.11", false, null)]
[InlineData("tingle/dependabot-azure-devops:0.11", false, null)]
[InlineData("contoso.azurecr.io/tinglesoftware/dependabot-updater-nuget:1.20", true, "contoso.azurecr.io")]
[InlineData("fabrikam.azurecr.io/tinglesoftware/dependabot-updater-nuget:1.20", true, "fabrikam.azurecr.io")]
[InlineData("dependabot.azurecr.io/tinglesoftware/dependabot-updater-nuget:1.20", true, "dependabot.azurecr.io")]
[InlineData("ghcr.io/tinglesoftware/dependabot-updater-nuget:1.20", false, null)]
[InlineData("tingle/dependabot-updater-nuget:1.20", false, null)]
[InlineData("tingle/dependabot-azure-devops:1.20", false, null)]
public void TryGetAzureContainerRegistry_Works(string input, bool matches, string? expected)
{
var found = UpdateRunner.TryGetAzureContainerRegistry(input, out var actual);
Expand Down
2 changes: 1 addition & 1 deletion server/Tingle.Dependabot/Workflow/WorkflowOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class WorkflowOptions
/// <br/>
/// However, in production there maybe an issue that requires a rollback hence the value is placed in options.
/// </summary>
/// <example>ghcr.io/tinglesoftware/dependabot-updater-{{ecosystem}}:0.14</example>
/// <example>ghcr.io/tinglesoftware/dependabot-updater-{{ecosystem}}:1.20</example>
public string? UpdaterContainerImageTemplate { get; set; }

/// <summary>URL for the project.</summary>
Expand Down
2 changes: 1 addition & 1 deletion server/Tingle.Dependabot/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"LogAnalyticsWorkspaceId": "00000000-0000-1111-0001-000000000000",
"LogAnalyticsWorkspaceKey": "AAAAAAAAAAA=",
"ManagedIdentityId": "/subscriptions/00000000-0000-1111-0001-000000000000/resourceGroups/DEPENDABOT/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dependabot",
"UpdaterContainerImageTemplate": "ghcr.io/tinglesoftware/dependabot-updater-{{ecosystem}}:0.14.2-ci.37",
"UpdaterContainerImageTemplate": "ghcr.io/tinglesoftware/dependabot-updater-{{ecosystem}}:1.20.0-ci.37",
"ProjectUrl": "https://dev.azure.com/fabrikam/DefaultCollection",
"ProjectToken": "<my-pat-here>",
"GithubToken": "<github-pat-here>",
Expand Down