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

unexpected commit when renovate is enabled=false #30677

Closed
RahulGautamSingh opened this issue Aug 9, 2024 · 3 comments · Fixed by #30705
Closed

unexpected commit when renovate is enabled=false #30677

RahulGautamSingh opened this issue Aug 9, 2024 · 3 comments · Fixed by #30705
Assignees
Labels
core:onboarding Related to the onboarding process priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@RahulGautamSingh
Copy link
Collaborator

What would you like help with?

I think I found a bug

How are you running Renovate?

Mend Renovate hosted app on github.com

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

github,bitbucket

Please tell us more about your question or problem

to reproduce on renovate cli:

  1. create a new repository (can have a readme file but no package managers).
  2. put these configurations in your config.js
  onboarding: true,
  onboardingNoDeps: true,
  enabled: false
  1. run cli on the new repository.

expected results: renovate is disabled, no commits are allowed.
actual:
code reaches here and continues to create an onboarding PR and commits a new branch then closes it.

if (
Object.entries((await extractAllDependencies(mergedConfig)).packageFiles)
.length === 0
) {
if (!config?.onboardingNoDeps) {
throw new Error(REPOSITORY_NO_PACKAGE_FILES);
}
}
logger.debug('Need to create onboarding PR');

check logs.

Logs (if relevant)

Logs

DEBUG: manager extract durations (ms) (repository=philipabed/disabled-commit)
       "managers": {}
DEBUG:
         Found 0 package file(s) (repository=philipabed/disabled-commit)
DEBUG: Need to create onboarding PR (repository=philipabed/disabled-commit)
DEBUG: createOnboardingBranch() (repository=philipabed/disabled-commit)
DEBUG: Checking for a default Renovate preset which can be used. (repository=philipabed/disabled-commit)
DEBUG: Checking for preset: local>philipabed/renovate-config (repository=philipabed/disabled-commit)
DEBUG: Preset file default.json not found in philipabed/renovate-config: Response code 404 (Not Found)} (repository=philipabed/disabled-commit)
DEBUG: Preset file renovate.json not found in philipabed/renovate-config: Response code 404 (Not Found)} (repository=philipabed/disabled-commit)
DEBUG: Checking for preset: local>philipabed/.bitbucket:renovate-config (repository=philipabed/disabled-commit)
DEBUG: Preset file renovate-config.json not found in philipabed/.bitbucket: Response code 404 (Not Found)} (repository=philipabed/disabled-commit)
DEBUG: No default org/owner preset found, so the default onboarding config will be used instead. (repository=philipabed/disabled-commit)
DEBUG: onboarding config (repository=philipabed/disabled-commit)
       "config": {"$schema": "https://docs.renovatebot.com/renovate-schema.json"}
DEBUG: Creating onboarding branch (repository=philipabed/disabled-commit)
DEBUG: Preparing files for committing to branch renovate/configure (repository=philipabed/disabled-commit)
DEBUG: Setting git author name: Self-hosted Renovate Bot (repository=philipabed/disabled-commit)
DEBUG: Setting git author email: [email protected] (repository=philipabed/disabled-commit)
DEBUG: git commit (repository=philipabed/disabled-commit)
       "deletedFiles": [],
       "ignoredFiles": [],
       "result": {
         "author": null,
         "branch": "renovate/configure",
         "commit": "04f5316582737f923fe57991259faea090b1001d",
         "root": false,
         "summary": {"changes": 1, "insertions": 3, "deletions": 0}
       }
DEBUG: Pushing refSpec renovate/configure:renovate/configure (repository=philipabed/disabled-commit)
DEBUG: git push (repository=philipabed/disabled-commit)
         "ref": {"local": "refs/remotes/origin/renovate/configure"},
           "all": [
             "https://bitbucket.org/philipabed/disabled-commit/pull-requests/new?source=renovate/configure&t=1"
         }
       }
 INFO: Branch created (repository=philipabed/disabled-commit, branch=renovate/configure)
       "commit": "04f5316582737f923fe57991259faea090b1001d",
       "onboarding": true
DEBUG: Merge onboarding branch in default branch (repository=philipabed/disabled-commit)
DEBUG: Create Onboarding Cache (repository=philipabed/disabled-commit)
       "onboardingCache": {
         "defaultBranchSha": "226d0605f9e12221afe4089db662c29272dbe96f",
         "onboardingBranchSha": "04f5316582737f923fe57991259faea090b1001d",
         "isConflicted": false,
         "isModified": false
       }
       "branchList": [],
       "renovateBranches": ["renovate/configure"]
DEBUG: remainingBranches=renovate/configure (repository=philipabed/disabled-commit)
DEBUG: findPr(renovate/configure, undefined, open) (repository=philipabed/disabled-commit)
DEBUG: getPrList() (repository=philipabed/disabled-commit)
 INFO: Deleting orphan branch (repository=philipabed/disabled-commit, branch=renovate/configure)
DEBUG: Deleted remote branch: renovate/configure (repository=philipabed/disabled-commit)
DEBUG: Deleted local branch: renovate/configure (repository=philipabed/disabled-commit)

Originally posted by @PhilipAbed in #29384

@RahulGautamSingh RahulGautamSingh changed the title ### What would you like help with? unexpected commit when renovate is enabled=false Aug 9, 2024
@RahulGautamSingh RahulGautamSingh self-assigned this Aug 9, 2024
@RahulGautamSingh RahulGautamSingh added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality core:onboarding Related to the onboarding process labels Aug 9, 2024
@RahulGautamSingh
Copy link
Collaborator Author

It occurs because enabled:false inside config.js basically is like turning the bot off. Hence, this case was not handled. I will add a check to make sure we return early from onboarding logic.

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Aug 12, 2024

While the linked PR fixes the issue the user is facing. I think logically the check should be placed here:

await instrument('config', async () => {
// read global config from file, env and cli args
config = await getGlobalConfig();

So we do not process at all, incase file config disables the bot.

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 38.25.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
core:onboarding Related to the onboarding process priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants