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

rebase onboarding branch does not respect commitMessagePrefix #10854

Closed
3 of 15 tasks
tstollin opened this issue Jul 15, 2021 · 6 comments · Fixed by #11171
Closed
3 of 15 tasks

rebase onboarding branch does not respect commitMessagePrefix #10854

tstollin opened this issue Jul 15, 2021 · 6 comments · Fixed by #11171
Assignees
Labels
good first issue Suitable for new contributors priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@tstollin
Copy link

How are you running Renovate?

  • WhiteSource Renovate hosted app on github.com
  • Self hosted (official docker image in on premise Kubernetes CronJob)

If using the hosted app, please skip to the next section.
Otherwise, if self-hosted, please complete the following:

Please select which platform you are using:

  • Azure DevOps (dev.azure.com)
  • Azure DevOps Server
  • Bitbucket Cloud (bitbucket.org)
  • Bitbucket Server
  • Gitea
  • github.com
  • GitHub Enterprise Server
  • gitlab.com
  • GitLab self-hosted

Renovate version: 25.49.5 (official docker image)

Describe the bug
In our enterprise environment, we are required to prefix all commit messages with Jira Issue IDs. To pass this regex check, we use the configuration option commitMessagePrefix to add a placeholder issue to all commits.
This works fine for creating onboarding PRs and update PRs.

But for rebasing onboarding PRs the commitMessagePrefix is ignored and our renovate CronJob fails due to the push being blocked.

To test the behaviour we deactivated the check (which is no longterm solution due to it being a compliance requirement). This created these changes on the onboarding PR:
renovate

A solution should be for getCommitMessage(config: RenovateConfig) in rebase.ts

function getCommitMessage(config: RenovateConfig): string {
const configFile = defaultConfigFile(config);
let commitMessage: string;
// istanbul ignore if
if (config.semanticCommits === 'enabled') {
commitMessage = config.semanticCommitType;
if (config.semanticCommitScope) {
commitMessage += `(${config.semanticCommitScope})`;
}
commitMessage += ': ';
commitMessage += 'add ' + configFile;
} else {
commitMessage = 'Add ' + configFile;
}
return commitMessage;
}

to honour the config commitMessagePrefix just like create.ts does:

let commitMessagePrefix = '';
if (config.commitMessagePrefix) {
commitMessagePrefix = config.commitMessagePrefix;
} else if (config.semanticCommits === 'enabled') {
commitMessagePrefix = config.semanticCommitType;
if (config.semanticCommitScope) {
commitMessagePrefix += `(${config.semanticCommitScope})`;
}
}
if (commitMessagePrefix) {
commitMessagePrefix = formatCommitMessagePrefix(commitMessagePrefix);
}
let onboardingCommitMessage: string;
if (config.onboardingCommitMessage) {
onboardingCommitMessage = config.onboardingCommitMessage;
} else {
onboardingCommitMessage = `${
commitMessagePrefix ? 'add' : 'Add'
} ${configFile}`;
}

...

Relevant debug logs

Click me to see logs
Copy/paste any log here, between the starting and ending backticks

Have you created a minimal reproduction repository?

Please read the minimal reproductions documentation to learn how to make a good minimal reproduction repository.

  • I have provided a minimal reproduction repository
  • I don't have time for that, but it happens in a public repository I have linked to
  • I don't have time for that, and cannot share my private repository
  • The nature of this bug means it's impossible to reproduce publicly

Additional context

...

@tstollin tstollin added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality labels Jul 15, 2021
@rarkins
Copy link
Collaborator

rarkins commented Jul 15, 2021

What does your exact bot config look like? (sanitized but not simplified)

@tstollin
Copy link
Author

tstollin commented Jul 15, 2021

Sorry, i forgot to include it. It looks like this:

    {
      "dryRun" :            false,
      "endpoint":           "<private bitbucket server url>",
      "platform":           "bitbucket-server",
      "autodiscover":       false,
      "username":           "renovate",
      "gitAuthor":          "Renovate <internal renovate user mail>",
      "npmrc":              "registry=<private repository url>\n",
      "maven": {
        "enabled": true
      },
      "hostRules": [{
        "hostType": "maven",
        "baseUrl": "<private repository url>"
      }],
      "packageRules": [{
        "matchManagers": ["maven"],
        "registryUrls": ["<private registry url>"]
      }],
      "branchPrefix":       "versioncheck/",
      "commitMessagePrefix": "REPLACEME-666",
      "repositories": [
        <removed>
      ]
    }

@rarkins rarkins added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:ready and removed priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started labels Jul 18, 2021
@rarkins
Copy link
Collaborator

rarkins commented Jul 18, 2021

It seems like we should have a common function for determining the commit message for create and rebase/update.

@rarkins rarkins added the good first issue Suitable for new contributors label Jul 26, 2021
@pret-a-porter
Copy link
Contributor

@rarkins I will take this issue

@tstollin
Copy link
Author

Thank you @pret-a-porter

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 25.72.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, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Suitable for new contributors 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.

4 participants