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

feat(manager): add sveltos manager #30087

Merged
merged 47 commits into from
Oct 15, 2024
Merged

Conversation

oliverbaehler
Copy link
Contributor

@oliverbaehler oliverbaehler commented Jul 8, 2024

Changes

This adds the manager for sveltos for GitOps managed Cluster Fleets. Essentially we have the same functionality as argoCD, so we were able to take the argocd manager and adjust the schema etc. I hope that's okay.

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

Not sure if there's more?

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@CLAassistant

This comment was marked as resolved.

@secustor

This comment was marked as resolved.

@secustor secustor marked this pull request as draft July 8, 2024 17:18
@oliverbaehler

This comment was marked as resolved.

@secustor secustor marked this pull request as ready for review July 8, 2024 20:13
@secustor
Copy link
Collaborator

secustor commented Jul 8, 2024

Package manager details can be found here: #30090 (comment)

lib/modules/manager/sveltos/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/index.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
secustor

This comment was marked as resolved.

lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/util.ts Outdated Show resolved Hide resolved
@oliverbaehler

This comment was marked as resolved.

@secustor

This comment was marked as resolved.

@oliverbaehler

This comment was marked as resolved.

@secustor secustor self-requested a review August 12, 2024 08:11
@secustor
Copy link
Collaborator

Is this ready for another review?
Please use the re-review button so we maintainers know that you are ready for a new review.

BTW It isn't necessary to merge main if there are no conflicts.

@oliverbaehler
Copy link
Contributor Author

@secustor Yes this is ready for review, Sorry!

lib/modules/manager/sveltos/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/readme.md Outdated Show resolved Hide resolved
@viceice viceice self-requested a review August 14, 2024 15:58
Copy link
Collaborator

@secustor secustor left a comment

Choose a reason for hiding this comment

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

Needs code coverage ( see the failing CI ) and docs changes requested by @HonkingGoose

lib/modules/manager/sveltos/util.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/schema.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/sveltos/extract.ts Outdated Show resolved Hide resolved
@oliverbaehler
Copy link
Contributor Author

HI @secustor, I implemented your changes. I also moved the fixtures from the __fixtures__ directory to inline consts since @rarkins added a github check, that. fixtures no longer should be used. Trying to run:

Error: Cannot find module '@opentelemetry/semantic-conventions/incubating'
Require stack:
- /usr/src/app/lib/instrumentation/index.ts
- /usr/src/app/lib/renovate.ts

Lint also throws errors:

docker run -it --rm -v "${PWD}:/usr/src/app" -e LOG_LEVEL=debug -w /usr/src/app renovatebot_local  pnpm eslint . --cache --cache-location .cache/eslint --report-unused-disable-directives

> [email protected] eslint /usr/src/app
> eslint . --cache --cache-location .cache/eslint --report-unused-disable-directives "." "--cache" "--cache-location" ".cache/eslint" "--report-unused-disable-directives"


/usr/src/app/lib/expose.cjs
  1:1  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/no-require-imports')

/usr/src/app/lib/instrumentation/index.ts
  25:3   error  ATTR_SERVICE_NAME not found in '@opentelemetry/semantic-conventions'               import/named
  26:3   error  ATTR_SERVICE_VERSION not found in '@opentelemetry/semantic-conventions'            import/named
  28:40  error  Unable to resolve path to module '@opentelemetry/semantic-conventions/incubating'  import/no-unresolved

/usr/src/app/lib/modules/manager/pipenv/artifacts.ts
  1:40  error  Unable to resolve path to module '@renovatebot/detect-tools'  import/no-unresolved

/usr/src/app/lib/modules/manager/pipenv/extract.ts
  1:40  error  Unable to resolve path to module '@renovatebot/detect-tools'  import/no-unresolved

/usr/src/app/lib/modules/platform/bitbucket-server/index.ts
  731:3  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/only-throw-error')

/usr/src/app/lib/util/git/index.ts
  106:3  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/only-throw-error')

/usr/src/app/lib/util/host-rules.ts
  113:17  error  Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator  @typescript-eslint/prefer-nullish-coalescing

/usr/src/app/lib/util/mutex.ts
  1:57  error  Unable to resolve path to module 'async-mutex'  import/no-unresolved

/usr/src/app/lib/util/result.spec.ts
  1:1  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/prefer-promise-reject-errors')
  2:1  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/only-throw-error')

/usr/src/app/lib/util/result.ts
  327:7  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/only-throw-error')
  352:7  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/only-throw-error')
  368:5  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/only-throw-error')
  383:7  error  Unused eslint-disable directive (no problems were reported from '@typescript-eslint/only-throw-error')

/usr/src/app/lib/util/yaml.ts
   8:61  error  Unable to resolve path to module 'yaml'                    import/no-unresolved
  30:27  error  'any' overrides all other types in this intersection type  @typescript-eslint/no-redundant-type-constituents
  31:3   error  'any' overrides all other types in this intersection type  @typescript-eslint/no-redundant-type-constituents
  32:3   error  'any' overrides all other types in this intersection type  @typescript-eslint/no-redundant-type-constituents
  33:3   error  'any' overrides all other types in this intersection type  @typescript-eslint/no-redundant-type-constituents
  34:3   error  'any' overrides all other types in this intersection type  @typescript-eslint/no-redundant-type-constituents

DO I need to update/change something?

@secustor
Copy link
Collaborator

Looks like you forgot to install the updated dependencies, after merging in main.

@oliverbaehler
Copy link
Contributor Author

@secustor Oh thanks! Sorry really not trying to waste everyone's time.. 3:

Copy link
Collaborator

@secustor secustor left a comment

Choose a reason for hiding this comment

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

needs prettier fix, else LGTM

@oliverbaehler
Copy link
Contributor Author

@secustor thanks, hope it's now fixed

Copy link
Collaborator

@secustor secustor left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@rarkins rarkins added this pull request to the merge queue Oct 15, 2024
Merged via the queue into renovatebot:main with commit be837b6 Oct 15, 2024
39 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 38.124.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@oliverbaehler
Copy link
Contributor Author

@secustor Thanks for merging, just a quick question: Does it take some time to update the version on developer.mend.io?

It keeps telling me that the configuration with the sveltos key is invalid 🤔:

INFO: Repository has invalid config
{
  "error": {
    "validationSource": "renovate.json",
    "validationError": "The renovate configuration file contains some invalid settings",
    "validationMessage": "Invalid configuration option: sveltos",
    "message": "config-validation",
    "stack": "Error: config-validation\n    at mergeRenovateConfig (/usr/local/renovate/lib/workers/repository/init/merge.ts:198:19)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at getRepoConfig (/usr/local/renovate/lib/workers/repository/init/config.ts:14:12)\n    at initRepo (/usr/local/renovate/lib/workers/repository/init/index.ts:56:12)\n    at Object.renovateRepository (/usr/local/renovate/lib/workers/repository/index.ts:64:14)\n    at attributes.repository (/usr/local/renovate/lib/workers/global/index.ts:202:11)\n    at start (/usr/local/renovate/lib/workers/global/index.ts:187:7)\n    at /usr/local/renovate/lib/renovate.ts:18:22"
  }
}

@secustor
Copy link
Collaborator

The hosted app is not updated automatically. Not sure when Mend will update the hosted app again.

@HonkingGoose
Copy link
Collaborator

When is the hosted app updated?

Full quote from Renovate docs, when is the Mend Renovate app updated with new Renovate versions?:

The Renovate maintainers manually update the app. The maintainers don't follow any release schedule or release cadence. This means the Mend Renovate App can lag a few hours to a week behind the open source version. Major releases of Renovate are held back until the maintainers are reasonably certain it works for most users.

How to see which Renovate version you're on

Read Renovate docs, How can I see which version the Mend Renovate app is using? to learn how to find the logs, and how to find the Renovate version.

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

sorry for late comments

Comment on lines +36 to +41
export function extractDefinition(
definition: ProfileDefinition,
config?: ExtractConfig,
): PackageDependency[] {
return processAppSpec(definition, config);
}
Copy link
Member

Choose a reason for hiding this comment

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

wonder why we need this simple wrapper?

};

if (isOCIRegistry(source.repositoryURL)) {
const image = trimTrailingSlash(removeOCIPrefix(source.repositoryURL));
Copy link
Member

Choose a reason for hiding this comment

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

why trim trailing slash? doesn't make sense to me

return dep;
}

function processAppSpec(
Copy link
Member

Choose a reason for hiding this comment

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

this function should be inlined

const repoNameWithSlash = regEx(`^${repositoryName}/`, undefined, false);
let modifiedChartName = chartName.replace(repoNameWithSlash, '');

modifiedChartName = modifiedChartName.replace(/\/+$/, '');
Copy link
Member

Choose a reason for hiding this comment

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

same here, makes no sense and has no tests.

chartName: string,
): string {
const repoNameWithSlash = regEx(`^${repositoryName}/`, undefined, false);
let modifiedChartName = chartName.replace(repoNameWithSlash, '');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let modifiedChartName = chartName.replace(repoNameWithSlash, '');
let modifiedChartName = chartName.substring(repoName.length). replace (regEx('^/'), '');

why not even simpler?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2024
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.

7 participants