facebook

Import Git Projects via Workspace Task

  1. Secure Delivery Center
  2.  > 
  3. Getting Help
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #336054 Reply

    sdc-support
    Member

    Hello SDC users.

    We have been working on a “Git Projects Workspace Task” for SDC. This workspace task lets you define a set of Git repositories with the projects you want to automatically include on your Eclipse Package. When your team installs the configured eclipse package the Git Workspace Task will clone the specified repositories and will add the specified projects to your workspace.

    We kicked off this project based on our own needs, our development environment is managed with SDC and Git and we needed an easy way to set up or Eclipse packages with our projects. Given the global appeal of Git, we also wanted to share this plugin with you since you may well have similar needs.

    Before completely finalizing this Git task, we would like to solicit feedback and ideas from you in your own uses of Git.

    Our current Git Task is very capable, but like all things, your ideas can make it even better. The main goal is to include this feature into SDC in future versions so it will be available for everyone, and as it is based on Google Workspace Mechanic, could potentially be leveraged in other ways down the road if there is sufficient interest.


    The Git Task Model

    Before diving into how to begin using this Git task, we’d like to introduce the model we are using for the Git projects. In essence, it covers the repositories, branches, and projects you want to cover. If the task detects existing repositories, it will automatically look for missing projects to be imported, and helps you manage the ongoing usage of your Git repositories, not just the initial configuration.

    The following is an example .git task file that includes two different repositories.

    <git>
     <repository name="main project" uri="ssh://myHost:7022/home/my/repository">
       <!-- Credentials can be provided for defaults if appropriate -->
       <credentials mode="BOTH"/>
       <!-- All or some branches can be configured -->
       <remote-branches>
         <remote-branch remote="origin" reference="refs/heads/master"  
           clone-submodules="true" />
       </remote-branches>
       <local-branches>
         <local-branch name="master" based-on="refs/heads/master" active="true" />
       </local-branches>
       <!-- You can either opt-in or opt-out of projects in a repository -->
       <import-all-projects>
         <exclude>                
           <project name="first.project.to.exclude"/>
           <project name="second.project.to.exclude"/>
         </exclude>
       </import-all-projects>
     </repository>
    
     <repository name="org.eclipse.epp.mpc"
       uri="git://git.eclipse.org/gitroot/mpc/org.eclipse.epp.mpc">
       <credentials mode="NONE" />
       <remote-branches>
         <remote-branch remote="origin" reference="refs/heads/maintenance_1_1_x"
           clone-submodules="true" />
       </remote-branches>
       <local-branches>
         <local-branch name="maintenance_1_1_x" based-on="refs/heads/maintenance_1_1_x"
           active="true" />
       </local-branches>
       <import-projects>
         <project name="org.eclipse.epp.mpc.core"/>
       </import-projects>
     </repository>
    <git>

    Begin Using the Git Task With SDC

    1. Import the attached archived update site into your admin console as a Third-Party Library.
    2. Add Git Workspace Task to the Eclipse package(s) you want to configure (see the Software Tab of the package and the Third-Party Library you imported).
    3. Create a task file with .git extension with your definition of Git repositories and projects you want automatically configured in your Eclipse package(s).
    4. Add the task file to your package(s) on the Workspace Configuration section of the Configuration tab.
    5. Commit and promote the package.
    6. Install the package.
    7. Configure repository locations and/or supply credentials when prompted.

    The following screenshot gives an idea of how the repositories are currently configured when presented to the user. Credentials can be configured, and paths tailored. This allows the user to quickly setup the configuration for their system.

    See attachment git import settings page.png

    Creating Your Git Task File (.git)

    You can use any text editor to create your Git task file. If your editor supports XML validation and content assist, you can configure it to use the attached XML Schema Definition (xsd) to help you author your task files. To leverage code assist, you can start with an XML file extension and just change the extention to .git when you are ready to use it on SDC. Alternatively, you can set up your editor to recognize .git files as XML.

    If you take a look at the schema definition you will get an idea of what our model supports and the requirements of it, but we are more than happy to help you with specific questions about the configuration.

    If you have any doubts, suggestions or questions please feel free to post it, we will be happy to hear from you and help you.

    Best Regards.
    Héctor – SDC Developer

    Attachments:
    You must be logged in to view attached files.
    #353594 Reply

    jdeyton
    Member

    I just tried this out, and it works great!

    Here are a couple of questions I have…

    1) If we’ve already configured defaults through the workspace task, couldn’t we “silently” check out the git repos? In other words, unless there’s some sort of problem accessing the repos, can’t it just automatically check them out (assuming the repo is public)?
    2) For our project, the desired base folder for git repos is actually the workspace (I think this is because some of our senior developers like to have multiple workspaces). Is this a setting that’s pulled from a git or Eclipse config file somewhere, or could we have an option in the XML to set the default base path to the workspace folder?

    Also, sorry for the thread necrophilia, but I figured it would be better to give feedback where it was originally requested.

    Thanks!
    Jordan

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Import Git Projects via Workspace Task

You must be logged in to post in the forum log in