cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Ask the Expert: How can I use Git to achieve continuous integration with ThingWorx?

No ratings

Disclaimer: Please note that, while the ThingWorx Git Backup Extension is a very useful tool, it is not a PTC product, nor is it supported by PTC.

 

Hi ThingWorx users,

 

Trying to manage your ThingWorx application artifacts in a CI process? Wondering who changed that line of code in your Thing Service? Trying to see what your Mashup looked like last release? Time to Git excited! Introducing the Git Backup Extension, an open-source tool available here to offer a stronger integration with the Git source repository. This Git feature can push or pull code and artifacts (like entities, data exports or extension dependencies) to your Git repository.

 

Here are some highlights of how this works within ThingWorx:

 

First, configure your Git repo to work with ThingWorx by creating a Git Backup Thing. Then, simply open your new Thing, navigate to the Configuration editor and enter information like your Git URL, your Git username and password, your repo and branch names, etc. See example below.

imageConfiguring your Git repoWith this configuration in place, you can now use the Home Mashup of this new Git thing to browse the repository and pull down contents to your local ThingWorx instance. For new projects, you can also push new entities to the repo as you work on your application.

 

As you and your team are working, you’ll want to see the differences of the files you are editing and working on collaboratively. The Git extension feature makes this easy. Just like you can see diffs clearly delineated for a file with your Git client, you can see the same with this Git integration in ThingWorx. Similar to the git status command, the Git ThingWorx extension will show you the list of files you have changed that are available to push, as well as their diffs. See an example below.

imageChecking the Git status

While working, if you want to switch branches or pull down a new project, you can check out a specific version and see all commits available on that branch (see below).

imageChecking out a specific commit

Want to learn more or try it for yourself? Find the open-source Git Backup Extension here and check out the Git Backup Extension User Guide for guidance.

 

Stay connected,

Kaya

 

P.S. What do you think? Comment your thoughts below!

Comments

Great article!

Hi Kaya!

 

Do you know if an equivalent extension exists, providing configuration management integration with SVN (Apache Subversion)?

SVN is still often the default configuration management system on a lot of projects.

Thanks,

Sébastien

Hi Sébastien,

 

Thanks for reaching out. Currently, we do not have plans for SVN for the Extension. Although, as you may already know, SVN can be used with ThingWorx through the "Export to Source Control" feature of our entities/application constructs.

 

Hey users, anyone else want SVN? Comment here!

 

-Kaya

Thanks Kaya.

The export entities for Source Control does not provide an easy "thing by thing" handling (checkout/commit) like the Git extension.

Regards,

Sébastien

Hi,

I have installed this extension and configured.

I am not able to see any repository on mashup page .

 

I am able to use all git commands from repository created into storage, but only tis it is not getting displayed in mashup. Find attached screen shot for reference.

 

Let me know if anyone has faced this issue.

 

Thanks in advance,

Vishwas

Vishwas, can you share the values from the Configuration page from that Git thing that was created?

Also, can you share if the Thing has a ThingShape attached in the General Information page?

imageGitbackup ThingimageHi,

Please find attached screen shots for same.

 

Can you first check if the bitbucket url link is in the format https://bitbucket.org/[user/team]/[repositoryname] ?
Second, are you using absolute or relative paths in your platform-settings.json file?
Third, have you tried doing a Pull and post the results of the Application Log?

Hi:

Can you first check if the bitbucket url link is in the format https://bitbucket.org/[user/team]/[repositoryname] ?

<Vishwas> Yes Bitbucket URL is this format


Second, are you using absolute or relative paths in your platform-settings.json file?

<Vishwas> Its absolute path
Third, have you tried doing a Pull and post the results of the Application Log?

<Vishwas> I was getting error in application logs

[context: com.thingworx.webservices.context.HttpExecutionContext@2eb0da7b][message: File Repository Must Be Specified]

but after some time that error also gone.

Now not getting any error.

 

I can do all operations by going to that repository into file system but not able to see in mashup.

Thanks,

Vishwas

This was fast to solve, as the mashup is supposed to be only used from the HomeMashup section of the Thing, while Vishwas opened it as a separate mashup (and it did not receive the Thing name, so all the services had no context to run on).

Thanks Vladimir,

It was really quick.

I think this extension is must have for any project and should be included in out of the box ThingWorx product.

 

Vishwas

Hello

 

Is the Git backup extension still available? I can't find it on the Marketplace. And is it compatible with Thingworx 8.5?

Hi. The extension is hosted in the following GitHub repository, downloadable at the release section:
https://github.com/vrosu/thingworx-gitbackup-extension
You can also get access to its source code there.

Version 3.0.0 was released:

-it was tested against ThingWorx version 8.5.x

-removes the lastModifiedDate to allow easier to understand commits

-allows developers to commit using their own Commit Name and Email (persistence per user, via UserExtensions ThingShape)

-documentation updated

GitBackup version 3.0.1 was released:

-tested to allow compatibility from 8.2.0 (Community enhancement - Petrisor Lacatus)

Hi,

 

I am using ThingWorx 8.3.13-b41 version of thingworx and I am not able to load the GitBackupExtension. It is showing me one error.

Log Messages

[context: Extension Exception][message: Error parsing C:\ThingworxStorage\extensions\temp\GitBackupExtension_01b44814-6635-4b4a-ae7c-26f76106359a\GitBackupExtension\Entities\Mashups_GitBackup.Export.Mashup.xml: (1722, 22): cvc-complex-type.2.4.a: Invalid content was found starting with element 'preview'. One of '{Owner, ConfigurationChanges}' is expected.]

Error parsing C:\ThingworxStorage\extensions\temp\GitBackupExtension_01b44814-6635-4b4a-ae7c-26f76106359a\GitBackupExtension\Entities\Mashups_GitBackup.Export.Mashup.xml: (1722, 22): cvc-complex-type.2.4.a: Invalid content was found starting with element 'preview'. One of '{Owner, ConfigurationChanges}' is expected.

but also see "Finished migrating from version [8.3.0] to version [8.3.0]." and "Successfully added for import C:\ThingworxStorage\extensions\temp\GitBackupExtension_01b44814-6635-4b4a-ae7c-26f76106359a\GitBackupExtension\Entities\Mashups_GitBackup.Checkout.Mashup.xml" 
It's caused because the <preview> node is present in the Mashup export files. I believed that was fixed, but I did not have the chance to test on 8.3.13 specifically. If you feel comfortable, you can remove the preview node manuall (the files are in the Entities folder), and repack the extension. If not, I suggest working with the 2.1.0 in the mean time if that works for you.

Thanks, I found <preview> in 7 mashups and when I tried to import it again, I faced below issues which I resolved by removing the attributes ( 'aspect.bindingDirection', 'aspect.isMandatory' and  'aspect.isFlex' ) from the properties. Not sure about the impact of these changes which I made to resolve this issue.

Error parsing C:\ThingworxStorage\extensions\temp\GitBackupExtension_500ad6c5-cd57-4368-93ec-79fecab9eabc\GitBackupExtension\Entities\Mashups_GitBackup.NewRepo.Mashup.xml: (47, 30): cvc-complex-type.3.2.2: Attribute 'aspect.bindingDirection' is not allowed to appear in element 'FieldDefinition'.

 

Error parsing C:\ThingworxStorage\extensions\temp\GitBackupExtension_bdf1f3ba-bf3e-42b3-810f-a933d1079211\GitBackupExtension\Entities\Mashups_GitBackup.NewRepo.Mashup.xml: (46, 30): cvc-complex-type.3.2.2: Attribute 'aspect.isMandatory' is not allowed to appear in element 'FieldDefinition'.

 

Error parsing C:\ThingworxStorage\extensions\temp\GitBackupExtension_ae9c5436-ea48-4898-babd-540e0ea8806e\GitBackupExtension\Entities\Mashups_GitBackup.PushSettings.Mashup.xml: (25, 18): cvc-complex-type.3.2.2: Attribute 'aspect.isFlex' is not allowed to appear in element 'Mashup'.

 

 

Thanks for updating us BABA-SHYAM. Those aspects are all 8.5.x specific (from what I remember) and were introduced for Mashup Parameters (first two) and the new flex layout (the third). It should work fine without those attributes.

One more issue I have faced.. after connecting my fresh repo with azure repo(fresh), it was not pushing or pulling anything. I am facing some issues of unauthorized access.

=====>>>>

Pull Error: org.eclipse.jgit.api.errors.TransportException: https://NewOrg21@dev.azure.com/NewOrg21/ThingworxProject/_git/ThingworxProject: not authorized at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:255) at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:296)

=====>>>>
To resolve this, I opened my local repo in cmd and ran "git push --set-upstream origin master" command. I am perfectly synced with Azure and call perform pull & push without any issue using cmd. What it means is, when I set the configuration with Azure, it created ".git" hidden folder which contains the info of out remote repo which is azure in our case. I am not getting connected by pull & push services because it says unauthorized access how ever able to do so using cmd.

Regards
Shyam

Check the following items:

1. If you used your complete Azure account username as the Git username (which means your complete email address)

2.  If you used your Azure account password as the password in the GitBackupExtension

Yes I have used complete email address and correct password. In-fact I double checked while changing it manually on the thing created after the process. Find below snap shot. My bit bucker username is different than azure's one.

 

Regards

Shyam

Try to use instead use an Azure Devops Personal Access Token in the password dialogue.
It might be that you can't use the account password because 2FA.

Thanks... Instead of password I used Personal Access Token which I generated in Azure. 
So username = full email
password = PAT

Regards

Shyam

Sorry for asking, did this solve your issue ?

yes.. I was able to connect to azure repo further facing issues with new branches created and syncing them again. Sometimes I take help from cmd.

 

regards

Shyam

Yeah, branches must be created in the online Azure interface. After that, do a pull and they should show up in the branch list in the extension UI.

Version history
Last update:
‎Sep 06, 2018 07:06 PM
Updated by:
Labels (2)