Using Git in HCP for your Fiori developments
What is Git and why do I need it?
In short, the Fiori User Interface (UI5) code does not have the equivalent of version management like ABAP does. Sure, when you deploy your UI5 code to your Gateway/Fiori server, a copy of the executable files are stored; but the whole workspace is not.
That’s where Git repositories come in. In fact, most of the software industry seems to use Git repositories now days; so it’s not too scary; and unlike ABAP; it supports multiple versions, concurrent development, merging; and a whole bunch of other cool stuff.
So anyway, why do you need it? Well you just do okay – trust me 😉
Git Repositories and HCP
Now that we have a way of getting into HCP without pulling out the corporate credit card; we can start to leverage WebIDE and the features of HCP. One of these features is the Git repositories.
Previously I had been using github.com which works perfectly (if you have access to it); and having your own on-premise git repository would work fine also. But until today, I had not tried to use the HCP Git, but it’s surprisingly easy.
Creating an Extension project with an HCP Git Repository
So within the HCP Cockpit, you’ll need someone with administrator access to create an appropriate named git repository for your extension.
Navigate to Git Repositories and select New Repository:
Name the repository and keep the “create empty commit” checked and press OK!
Go into the repository and then select Web IDE to open Web IDE and automatically kick off the clone repository process (which simply creates a project folder linked to this Git Repository). Note – You’ll need to enter your S-User (or similar) Id and Password.
Commit and Push when you receive this pop-up.
Note – If you do the above too quickly, you can sometimes hit an issue that the repository is not fully set-up (I think!).
Let’s now create the extension project into this Project Folder:
Select File->New->Extension Project
Now select the Fiori app to extend, and very carefully type in your new project folder as the name of the extension project:
Press Next, uncheck the extension pane checkbox and Finish.
If you select the Git pane on the right hand side; you can select Stage all check box; enter a comment and press Commit and Push (to origin/master).
Other users can then access the git repository through the Web IDE link from the cockpit; and you can start branching off, merging, pulling, fetching, rebasing and all the other cool terms that I always defer to Nigel James to explain to me…
Bonus Item #1 – Github Desktop with HCP Git Repository
Oddly enough, if you use Github desktop (I do because I find the diff tool when set-up correctly very powerful for merging branches) doesn’t support cloning the repository directly. That said, all you need to do is go to the command line, type git clone <repository link from the HCP Cockpit>, entering your username/password to get a local copy of the repository; then from within Github desktop, you can add the repository using the add local repository option (then it’s just the same as if you cloned it from Github.com at that point.
Bonus Item #2 – Getting mockdata working with My Inbox
For a few reasons, it’s not immediately obvious how to get the mock data provided by My Inbox to work. But if you want to get it working (which is very handy); do the following:
• Create a folder under localService called mockdata
• Cut and Paste all the JSON files under localService into mockdata
• Under project settings, change the mock data to match the following screenshot:
• Create a run configuration with “Run with mock data” set, ensuring that allItems = true within the URL Components
• Save and Run!
Result with mock data (unfortunately without the Fiori Launchpad which has the subscription functionality:
Very cool! thanks for the write up....I like the "very carefully type in" part....trying to say something in a subtle way there? hahaha
Hi Matt,
We still cannot use HCP (hanatrial) in any real-world productive deployment - there's still a lot of Customers rolling out UI5 hosted on ABAP Engine, would you recommend them to either get Github Enterprise (when codes need to be in-house) or another Git stack?
It seems the "proposed" solution on SAP side (as you highlight) to have your source code (UI5) in a source control system is to pay productive license of HCP and do everything via HCP Connector?
Cheers,
Dan.
Hi Dan,
First, check out the last option here in the SAP Store:
https://www.sapstore.com/solutions/99023/SAP-HANA-Cloud-Platform%2C-user-based-packages
Effectively a 10 (developer) user license for free which should get you going (though not clear on the support of this in terms of backups if someone wipes your git repo - which is surprisingly easy to do).
In terms of the what repo; I'm far from the expert here to advise; and it also depends on the customer and if they'll pay, and how much they'll pay.
Besides, maybe the code is not sensitive (except for the developer) and you can just have a public company github account; but many would be uncomfortable with that.
BTW - HCP Connector is not required to use the HCP git...
Cheers,
Matt
Hi Matt,
Thanks for the reply.. will check the link you've sent later on as right now:
Sorry for the inconvenience, but SAP Store is currently down for maintenance. We expect to be back up and running shortly, so please try again soon.
I got carried away with the Cloud Connector, probably because of Web IDE stuff.. I find it too complicated.. There are git solutions (open source) which takes less than 1 hour for a full setup (docker), with CI and a good number of out-of-box integration but still, I talk to people and explain the situation and everyone is reluctant to understand that unless you are on HCP there's no "viable offering" from SAP on source control system of UI5.. everyone seems to believe that UI5 BSP repo is good enough, maybe is just the region I'm working - I don't know.
Would be kinda nice to have some "official" information on how SAP would "advise" source control on UI5 other than of course, paying HCP licenses - some customers don't even allow code to be stored outside their network, there has to be either a solution or a recommendation in place.. I still cannot find any document branded with "SAP" about this topic.
Cheers,
Dan.
Hi Dan,
Unofficially, you definitely need some Git repo to manage your UI5 code; and if you're not using WebIDE, you should look at grunt and grunt-openui5 in order to generate the component-preload files for performance reasons. WebIDE tries to make all this easy for developers, but many don't even realise what is possible (or what happens behind the scenes).
Lots of people can comment much more on this issue, but I've been recommending people just get the free version of HCP* to begin with, and get their GIT Repo happening that way. While the non-Enterprise software business don't seem to have any issues with looking into this type of set-up; many in SAP still expect everything to just work without thinking about why. Odd, but then, I suppose the end goal is you don't need developers, (but luckily; until we have true AI; that's not going to happen).
Cheers,
Matt
ed: * Just found out the HCP Free Edition is actually just a trial that you need to pay for when it runs out (which makes this a very expensive tool for a webide/git developer based on minimum users required to license the paid editions)!