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

Replace embedded ansible git repos with GitRepository #19013

Merged
merged 3 commits into from
Jul 22, 2019

Conversation

Fryguy
Copy link
Member

@Fryguy Fryguy commented Jul 19, 2019

@carbonin @NickLaMuro Please review

Some "known" issues for future PRs:

  • GitRepository's clone is not process-safe. We need to add a clone lock around the Dir.exists? call and the actual clone.
  • This does not yet use the SCM credentials. SCM credentials are tied to a ConfigurationScriptSource, but GitRepository is expected to own it's own credentials, so I have a double-ownership problem. GitRepository will have to be refactored somehow before I can handle it, hence why I want to do it in a follow up.
  • The default ansible playbook consolidated thing may not update properly. (i.e. it can clone on first seed, but may not update on subsequent seed)
  • The UI still has the 3 checkboxes that we are going to drop. - Remove Embedded Ansible repository unsused attributes manageiq-ui-classic#5848
  • When we drop the 3 options, we need to create a data migration to remove them from the source.
  • Checkouts created after running the playbook still need to be cleaned up.
  • Git repos over ssh don't work just yet.

@Fryguy Fryguy changed the title Replace embedded ansible git repos with GitRepository [WIP] Replace embedded ansible git repos with GitRepository Jul 19, 2019
@miq-bot miq-bot added the wip label Jul 19, 2019
@Fryguy Fryguy force-pushed the git_repo_embedded_ansible branch 2 times, most recently from ca2b465 to 7695ffc Compare July 19, 2019 21:50
@Fryguy Fryguy changed the title [WIP] Replace embedded ansible git repos with GitRepository Replace embedded ansible git repos with GitRepository Jul 19, 2019
@miq-bot miq-bot removed the wip label Jul 19, 2019
@Fryguy Fryguy force-pushed the git_repo_embedded_ansible branch 5 times, most recently from 6667554 to 8acf7cc Compare July 20, 2019 21:56
@Fryguy
Copy link
Member Author

Fryguy commented Jul 20, 2019

@carbonin @NickLaMuro This is ready to go.

@Fryguy Fryguy force-pushed the git_repo_embedded_ansible branch from 8acf7cc to 5882eb2 Compare July 22, 2019 14:05
@Fryguy
Copy link
Member Author

Fryguy commented Jul 22, 2019

Fixed a couple of rubocops...I'm leaving the rest because they were either already there or I don't agree with them (going to open some guides discussions on the latter)


extra_vars = merge_extra_vars(vars[:extra_vars])

checkout_dir = checkout_git_repository # TODO: what will cleanup this dir?
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a state to the workflow to cleanup the repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can, but it would have to be optional based on a parameter or something. AnsiblePlaybookWorkflow was written expecting the directory to be owned outside of it (i.e. playbooks stored in the manageiq plugins themselves).

Copy link
Member Author

Choose a reason for hiding this comment

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

I was going to do that in a followup.

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@NickLaMuro NickLaMuro left a comment

Choose a reason for hiding this comment

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

I think most of this makes sense. I don't think most of the comments should hold up the merge.

One general question/ask: Can you link to the migration PR that handles adding git_repository_id in this PR? I don't think I got a chance to review that one, though I think it is already merged if it is not

app/models/git_repository.rb Show resolved Hide resolved
app/models/git_repository.rb Show resolved Hide resolved
app/models/git_repository.rb Show resolved Hide resolved
app/models/git_repository.rb Show resolved Hide resolved
app/models/git_repository.rb Show resolved Hide resolved
app/models/git_repository.rb Show resolved Hide resolved
app/models/git_repository.rb Show resolved Hide resolved
lib/git_worktree.rb Show resolved Hide resolved
lib/git_worktree.rb Show resolved Hide resolved
@NickLaMuro
Copy link
Member

NickLaMuro commented Jul 22, 2019

From PR description:

  • The UI still has the 3 checkboxes that we are going to drop.

Related PR: ManageIQ/manageiq-ui-classic#5848

Update: Probably should be in the PR description now.

@Fryguy
Copy link
Member Author

Fryguy commented Jul 22, 2019

Migration PR that added git_repository_id - ManageIQ/manageiq-schema#393

Copy link
Member

@NickLaMuro NickLaMuro left a comment

Choose a reason for hiding this comment

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

Approving just to make it official @agrare

(though, I guess there are merge conflicts now...)

@agrare
Copy link
Member

agrare commented Jul 22, 2019

@Fryguy can you rebase?
Thanks Nick!

@NickLaMuro
Copy link
Member

Put together a branch that fixes the conflicts:

master...NickLaMuro:git_repo_embedded_ansible

And explained what happened with the issue with the private method in the last commit:

c0c2c45

Can turn it into a PR if you want, or you can just use it as a reference to how to fix the conflicts.

Fryguy added 3 commits July 22, 2019 19:12
Additionally, this changes the clone path to use the GitRepository#id to
avoid name clashes between URLs that are similar.
@Fryguy Fryguy force-pushed the git_repo_embedded_ansible branch from 5882eb2 to f878007 Compare July 22, 2019 23:17
@miq-bot
Copy link
Member

miq-bot commented Jul 22, 2019

Some comments on commits Fryguy/manageiq@d892810~...f878007

spec/models/manageiq/providers/embedded_ansible/automation_manager/job_spec.rb

  • ⚠️ - 13 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Jul 22, 2019

Checked commits Fryguy/manageiq@d892810~...f878007 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
11 files checked, 11 offenses detected

app/models/git_repository.rb

app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb

lib/git_worktree.rb

@agrare agrare merged commit d9a9707 into ManageIQ:master Jul 22, 2019
@agrare agrare added this to the Sprint 116 Ending Jul 22, 2019 milestone Jul 23, 2019
@Fryguy Fryguy deleted the git_repo_embedded_ansible branch July 23, 2019 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants