From 826c8b5af48dcc414bfa22659035519b6c6f46c9 Mon Sep 17 00:00:00 2001 From: dvankeke Date: Thu, 27 Mar 2025 15:53:44 +0100 Subject: [PATCH 01/19] feat: replaced regex patterns for strings --- values-schema.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/values-schema.yaml b/values-schema.yaml index b264b63bbe..9cdb6c1c20 100644 --- a/values-schema.yaml +++ b/values-schema.yaml @@ -56,13 +56,13 @@ definitions: channel: default: mon-otomi description: The Slack channel for non-critical notifications. - $ref: '#/definitions/wordCharacterPattern' + type: string channelCrit: default: mon-otomi-crit description: The Slack channel for critical notifications. - $ref: '#/definitions/wordCharacterPattern' + type: string url: - $ref: '#/definitions/url' + type: string description: A Slack webhook URL. x-secret: '' opsgenie: From f0830ce8248b75d97910e62bfbd1f7205415ae26 Mon Sep 17 00:00:00 2001 From: dvankeke Date: Mon, 31 Mar 2025 14:13:30 +0200 Subject: [PATCH 02/19] fix: debug versions --- versions.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions.yaml b/versions.yaml index e85db006ef..ebec8ff255 100644 --- a/versions.yaml +++ b/versions.yaml @@ -1,5 +1,5 @@ -api: 4.0.0 -console: 4.0.0 +api: APL-540 +console: APL-540 consoleLogin: v3.5.0 tasks: 3.7.0 tools: 2.8.7 From 60adb9da2e50fdba3fe227534dc3884c4c66bc64 Mon Sep 17 00:00:00 2001 From: ElderMatt <18527012+ElderMatt@users.noreply.github.com> Date: Mon, 7 Apr 2025 15:39:24 +0200 Subject: [PATCH 03/19] feat: setup value changes --- values-changes.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/values-changes.yaml b/values-changes.yaml index 76d5f2b828..7a08a1ac92 100644 --- a/values-changes.yaml +++ b/values-changes.yaml @@ -341,3 +341,20 @@ changes: - 'databases.keycloak.imported' - 'databases.gitea.imported' - 'databases.gitea.useOtomiDB' + - version: 41 + teamSettingsMigration: true + additions: + - 'teamConfig.{team}.resourceQuota': { 'enabled': 'true' } + - 'teamConfig.{team}.resourceQuota.computeResourceQuota': + [ + { 'key': 'limits.cpu', 'value': '500', 'decorator': 'mCPUs' }, + { 'key': 'requests.cpu', 'value': '250', 'decorator': 'mCPUs' }, + { 'key': 'limits.memory', 'value': '500', 'decorator': 'Mi' }, + { 'key': 'requests.memory', 'value': '500', 'decorator': 'Mi' }, + ] + - 'teamConfig.{team}.resourceQuota.countQuota': + [ + { 'key': 'loadbalancers', 'value': '0', 'mutable': 'false', 'decorator': 'lbs' }, + { 'key': 'nodeports', 'value': '0', 'mutable': 'false', 'decorator': 'nprts' }, + { 'key': 'count', 'value': '5', 'mutable': 'true', 'decorator': 'pods' }, + ] From 7afe342aa7481eca8f668b9ae50220d703339678 Mon Sep 17 00:00:00 2001 From: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com> Date: Tue, 8 Apr 2025 10:05:10 +0200 Subject: [PATCH 04/19] ci: change values-migrate env dir --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f1830c9aa..825a994c96 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "lint:ts": "eslint --ext ts src", "lint:ts:fix": "eslint --fix --ext ts src", "lint:types": "tsc --noEmit", - "migrate-values": "ENV_DIR=/tmp/otomi-bootstrap-dev binzx/otomi migrate -ni", + "migrate-values": "ENV_DIR=$PWD/tests/fixtures binzx/otomi migrate -ni", "prepare": "husky install", "release": "standard-version", "release:github": "github-release-from-changelog", From 76728fd0ae51053fba592ff3e7564204fbd0c2f1 Mon Sep 17 00:00:00 2001 From: ElderMatt <18527012+ElderMatt@users.noreply.github.com> Date: Tue, 8 Apr 2025 10:57:48 +0200 Subject: [PATCH 05/19] feat: migrate team settings --- src/cmd/migrate.ts | 85 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/src/cmd/migrate.ts b/src/cmd/migrate.ts index f3544ac5ce..6c2c3873d7 100644 --- a/src/cmd/migrate.ts +++ b/src/cmd/migrate.ts @@ -5,6 +5,7 @@ import { randomUUID } from 'crypto' import { diff } from 'deep-diff' import { copy, createFileSync, move, pathExists, renameSync, rm } from 'fs-extra' import { mkdir, readFile, writeFile } from 'fs/promises' +import { glob } from 'glob' import { cloneDeep, each, get, isObject, mapKeys, mapValues, omit, pick, pull, set, unset } from 'lodash' import { basename, dirname, join } from 'path' import { prepareEnvironment } from 'src/common/cli' @@ -20,7 +21,6 @@ import { v4 as uuidv4 } from 'uuid' import { parse } from 'yaml' import { Argv } from 'yargs' import { $, cd } from 'zx' -import { glob } from 'glob' const cmdName = getFilename(__filename) interface Arguments extends BasicArguments { @@ -51,6 +51,7 @@ interface Change { [mutation: string]: string }> networkPoliciesMigration?: boolean + teamSettingsMigration?: boolean } export type Changes = Array @@ -300,6 +301,85 @@ const networkPoliciesMigration = async (values: Record): Promise): Promise => { + const teams: Array = Object.keys(values?.teamConfig as Record) + await Promise.all( + // eslint-disable-next-line @typescript-eslint/require-await + teams.map(async (teamName) => { + // Get the selfService block for the team + const selfService = get(values, `teamConfig.${teamName}.settings.selfService`) + if (!selfService) return + + // Initialize the new teamMembers structure with default boolean values + const teamMembers = { + createServices: false, + editSecurityPolicies: false, + useCloudShell: false, + downloadKubeconfig: false, + downloadDockerLogin: false, + } + + // Map selfService.service.ingress -> teamMembers.createServices + const servicePermissions = get(selfService, 'service', []) + if (Array.isArray(servicePermissions) && servicePermissions.includes('ingress')) { + teamMembers.createServices = true + // Remove "ingress" from the original service array + set( + selfService, + 'service', + servicePermissions.filter((s: string) => s !== 'ingress'), + ) + } + + // Map selfService.access keys to corresponding teamMembers fields + // - downloadKubeConfig -> downloadKubeconfig + // - downloadDockerConfig -> downloadDockerLogin + // - shell -> useCloudShell + const accessPermissions = get(selfService, 'access', []) + if (Array.isArray(accessPermissions)) { + if (accessPermissions.includes('downloadKubeConfig')) { + teamMembers.downloadKubeconfig = true + } + if (accessPermissions.includes('downloadDockerConfig')) { + teamMembers.downloadDockerLogin = true + } + if (accessPermissions.includes('shell')) { + teamMembers.useCloudShell = true + } + // Remove the migrated keys from the access array + set( + selfService, + 'access', + accessPermissions.filter( + (s: string) => s !== 'downloadKubeConfig' && s !== 'downloadDockerConfig' && s !== 'shell', + ), + ) + } + + // Map selfService.policies.edit_policies -> teamMembers.editSecurityPolicies. + // Note: In the source schema, the string "edit policies" is used. + const policies = get(selfService, 'policies', []) + if (Array.isArray(policies) && policies.includes('edit policies')) { + teamMembers.editSecurityPolicies = true + // Remove "edit policies" from the original policies array + set( + selfService, + 'policies', + policies.filter((s: string) => s !== 'edit policies'), + ) + } + + // Set the new teamMembers object on selfService + set(selfService, 'teamMembers', teamMembers) + + unset(`teamConfig.${teamName}.settings.selfService`, 'apps') + unset(`teamConfig.${teamName}.settings.selfService`, 'policies') + unset(`teamConfig.${teamName}.settings.selfService`, 'service') + unset(`teamConfig.${teamName}.settings.selfService`, 'access') + }), + ) +} + const bulkAddition = (path: string, values: any, filePath: string) => { // eslint-disable-next-line @typescript-eslint/no-var-requires const val = require(filePath) @@ -362,6 +442,7 @@ export const applyChanges = async ( } if (c.networkPoliciesMigration) await networkPoliciesMigration(values) + if (c.teamSettingsMigration) await teamSettingsMigration(values) Object.assign(values, { version: c.version }) } @@ -530,7 +611,7 @@ export const migrate = async (): Promise => { } const changes: Changes = (await loadYaml(`${rootDir}/values-changes.yaml`))?.changes const versions = await loadYaml(`${env.ENV_DIR}/env/settings/versions.yaml`, { noError: true }) - const prevVersion: number = versions?.specVersion + const prevVersion: number = versions?.spec?.specVersion if (!prevVersion) { d.log('No changes detected, skipping') return false From b638b352aac03bcec2434e46b82af2b5a28ea14e Mon Sep 17 00:00:00 2001 From: dvankeke Date: Tue, 8 Apr 2025 10:59:05 +0200 Subject: [PATCH 06/19] fix: values schema changes --- values-schema.yaml | 314 ++++++++++++++++++++++++++++++--------------- 1 file changed, 210 insertions(+), 104 deletions(-) diff --git a/values-schema.yaml b/values-schema.yaml index 9cdb6c1c20..3157fb6a0f 100644 --- a/values-schema.yaml +++ b/values-schema.yaml @@ -7,104 +7,102 @@ definitions: type: object alerts: additionalProperties: false + type: object properties: - email: - additionalProperties: false - properties: - critical: - $ref: '#/definitions/email' - description: One or more email addresses (comma separated) for critical events. - x-secret: '' - nonCritical: - $ref: '#/definitions/email' - description: One or more email addresses (comma separated) for non-critical events. - x-secret: '' + repeatInterval: + default: 3h + description: Waiting time before sending a notification again after it was sent successfully for an alert. + title: Repeat Interval + type: string groupInterval: default: 5m - description: How long to wait before sending a notification about new alerts that are added to a group of alerts for which an initial notification has already been sent. (Usually ~5m or more.) - $ref: '#/definitions/duration' - msteams: - additionalProperties: false - properties: - highPrio: - description: The high prio web hook. - $ref: '#/definitions/wordCharacterPattern' - x-secret: '' - lowPrio: - description: The low prio web hook. - $ref: '#/definitions/wordCharacterPattern' - x-secret: '' + description: Waiting time before sending a notification about new alerts that are added to a group of alerts. + title: Group Interval + type: string receivers: - description: Notification receivers. + description: Select notification channel(s) for receiving alerts. Use 'none' if no channel available. + title: Notification receivers + type: array items: enum: - slack - msteams - - opsgenie - - email + # - email - none type: string - type: array uniqueItems: true - repeatInterval: - default: 3h - description: How long to wait before sending a notification again if it has already been sent successfully for an alert. (Usually ~3h or more). - $ref: '#/definitions/duration' slack: + title: Slack + description: Configure Slack endpoints for alerts. additionalProperties: false properties: channel: - default: mon-otomi + default: mon-apl description: The Slack channel for non-critical notifications. + title: Non-critical type: string channelCrit: - default: mon-otomi-crit + default: mon-apl-crit description: The Slack channel for critical notifications. + title: Critical type: string url: type: string description: A Slack webhook URL. - x-secret: '' - opsgenie: + x-acl: + platformAdmin: [read-any, update-any] + teamAdmin: [] + teamMember: [] + x-secret: true + # TODO: Enable again when form rework is done + # required: + # - url + type: object + msteams: additionalProperties: false + description: Configure Microsoft Teams endpoints for alerts. properties: - apiKey: - description: The api key to use for authn - $ref: '#/definitions/wordCharacterPattern' - x-secret: '' - url: - $ref: '#/definitions/url' - description: A Slack webhook URL. - x-secret: '' - responders: - type: array - items: - allOf: - - properties: - type: - type: string - enum: - - team - - user - - escalation - - schedule - - oneOf: - - title: ID - required: [id] - properties: - id: - $ref: '#/definitions/wordCharacterPattern' - - title: Name - required: [name] - properties: - name: - $ref: '#/definitions/idName' - - title: Username - required: [username] - properties: - username: - $ref: '#/definitions/wordCharacterPattern' - required: [type] + highPrio: + title: High prio web hook + type: string + x-acl: + platformAdmin: [read-any, update-any] + teamAdmin: [] + teamMember: [] + x-secret: true + lowPrio: + title: Low prio web hook + type: string + x-acl: + platformAdmin: [read-any, update-any] + teamAdmin: [] + teamMember: [] + x-secret: true + # TODO: Enable again when form rework is done + # required: + # - highPrio + # - lowPrio + title: Microsoft Teams + type: object + # NOTE: keep this in case email alertReceiver gets re-enabled again + # email: + # title: Email + # description: Configure email endpoints for alerts. + # additionalProperties: false + # properties: + # critical: + # title: Critical Events + # $ref: '#/email' + # description: One or more email addresses (comma separated) for critical events. + # nonCritical: + # title: Non-critical Events + # $ref: '#/email' + # description: One or more email addresses (comma separated) for non-critical events. + # # TODO: Enable again when form rework is done + # # required: + # # - critical + # # - nonCritical + # type: object annotations: $ref: '#/definitions/labelsAnnotations' @@ -1130,8 +1128,105 @@ definitions: type: string x-secret: '' resourceQuota: - description: 'List of kubernetes resource quota. Should adhere to the "spec.hard" format as described here: https://kubernetes.io/docs/concepts/policy/resource-quotas/. Not validated as there is no schema published. Change at your own risk.' + title: Resource Quota + description: > + Kubernetes resource quota. Should adhere to the format described at: + https://kubernetes.io/docs/concepts/policy/resource-quotas/. type: object + properties: + enabled: + type: boolean + title: Enabled + default: true + description: Whether resource quotas are enabled. + countQuota: + type: array + title: Count Quota + items: + type: object + properties: + key: + type: string + title: Key + value: + type: number + title: Value + mutable: + type: boolean + title: Mutable + decorator: + type: string + title: Decorator + required: + - key + - value + - mutable + - decorator + default: + - key: 'loadbalancers' + value: 0 + mutable: false + decorator: 'lbs' + - key: 'nodeports' + value: 0 + mutable: false + decorator: 'nprts' + - key: 'count' + value: 5 + mutable: true + decorator: 'pods' + computeResourceQuota: + type: array + title: Compute Resource Quota + items: + type: object + properties: + key: + type: string + title: Key + value: + type: number + title: Value + decorator: + type: string + title: Decorator + required: + - key + - value + - decorator + default: + - key: 'limits.cpu' + value: 500 + decorator: 'mCPUs' + - key: 'requests.cpu' + value: 250 + decorator: 'mCPUs' + - key: 'limits.memory' + value: 500 + decorator: 'Mi' + - key: 'requests.memory' + value: 500 + decorator: 'Mi' + customQuota: + type: array + title: Custom Quota + items: + type: object + properties: + key: + type: string + title: Key + value: + type: number + title: Value + required: + - key + - value + default: [] + required: + - enabled + - countQuota + - computeResourceQuota selfService: $ref: '#/definitions/teamSelfService' alerts: @@ -1198,39 +1293,50 @@ definitions: type: array items: $ref: '#/definitions/codeRepo' - teamSelfService: - title: Team permissions + TeamSelfService: + title: Team Permissions description: Grant team permissions to modify certain configuration parameters. type: object properties: - service: - title: Service - type: array - items: - type: string - enum: [ingress] - uniqueItems: true - team: - title: Team settings - type: array - items: - type: string - enum: [oidc, managedMonitoring, alerts, resourceQuota, networkPolicy] - uniqueItems: true - apps: - title: Apps - type: array - items: - type: string - enum: [argocd, gitea] - uniqueItems: true - access: - title: Access - type: array - items: - type: string - enum: [shell, downloadKubeConfig, downloadDockerConfig, downloadCertificateAuthority] - uniqueItems: true + teamMembers: + title: Team Members Permissions + type: object + properties: + createServices: + title: Create Services + type: boolean + default: false + description: Permission to create services. + editSecurityPolicies: + title: Edit Security Policies + type: boolean + default: false + description: Permission to edit security policies. + useCloudShell: + title: Use Cloud Shell + type: boolean + default: false + description: Permission to use the cloud shell. + downloadKubeconfig: + title: Download Kubeconfig + type: boolean + default: false + description: Permission to download the kubeconfig. + downloadDockerLogin: + title: Download Docker Login + type: boolean + default: false + description: Permission to download the docker login configuration. + required: + - createServices + - editSecurityPolicies + - useCloudShell + - downloadKubeconfig + - downloadDockerLogin + x-acl: + platformAdmin: [read-any, update-any] + teamAdmin: [read] + teamMember: [read] backupTtl: default: 168h description: Expiration of the backup. Defaults to 7 days. From 2a30a9359b5a963f465739501c0adf86ee6a286b Mon Sep 17 00:00:00 2001 From: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:20:14 +0200 Subject: [PATCH 07/19] fix: teamSettings migration --- package.json | 2 +- src/cmd/migrate.ts | 28 ++++------------------------ src/common/values.ts | 6 ++++-- values-changes.yaml | 6 +++--- values-schema.yaml | 2 +- 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index fb8cb1c244..d8c166164c 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "lint:ts": "eslint --ext ts src", "lint:ts:fix": "eslint --fix --ext ts src", "lint:types": "tsc --noEmit", - "migrate-values": "ENV_DIR=$PWD/tests/fixtures binzx/otomi migrate -ni", + "migrate-values": "ENV_DIR=/tmp/otomi-bootstrap-dev binzx/otomi migrate -ni", "prepare": "husky install", "release": "standard-version", "release:github": "github-release-from-changelog", diff --git a/src/cmd/migrate.ts b/src/cmd/migrate.ts index 6c2c3873d7..e705a8a1f2 100644 --- a/src/cmd/migrate.ts +++ b/src/cmd/migrate.ts @@ -323,12 +323,6 @@ const teamSettingsMigration = async (values: Record): Promise const servicePermissions = get(selfService, 'service', []) if (Array.isArray(servicePermissions) && servicePermissions.includes('ingress')) { teamMembers.createServices = true - // Remove "ingress" from the original service array - set( - selfService, - 'service', - servicePermissions.filter((s: string) => s !== 'ingress'), - ) } // Map selfService.access keys to corresponding teamMembers fields @@ -346,14 +340,6 @@ const teamSettingsMigration = async (values: Record): Promise if (accessPermissions.includes('shell')) { teamMembers.useCloudShell = true } - // Remove the migrated keys from the access array - set( - selfService, - 'access', - accessPermissions.filter( - (s: string) => s !== 'downloadKubeConfig' && s !== 'downloadDockerConfig' && s !== 'shell', - ), - ) } // Map selfService.policies.edit_policies -> teamMembers.editSecurityPolicies. @@ -361,21 +347,15 @@ const teamSettingsMigration = async (values: Record): Promise const policies = get(selfService, 'policies', []) if (Array.isArray(policies) && policies.includes('edit policies')) { teamMembers.editSecurityPolicies = true - // Remove "edit policies" from the original policies array - set( - selfService, - 'policies', - policies.filter((s: string) => s !== 'edit policies'), - ) } // Set the new teamMembers object on selfService set(selfService, 'teamMembers', teamMembers) - unset(`teamConfig.${teamName}.settings.selfService`, 'apps') - unset(`teamConfig.${teamName}.settings.selfService`, 'policies') - unset(`teamConfig.${teamName}.settings.selfService`, 'service') - unset(`teamConfig.${teamName}.settings.selfService`, 'access') + unset(selfService, 'service') + unset(selfService, 'access') + unset(selfService, 'policies') + unset(selfService, 'apps') }), ) } diff --git a/src/common/values.ts b/src/common/values.ts index ff4cbd8bee..cee3e344de 100644 --- a/src/common/values.ts +++ b/src/common/values.ts @@ -1,6 +1,6 @@ import { pathExists } from 'fs-extra' import { mkdir, unlink, writeFile } from 'fs/promises' -import { cloneDeep, get, isEmpty, isEqual, merge, omit, pick, set } from 'lodash' +import { cloneDeep, get, isEmpty, isEqual, merge, mergeWith, omit, pick, set } from 'lodash' import path from 'path' import { supportedK8sVersions } from 'src/supportedK8sVersions.json' import { stringify } from 'yaml' @@ -121,7 +121,9 @@ export const writeValuesToFile = async ( const values = cloneDeep(inValues) const originalValues = (await loadYaml(targetPath + suffix, { noError: true })) ?? {} d.debug('originalValues: ', JSON.stringify(originalValues, null, 2)) - const mergeResult = merge(cloneDeep(originalValues), values) + const mergeResult = mergeWith(cloneDeep(originalValues), values, (prev, next) => { + return next + }) const cleanedValues = removeBlankAttributes(values) const cleanedMergeResult = removeBlankAttributes(mergeResult) if (((overwrite && isEmpty(cleanedValues)) || (!overwrite && isEmpty(cleanedMergeResult))) && isSecretsFile) { diff --git a/values-changes.yaml b/values-changes.yaml index 7a08a1ac92..7f5af3d192 100644 --- a/values-changes.yaml +++ b/values-changes.yaml @@ -344,15 +344,15 @@ changes: - version: 41 teamSettingsMigration: true additions: - - 'teamConfig.{team}.resourceQuota': { 'enabled': 'true' } - - 'teamConfig.{team}.resourceQuota.computeResourceQuota': + - 'teamConfig.{team}.settings.resourceQuota': { 'enabled': 'true' } + - 'teamConfig.{team}.settings.resourceQuota.computeResourceQuota': [ { 'key': 'limits.cpu', 'value': '500', 'decorator': 'mCPUs' }, { 'key': 'requests.cpu', 'value': '250', 'decorator': 'mCPUs' }, { 'key': 'limits.memory', 'value': '500', 'decorator': 'Mi' }, { 'key': 'requests.memory', 'value': '500', 'decorator': 'Mi' }, ] - - 'teamConfig.{team}.resourceQuota.countQuota': + - 'teamConfig.{team}.settings.resourceQuota.countQuota': [ { 'key': 'loadbalancers', 'value': '0', 'mutable': 'false', 'decorator': 'lbs' }, { 'key': 'nodeports', 'value': '0', 'mutable': 'false', 'decorator': 'nprts' }, diff --git a/values-schema.yaml b/values-schema.yaml index 3157fb6a0f..3f65d80a58 100644 --- a/values-schema.yaml +++ b/values-schema.yaml @@ -1293,7 +1293,7 @@ definitions: type: array items: $ref: '#/definitions/codeRepo' - TeamSelfService: + teamSelfService: title: Team Permissions description: Grant team permissions to modify certain configuration parameters. type: object From 2c0317c93639f99d2763b2ce0221250c9f948f3e Mon Sep 17 00:00:00 2001 From: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:23:46 +0200 Subject: [PATCH 08/19] fix: cspell lint errors --- .cspell.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.cspell.json b/.cspell.json index 6c24382070..8254fce080 100644 --- a/.cspell.json +++ b/.cspell.json @@ -89,7 +89,9 @@ "Paketo", "tekton", "cnpg", - "dockercfg" + "dockercfg", + "nprts", + "CPUs" ], "language": "en", "words": [ From 2cfd4dd4decff5db6da68b02f166d9dc98d76997 Mon Sep 17 00:00:00 2001 From: dvankeke Date: Tue, 8 Apr 2025 15:38:00 +0200 Subject: [PATCH 09/19] fix: values changes version --- values-changes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/values-changes.yaml b/values-changes.yaml index 7f5af3d192..2bd5997ba9 100644 --- a/values-changes.yaml +++ b/values-changes.yaml @@ -341,7 +341,7 @@ changes: - 'databases.keycloak.imported' - 'databases.gitea.imported' - 'databases.gitea.useOtomiDB' - - version: 41 + - version: 34 teamSettingsMigration: true additions: - 'teamConfig.{team}.settings.resourceQuota': { 'enabled': 'true' } From f70c8f1af9457c078e24137015c50fb5caad29af Mon Sep 17 00:00:00 2001 From: dvankeke Date: Wed, 9 Apr 2025 13:43:43 +0200 Subject: [PATCH 10/19] fix: remove opsgenie and email migration --- src/cmd/migrate.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmd/migrate.ts b/src/cmd/migrate.ts index e705a8a1f2..30b1e3df3f 100644 --- a/src/cmd/migrate.ts +++ b/src/cmd/migrate.ts @@ -306,6 +306,10 @@ const teamSettingsMigration = async (values: Record): Promise await Promise.all( // eslint-disable-next-line @typescript-eslint/require-await teams.map(async (teamName) => { + // Get the alerts block for the team and remove email and opsgenie + const alerts = get(values, `teamConfig.${teamName}.settings.alerts`) + if (alerts?.email) unset(alerts, 'email') + if (alerts?.opsgenie) unset(alerts, 'opsgenie') // Get the selfService block for the team const selfService = get(values, `teamConfig.${teamName}.settings.selfService`) if (!selfService) return From 272798f6c4575852c135cf89ff1ca426a7e2f68f Mon Sep 17 00:00:00 2001 From: dvankeke Date: Wed, 9 Apr 2025 14:18:29 +0200 Subject: [PATCH 11/19] fix: teamSettingsMigration test --- src/cmd/migrate.test.ts | 96 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/src/cmd/migrate.test.ts b/src/cmd/migrate.test.ts index b1725a38ba..518ba50d9b 100644 --- a/src/cmd/migrate.test.ts +++ b/src/cmd/migrate.test.ts @@ -415,3 +415,99 @@ describe('Network policies migrations', () => { expect(deps.writeValues).toBeCalledWith(expectedValues, true) }, 20000) }) + +describe('teamSettingsMigration', () => { + // Create a mock values object representing teams with settings that need migration. + const getTeamSettingsMockValues = (): any => ({ + teamConfig: { + team1: { + settings: { + alerts: { + email: 'test@example.com', + opsgenie: 'ops_value', + teams: 'keep this alert', + }, + selfService: { + service: ['ingress'], + access: ['downloadKubeConfig', 'shell'], + policies: ['edit policies'], + apps: ['argocd', 'gitea'], + }, + }, + }, + team2: { + settings: { + alerts: { + teams: 'team2 alert', + }, + selfService: { + service: [], + access: [], + policies: [], + apps: ['argocd'], + }, + }, + }, + }, + }) + + // Expected values after migration: + // - The alerts block should have the 'email' and 'opsgenie' keys removed. + // - The selfService arrays ('service', 'access', 'policies', 'apps') are replaced with a new + // teamMembers object with the correct boolean values. + const getTeamSettingsExpectedValues = (): any => ({ + teamConfig: { + team1: { + settings: { + alerts: { + teams: 'keep this alert', + }, + selfService: { + teamMembers: { + createServices: true, // 'ingress' was present in service. + editSecurityPolicies: true, // 'edit policies' was present in policies. + useCloudShell: true, // 'shell' was present in access. + downloadKubeconfig: true, // 'downloadKubeConfig' was present in access. + downloadDockerLogin: false, // 'downloadDockerConfig' was not provided. + }, + }, + }, + }, + team2: { + settings: { + alerts: { + teams: 'team2 alert', + }, + selfService: { + teamMembers: { + createServices: false, + editSecurityPolicies: false, + useCloudShell: false, + downloadKubeconfig: false, + downloadDockerLogin: false, + }, + }, + }, + }, + }, + }) + + // Set up the values and changes flag to trigger the teamSettingsMigration. + const teamSettingValues: any = getTeamSettingsMockValues() + const valuesChanges: any = { + teamSettingsMigration: true, + } + const deps: any = { + cd: jest.fn(), + rename: jest.fn(), + hfValues: jest.fn().mockReturnValue(teamSettingValues), + terminal, + writeValues: jest.fn(), + } + + it('should migrate team settings correctly', async () => { + await applyChanges([valuesChanges], false, deps) + const expectedValues = getTeamSettingsExpectedValues() + expect(deps.writeValues).toBeCalledWith(expectedValues, true) + }, 20000) +}) From c19cc9c0c7b0efcde12c90f24db785eadfc0e205 Mon Sep 17 00:00:00 2001 From: dvankeke Date: Wed, 9 Apr 2025 17:08:49 +0200 Subject: [PATCH 12/19] fix: test fixtures --- tests/fixtures/env/settings/alerts.yaml | 4 +- .../fixtures/env/settings/secrets.alerts.yaml | 7 +-- tests/fixtures/env/teams/admin/settings.yaml | 39 +++++++++++++-- .../env/teams/demo/secrets.settings.yaml | 6 +++ tests/fixtures/env/teams/demo/settings.yaml | 47 +++++++++++++------ tests/fixtures/env/teams/dev/settings.yaml | 40 +++++++++++++--- 6 files changed, 111 insertions(+), 32 deletions(-) create mode 100644 tests/fixtures/env/teams/demo/secrets.settings.yaml diff --git a/tests/fixtures/env/settings/alerts.yaml b/tests/fixtures/env/settings/alerts.yaml index af4bdef4df..dbaee36fe9 100644 --- a/tests/fixtures/env/settings/alerts.yaml +++ b/tests/fixtures/env/settings/alerts.yaml @@ -3,8 +3,8 @@ metadata: name: alerts labels: {} spec: - email: {} - msteams: {} receivers: + - slack - msteams + msteams: {} slack: {} diff --git a/tests/fixtures/env/settings/secrets.alerts.yaml b/tests/fixtures/env/settings/secrets.alerts.yaml index 59b1159d1e..2db5be656f 100644 --- a/tests/fixtures/env/settings/secrets.alerts.yaml +++ b/tests/fixtures/env/settings/secrets.alerts.yaml @@ -1,10 +1,7 @@ kind: AplAlertSet spec: - email: - critical: admins@yourdoma.in - nonCritical: admins@yourdoma.in + slack: + url: https://hooks.slack.com/services/id msteams: highPrio: https://xxxxxxx.com lowPrio: https://xxxxxxxx.com - slack: - url: https://hooks.slack.com/services/id diff --git a/tests/fixtures/env/teams/admin/settings.yaml b/tests/fixtures/env/teams/admin/settings.yaml index 633c2d1395..cf915e435d 100644 --- a/tests/fixtures/env/teams/admin/settings.yaml +++ b/tests/fixtures/env/teams/admin/settings.yaml @@ -9,8 +9,37 @@ spec: alertmanager: true grafana: true selfService: - access: - - shell - - downloadCertificateAuthority - policies: - - edit policies + teamMembers: + createServices: false + editSecurityPolicies: true + useCloudShell: true + downloadKubeconfig: false + downloadDockerLogin: false + resourceQuota: + enabled: 'true' + computeResourceQuota: + - key: limits.cpu + value: '500' + decorator: mCPUs + - key: requests.cpu + value: '250' + decorator: mCPUs + - key: limits.memory + value: '500' + decorator: Mi + - key: requests.memory + value: '500' + decorator: Mi + countQuota: + - key: loadbalancers + value: '0' + mutable: 'false' + decorator: lbs + - key: nodeports + value: '0' + mutable: 'false' + decorator: nprts + - key: count + value: '5' + mutable: 'true' + decorator: pods diff --git a/tests/fixtures/env/teams/demo/secrets.settings.yaml b/tests/fixtures/env/teams/demo/secrets.settings.yaml new file mode 100644 index 0000000000..e4c3c3a8fb --- /dev/null +++ b/tests/fixtures/env/teams/demo/secrets.settings.yaml @@ -0,0 +1,6 @@ +kind: AplTeamSettingSet +spec: + password: somesecretvalue + alerts: + slack: + url: https://slack.con diff --git a/tests/fixtures/env/teams/demo/settings.yaml b/tests/fixtures/env/teams/demo/settings.yaml index e3862894fb..4f1a10ea42 100644 --- a/tests/fixtures/env/teams/demo/settings.yaml +++ b/tests/fixtures/env/teams/demo/settings.yaml @@ -5,16 +5,12 @@ metadata: apl.io/teamId: demo spec: alerts: - email: - critical: admins@yourdoma.in - nonCritical: admins@yourdoma.in receivers: - slack repeatInterval: 3h slack: channel: aaaaa channelCrit: aaaaa - url: https://slack.con id: demo managedMonitoring: alertmanager: true @@ -25,16 +21,39 @@ spec: oidc: groupMapping: somesecretvalue resourceQuota: - services.loadbalancers: '1' + enabled: 'true' + computeResourceQuota: + - key: limits.cpu + value: '500' + decorator: mCPUs + - key: requests.cpu + value: '250' + decorator: mCPUs + - key: limits.memory + value: '500' + decorator: Mi + - key: requests.memory + value: '500' + decorator: Mi + countQuota: + - key: loadbalancers + value: '0' + mutable: 'false' + decorator: lbs + - key: nodeports + value: '0' + mutable: 'false' + decorator: nprts + - key: count + value: '5' + mutable: 'true' + decorator: pods selfService: - access: - - shell - - downloadCertificateAuthority - apps: [] - policies: - - edit policies - service: - - ingress team: - alerts - password: somesecretvalue + teamMembers: + createServices: true + editSecurityPolicies: true + useCloudShell: true + downloadKubeconfig: false + downloadDockerLogin: false diff --git a/tests/fixtures/env/teams/dev/settings.yaml b/tests/fixtures/env/teams/dev/settings.yaml index d0c9331704..964939dabf 100644 --- a/tests/fixtures/env/teams/dev/settings.yaml +++ b/tests/fixtures/env/teams/dev/settings.yaml @@ -12,9 +12,37 @@ spec: egressPublic: false ingressPrivate: true selfService: - access: - - shell - - downloadCertificateAuthority - policies: - - edit policies - password: IkdUsKPcGAdanjas + teamMembers: + createServices: false + editSecurityPolicies: true + useCloudShell: true + downloadKubeconfig: false + downloadDockerLogin: false + resourceQuota: + enabled: 'true' + computeResourceQuota: + - key: limits.cpu + value: '500' + decorator: mCPUs + - key: requests.cpu + value: '250' + decorator: mCPUs + - key: limits.memory + value: '500' + decorator: Mi + - key: requests.memory + value: '500' + decorator: Mi + countQuota: + - key: loadbalancers + value: '0' + mutable: 'false' + decorator: lbs + - key: nodeports + value: '0' + mutable: 'false' + decorator: nprts + - key: count + value: '5' + mutable: 'true' + decorator: pods From c8ee5b9d590a3582363a7e94fb84176de6b43ec1 Mon Sep 17 00:00:00 2001 From: dvankeke Date: Mon, 14 Apr 2025 15:17:00 +0200 Subject: [PATCH 13/19] fix: reverted resourceQuota --- .cspell.json | 4 +- values-changes.yaml | 15 ------ values-schema.yaml | 111 +++++--------------------------------------- 3 files changed, 13 insertions(+), 117 deletions(-) diff --git a/.cspell.json b/.cspell.json index 8254fce080..6c24382070 100644 --- a/.cspell.json +++ b/.cspell.json @@ -89,9 +89,7 @@ "Paketo", "tekton", "cnpg", - "dockercfg", - "nprts", - "CPUs" + "dockercfg" ], "language": "en", "words": [ diff --git a/values-changes.yaml b/values-changes.yaml index 2bd5997ba9..1cd0ccc5fc 100644 --- a/values-changes.yaml +++ b/values-changes.yaml @@ -343,18 +343,3 @@ changes: - 'databases.gitea.useOtomiDB' - version: 34 teamSettingsMigration: true - additions: - - 'teamConfig.{team}.settings.resourceQuota': { 'enabled': 'true' } - - 'teamConfig.{team}.settings.resourceQuota.computeResourceQuota': - [ - { 'key': 'limits.cpu', 'value': '500', 'decorator': 'mCPUs' }, - { 'key': 'requests.cpu', 'value': '250', 'decorator': 'mCPUs' }, - { 'key': 'limits.memory', 'value': '500', 'decorator': 'Mi' }, - { 'key': 'requests.memory', 'value': '500', 'decorator': 'Mi' }, - ] - - 'teamConfig.{team}.settings.resourceQuota.countQuota': - [ - { 'key': 'loadbalancers', 'value': '0', 'mutable': 'false', 'decorator': 'lbs' }, - { 'key': 'nodeports', 'value': '0', 'mutable': 'false', 'decorator': 'nprts' }, - { 'key': 'count', 'value': '5', 'mutable': 'true', 'decorator': 'pods' }, - ] diff --git a/values-schema.yaml b/values-schema.yaml index 3f65d80a58..0ef3b15f6d 100644 --- a/values-schema.yaml +++ b/values-schema.yaml @@ -1128,105 +1128,18 @@ definitions: type: string x-secret: '' resourceQuota: - title: Resource Quota - description: > - Kubernetes resource quota. Should adhere to the format described at: - https://kubernetes.io/docs/concepts/policy/resource-quotas/. - type: object - properties: - enabled: - type: boolean - title: Enabled - default: true - description: Whether resource quotas are enabled. - countQuota: - type: array - title: Count Quota - items: - type: object - properties: - key: - type: string - title: Key - value: - type: number - title: Value - mutable: - type: boolean - title: Mutable - decorator: - type: string - title: Decorator - required: - - key - - value - - mutable - - decorator - default: - - key: 'loadbalancers' - value: 0 - mutable: false - decorator: 'lbs' - - key: 'nodeports' - value: 0 - mutable: false - decorator: 'nprts' - - key: 'count' - value: 5 - mutable: true - decorator: 'pods' - computeResourceQuota: - type: array - title: Compute Resource Quota - items: - type: object - properties: - key: - type: string - title: Key - value: - type: number - title: Value - decorator: - type: string - title: Decorator - required: - - key - - value - - decorator - default: - - key: 'limits.cpu' - value: 500 - decorator: 'mCPUs' - - key: 'requests.cpu' - value: 250 - decorator: 'mCPUs' - - key: 'limits.memory' - value: 500 - decorator: 'Mi' - - key: 'requests.memory' - value: 500 - decorator: 'Mi' - customQuota: - type: array - title: Custom Quota - items: - type: object - properties: - key: - type: string - title: Key - value: - type: number - title: Value - required: - - key - - value - default: [] - required: - - enabled - - countQuota - - computeResourceQuota + description: 'List of kubernetes resource quota. Should adhere to the "spec.hard" format as described here: https://kubernetes.io/docs/concepts/policy/resource-quotas/. Not validated as there is no schema published. Change at your own risk.' + type: array + items: + type: object + properties: + name: + type: string + value: + type: string + required: + - name + - value selfService: $ref: '#/definitions/teamSelfService' alerts: From 0c8beae54804c26a81a22aab583c498d81f7ed34 Mon Sep 17 00:00:00 2001 From: dvankeke Date: Tue, 15 Apr 2025 13:58:59 +0200 Subject: [PATCH 14/19] fix: added specVersion --- src/cmd/migrate.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/migrate.test.ts b/src/cmd/migrate.test.ts index 97ea2c62bc..ef4160c7a0 100644 --- a/src/cmd/migrate.test.ts +++ b/src/cmd/migrate.test.ts @@ -571,6 +571,7 @@ describe('Build image name migration', () => { describe('teamSettingsMigration', () => { // Create a mock values object representing teams with settings that need migration. const getTeamSettingsMockValues = (): any => ({ + versions: { specVersion: 1 }, teamConfig: { team1: { settings: { @@ -608,6 +609,7 @@ describe('teamSettingsMigration', () => { // - The selfService arrays ('service', 'access', 'policies', 'apps') are replaced with a new // teamMembers object with the correct boolean values. const getTeamSettingsExpectedValues = (): any => ({ + versions: { specVersion: 2 }, teamConfig: { team1: { settings: { @@ -647,6 +649,7 @@ describe('teamSettingsMigration', () => { // Set up the values and changes flag to trigger the teamSettingsMigration. const teamSettingValues: any = getTeamSettingsMockValues() const valuesChanges: any = { + version: 2, teamSettingsMigration: true, } const deps: any = { From e514737c091809f80cc5654ed7d8056e19a5834e Mon Sep 17 00:00:00 2001 From: dvankeke Date: Tue, 15 Apr 2025 14:01:11 +0200 Subject: [PATCH 15/19] fix: removed duplicated slack key --- tests/fixtures/env/settings/secrets.alerts.yaml | 2 -- tests/fixtures/env/teams/demo/secrets.settings.yaml | 2 -- 2 files changed, 4 deletions(-) diff --git a/tests/fixtures/env/settings/secrets.alerts.yaml b/tests/fixtures/env/settings/secrets.alerts.yaml index a230ac8dc9..1bbbfdaf12 100644 --- a/tests/fixtures/env/settings/secrets.alerts.yaml +++ b/tests/fixtures/env/settings/secrets.alerts.yaml @@ -5,8 +5,6 @@ spec: msteams: highPrio: https://xxxxxxx.com lowPrio: https://xxxxxxxx.com - slack: - url: https://hooks.slack.com/services/id name: alerts metadata: name: alerts diff --git a/tests/fixtures/env/teams/demo/secrets.settings.yaml b/tests/fixtures/env/teams/demo/secrets.settings.yaml index 4151448b6c..6d88dfd7b0 100644 --- a/tests/fixtures/env/teams/demo/secrets.settings.yaml +++ b/tests/fixtures/env/teams/demo/secrets.settings.yaml @@ -7,8 +7,6 @@ spec: email: critical: admins@yourdoma.in nonCritical: admins@yourdoma.in - slack: - url: https://slack.con name: demo metadata: name: demo From 5152107184647ae61d5f1864d5873d887e0984ce Mon Sep 17 00:00:00 2001 From: dvankeke Date: Tue, 15 Apr 2025 14:08:47 +0200 Subject: [PATCH 16/19] fix: removed email from secret settings --- tests/fixtures/env/teams/demo/secrets.settings.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/fixtures/env/teams/demo/secrets.settings.yaml b/tests/fixtures/env/teams/demo/secrets.settings.yaml index 6d88dfd7b0..abf4440deb 100644 --- a/tests/fixtures/env/teams/demo/secrets.settings.yaml +++ b/tests/fixtures/env/teams/demo/secrets.settings.yaml @@ -4,9 +4,6 @@ spec: alerts: slack: url: https://slack.con - email: - critical: admins@yourdoma.in - nonCritical: admins@yourdoma.in name: demo metadata: name: demo From 6a93249b1ddfdd6b7024dc35a431605f299d5826 Mon Sep 17 00:00:00 2001 From: dvankeke Date: Wed, 16 Apr 2025 16:31:31 +0200 Subject: [PATCH 17/19] fix: removed async from teamSettingsMigration --- src/cmd/migrate.ts | 108 ++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/src/cmd/migrate.ts b/src/cmd/migrate.ts index 84d5b0618d..d66334f3ea 100644 --- a/src/cmd/migrate.ts +++ b/src/cmd/migrate.ts @@ -304,67 +304,65 @@ const networkPoliciesMigration = async (values: Record): Promise): Promise => { +const teamSettingsMigration = (values: Record): void => { const teams: Array = Object.keys(values?.teamConfig as Record) - await Promise.all( - // eslint-disable-next-line @typescript-eslint/require-await - teams.map(async (teamName) => { - // Get the alerts block for the team and remove email and opsgenie - const alerts = get(values, `teamConfig.${teamName}.settings.alerts`) - if (alerts?.email) unset(alerts, 'email') - if (alerts?.opsgenie) unset(alerts, 'opsgenie') - // Get the selfService block for the team - const selfService = get(values, `teamConfig.${teamName}.settings.selfService`) - if (!selfService) return - - // Initialize the new teamMembers structure with default boolean values - const teamMembers = { - createServices: false, - editSecurityPolicies: false, - useCloudShell: false, - downloadKubeconfig: false, - downloadDockerLogin: false, - } - // Map selfService.service.ingress -> teamMembers.createServices - const servicePermissions = get(selfService, 'service', []) - if (Array.isArray(servicePermissions) && servicePermissions.includes('ingress')) { - teamMembers.createServices = true - } + teams.map((teamName) => { + // Get the alerts block for the team and remove email and opsgenie + const alerts = get(values, `teamConfig.${teamName}.settings.alerts`) + if (alerts?.email) unset(alerts, 'email') + if (alerts?.opsgenie) unset(alerts, 'opsgenie') + // Get the selfService block for the team + const selfService = get(values, `teamConfig.${teamName}.settings.selfService`) + if (!selfService) return + + // Initialize the new teamMembers structure with default boolean values + const teamMembers = { + createServices: false, + editSecurityPolicies: false, + useCloudShell: false, + downloadKubeconfig: false, + downloadDockerLogin: false, + } - // Map selfService.access keys to corresponding teamMembers fields - // - downloadKubeConfig -> downloadKubeconfig - // - downloadDockerConfig -> downloadDockerLogin - // - shell -> useCloudShell - const accessPermissions = get(selfService, 'access', []) - if (Array.isArray(accessPermissions)) { - if (accessPermissions.includes('downloadKubeConfig')) { - teamMembers.downloadKubeconfig = true - } - if (accessPermissions.includes('downloadDockerConfig')) { - teamMembers.downloadDockerLogin = true - } - if (accessPermissions.includes('shell')) { - teamMembers.useCloudShell = true - } - } + // Map selfService.service.ingress -> teamMembers.createServices + const servicePermissions = get(selfService, 'service', []) + if (Array.isArray(servicePermissions) && servicePermissions.includes('ingress')) { + teamMembers.createServices = true + } - // Map selfService.policies.edit_policies -> teamMembers.editSecurityPolicies. - // Note: In the source schema, the string "edit policies" is used. - const policies = get(selfService, 'policies', []) - if (Array.isArray(policies) && policies.includes('edit policies')) { - teamMembers.editSecurityPolicies = true + // Map selfService.access keys to corresponding teamMembers fields + // - downloadKubeConfig -> downloadKubeconfig + // - downloadDockerConfig -> downloadDockerLogin + // - shell -> useCloudShell + const accessPermissions = get(selfService, 'access', []) + if (Array.isArray(accessPermissions)) { + if (accessPermissions.includes('downloadKubeConfig')) { + teamMembers.downloadKubeconfig = true + } + if (accessPermissions.includes('downloadDockerConfig')) { + teamMembers.downloadDockerLogin = true + } + if (accessPermissions.includes('shell')) { + teamMembers.useCloudShell = true } + } - // Set the new teamMembers object on selfService - set(selfService, 'teamMembers', teamMembers) + // Map selfService.policies.edit_policies -> teamMembers.editSecurityPolicies. + // Note: In the source schema, the string "edit policies" is used. + const policies = get(selfService, 'policies', []) + if (Array.isArray(policies) && policies.includes('edit policies')) { + teamMembers.editSecurityPolicies = true + } - unset(selfService, 'service') - unset(selfService, 'access') - unset(selfService, 'policies') - unset(selfService, 'apps') - }), - ) + // Set the new teamMembers object on selfService + set(selfService, 'teamMembers', teamMembers) + + unset(selfService, 'service') + unset(selfService, 'access') + unset(selfService, 'policies') + unset(selfService, 'apps') + }) } export const getBuildName = (name: string, tag: string): string => { @@ -501,7 +499,7 @@ export const applyChanges = async ( } if (c.networkPoliciesMigration) await networkPoliciesMigration(values) - if (c.teamSettingsMigration) await teamSettingsMigration(values) + if (c.teamSettingsMigration) teamSettingsMigration(values) if (c.teamResourceQuotaMigration) teamResourceQuotaMigration(values) if (c.buildImageNameMigration) await buildImageNameMigration(values) if (c.policiesMigration) await policiesMigration() From e8999ddcdd382501a11451db86c243d7d2edfd11 Mon Sep 17 00:00:00 2001 From: dvankeke Date: Wed, 16 Apr 2025 16:33:48 +0200 Subject: [PATCH 18/19] fix: auto migrate oopsie --- src/cmd/migrate.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmd/migrate.test.ts b/src/cmd/migrate.test.ts index bbb13cccbd..f1553c60bd 100644 --- a/src/cmd/migrate.test.ts +++ b/src/cmd/migrate.test.ts @@ -1,8 +1,8 @@ +import { globSync } from 'glob' import { applyChanges, Changes, filterChanges, getBuildName, policiesMigration } from 'src/cmd/migrate' import stubs from 'src/test-stubs' -import { globSync } from 'glob' -import { getFileMap } from '../common/repo' import { env } from '../common/envalid' +import { getFileMap } from '../common/repo' jest.mock('uuid', () => ({ v4: jest.fn(() => 'my-fixed-uuid'), @@ -668,6 +668,7 @@ describe('teamSettingsMigration', () => { const expectedValues = getTeamSettingsExpectedValues() expect(deps.writeValues).toBeCalledWith(expectedValues, true) }, 20000) +}) jest.mock('glob') describe('Policies migration', () => { From 85b47d2c37e7a643e8b9cc2cd459d199dd976a51 Mon Sep 17 00:00:00 2001 From: Dennis van Kekem <38350840+dennisvankekem@users.noreply.github.com> Date: Wed, 16 Apr 2025 16:40:58 +0200 Subject: [PATCH 19/19] fix: reverted versions to main --- versions.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/versions.yaml b/versions.yaml index 1d871ad34f..d54e4c2e07 100644 --- a/versions.yaml +++ b/versions.yaml @@ -1,5 +1,5 @@ -api: APL-540 -console: APL-540 -consoleLogin: v3.5.0 -tasks: 3.8.0 -tools: 2.8.7 +api: main +console: main +consoleLogin: main +tasks: main +tools: main