Skip to content

Add --manage-repos parameter for forge deploy-dev#570

Merged
ehelms merged 1 commit into
theforeman:masterfrom
jeremylenz:feature-conflicts
Jul 2, 2026
Merged

Add --manage-repos parameter for forge deploy-dev#570
ehelms merged 1 commit into
theforeman:masterfrom
jeremylenz:feature-conflicts

Conversation

@jeremylenz

@jeremylenz jeremylenz commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Why are you introducing these changes? (Problem description, related links)

When iterating on Foreman or plugin code during development, forge deploy-dev clones and checks out the default branch for each repository, discarding any local branches or changes. There is no way to disable this behavior for subsequent deploys.

What are the changes introduced in this pull request?

  • Add --manage-repos CLI parameter for forge deploy-dev that controls whether git repositories are cloned and checked out. Set to false to skip repository management for both Foreman and plugins.
  • When --manage-repos=false, the global setting takes precedence but individual plugin manage_repo config is still respected when the global flag is not set.

How to test this pull request

Steps to reproduce:

  • Run forge deploy-dev to do an initial deploy
  • Check out a custom branch in Foreman or a plugin directory
  • Run forge deploy-dev --manage-repos=false and verify repositories are not touched

Checklist

  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)

@ehelms

ehelms commented Jul 1, 2026

Copy link
Copy Markdown
Member

@jeremylenz I extracted your conflicts idea from this PR and modified it a bit -- #610

@jeremylenz jeremylenz force-pushed the feature-conflicts branch from 2547caf to eb72d3b Compare July 1, 2026 17:12
@jeremylenz jeremylenz changed the title Add feature conflicts and parameter persistence for forge Add --preserve-plugin-branches parameter for forge deploy-dev Jul 1, 2026
@jeremylenz jeremylenz marked this pull request as ready for review July 1, 2026 17:12
@jeremylenz

jeremylenz commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Updated this PR to include only the --preserve-plugin-branches --preserve-branches --manage-repos functionality. I will also open a new PR for the answers persistence

@jeremylenz

Copy link
Copy Markdown
Contributor Author

I will also open a new PR for the answers persistence

#612

@jeremylenz jeremylenz force-pushed the feature-conflicts branch from eb72d3b to b836a57 Compare July 1, 2026 17:21
@jeremylenz jeremylenz changed the title Add --preserve-plugin-branches parameter for forge deploy-dev Add --preserve-branches parameter for forge deploy-dev Jul 1, 2026
@jeremylenz jeremylenz force-pushed the feature-conflicts branch from b836a57 to c68a398 Compare July 1, 2026 17:44
help: GitHub username to add as additional remote for git checkouts
action: store
foreman_development_preserve_branches:
parameter: --preserve-branches

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Down in https://github.com/theforeman/foremanctl/pull/570/changes#diff-298320288bbee9edf592c4fb437fe1e71276c3a877b2e3290a2fa26dbd6b9916R157 this uses manage_repo naming but does it on a per plugin basis. What do you think about calling this something like that? e.g. --manage-repos=False

As you aren't simply "preserving branches" you are actually disabling management of the repositories by the tool.

If your intent was just to simply avoid it over-writing the checkout, then I think you'd want to actually set https://github.com/theforeman/foremanctl/blob/master/development/roles/git_repository/tasks/main.yml#L6 in which case it would preserve.

Also, we maybe drop https://github.com/theforeman/foremanctl/blob/master/development/roles/git_repository/tasks/main.yml#L5C18-L5C41 ? or set it to omit unless that variable is set so that it doesn't enforce check out of a particular version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My understanding is the Ansible git module can overwrite local commits, and discard uncommitted changes. So skipping the task still seems safest to me.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeremylenz jeremylenz force-pushed the feature-conflicts branch from c68a398 to 373a57d Compare July 1, 2026 19:44
@jeremylenz jeremylenz changed the title Add --preserve-branches parameter for forge deploy-dev Add --manage-repos parameter for forge deploy-dev Jul 1, 2026
@ehelms ehelms merged commit b44e9e7 into theforeman:master Jul 2, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants