Bug 1600961

Summary: [RFE] Add ability to create a Git backed automation domain
Product: Red Hat CloudForms Management Engine Reporter: Fabien Dupont <fdupont>
Component: APIAssignee: Joe Vlcek <jvlcek>
Status: CLOSED ERRATA QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact:
Priority: high    
Version: 5.10.0CC: jocarter, jvlcek, kborole, obarenbo, pvala, simaishi, ssainkar
Target Milestone: GAKeywords: FutureFeature, RFE
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-12 13:33:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:

Description Fabien Dupont 2018-07-13 13:09:24 UTC
It would be great to be able to create a Git backed automation domain through the API. An example use case is bootstraping a ManageIQ appliance with domains managed with Git. This would also be helpful in a CI/CD approach as only the dev environment would have non Git domains.

The Git repository should not be exposed on its own. I would expect an API call similar to:

POST /api/automate_domains
{
  "name": "AwesomeDomain",
  "description": "Bob's awesome domain",
  "source": "git",
  "git_repository": {
    "url": "https://github.com/Bob/AwesomeDomain",
    "branch": "production"
  }
}

The Git repository object would be created by the backend because the user creates a Git backed domain. Then, in a CI/CD context, there would be developers' domains, with a merge policy. Then, a tool like Jenkins would call the refresh_from_source action on the repo when the content of the repo changes.

Comment 4 CFME Bot 2019-04-24 19:47:05 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:

https://github.com/ManageIQ/manageiq-ui-classic/commit/1c84269e3a0f97ed18502d615f21a5687ba65df1
commit 1c84269e3a0f97ed18502d615f21a5687ba65df1
Author:     Joe VLcek <jvlcek>
AuthorDate: Mon Apr  1 17:12:33 2019 -0400
Commit:     Joe VLcek <jvlcek>
CommitDate: Mon Apr  1 17:12:33 2019 -0400

    Add support for passing custom options for import_git_url

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1600961

 app/services/git_based_domain_import_service.rb | 4 +-
 spec/services/git_based_domain_import_service_spec.rb | 30 +-
 2 files changed, 27 insertions(+), 7 deletions(-)

Comment 5 CFME Bot 2019-04-24 19:49:14 UTC
New commit detected on ManageIQ/manageiq-api/master:

https://github.com/ManageIQ/manageiq-api/commit/7dc297024a5d57f79d17cf22ee2d9a1992706d92
commit 7dc297024a5d57f79d17cf22ee2d9a1992706d92
Author:     Joe VLcek <jvlcek>
AuthorDate: Mon Mar 18 14:17:30 2019 -0400
Commit:     Joe VLcek <jvlcek>
CommitDate: Mon Mar 18 14:17:30 2019 -0400

    Add create Git backed automation domain

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1600961

 app/controllers/api/automate_domains_controller.rb | 42 +
 config/api.yml | 6 +-
 spec/requests/automate_domains_spec.rb | 60 +
 3 files changed, 107 insertions(+), 1 deletion(-)

Comment 6 Parthvi Vala 2019-06-10 11:58:27 UTC
FIXED. Verified on 5.11.0.7.

One suggestion: Unlike the UI import, this imported datastore is disabled at first, it needs to be enabled later on. It would be nice to keep both UI and REST behaviour consistent.

Comment 7 Parthvi Vala 2019-06-10 12:03:31 UTC
(In reply to Parthvi Vala from comment #6)
> FIXED. Verified on 5.11.0.7.
> 
> One suggestion: Unlike the UI import, this imported datastore is disabled at
> first, it needs to be enabled later on. It would be nice to keep both UI and
> REST behavior consistent.

I guess this depends on the datastore that's being imported, ignore the suggestion then!

Comment 11 errata-xmlrpc 2019-12-12 13:33:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:4199