PLUGINS that HELP YOU WORKING WITH ECLIPSE

PLUGINS that HELP YOU WORKING WITH ECLIPSE

PLUGINS

 

ONLINE HELP https://wiki.eclipse.org/EGit/User_Guide

 

Checking Eclipse Network configuration

Your NEtwork connection should be like this with NAtive,Dynamic options, in this configuration Eclipse will take the proxy from yourbrowser settings.

Nevertheless , if you have some troubles with these options, please  change Native into Manual and add proxy @ and port

global.proxy.lucent.comand port 8000

 

 

 

 

How to find and install Eclipse Plugin

 

·        Go to Market place, search yourplugin name, click install, restart Eclipse

 

 

 

  • Drag and Drop from Web browser, select install button and drag it into eclispe frame, then drop. restart Eclipse after install

 

 

  • From update site, click add copy paste you update site link, associate a name. then tick wanted feature and clik next , follow the instruction
    You might have trouble installing one plugin, sometimes version between other plugins, eclipse and the choosen plugin does not match.
    Then you might be asked to resolve the conflict manually .

 

 

CONNECTORS

GERRIT

 

GIT/GERRIT connector is the easiest way to connect toGIT/GERRIT repository

  • Open Planning perspective and click on add Task Repository

  • Then start installing GERRIT connector, by clicking on Install More connectors. search for gerrit, tick the in the square option and select Finish . Follow instructions and restart eclipse.

JIRACONNECTOR

 

  • Please see GERRIT connector if you want to install, instead of choosing Gerrit then look for JIRA. You may have some troubles installing JIRA connector as ALTASSIAN does not make anymore evolution on this connector.
    Then if the automatic proc does not work , see the manual installation below:, see how to update using update site ( Update site )

 

 

  • Installing certification, JIRA requires certification , then you'll need to insert .cert in JAVA machine to be granted to JIRA via eclipse plugin

 

JENKINSCONNECTOR

 

A nice plugin to access JEnkins Jobs via Eclipse is thefollowing, see how to install it eclipse_plugin

HOW to USE GIT PLUGIN and GERRIT CONNECTORS

 

PREREQUISITE

 

 

 

 

  • Second steps is to install GERRIT connector, see Installing Gerrit Connector
  • Check your GIT configuration file, open Eclipse preferences
     important things is http and user keys, use add entry button to insert them.The .gitconfig should be located under you account, here for Windows it is C:\users\marguero
  • Check as well environement variable, on windows HomeOnNet is important to get your account under C:\users\<your_name>, then take advantage of openning this window to check you Python path as well

 

 

CLONING GIT REPOSITORY

 

  • Go to the GIt perspective (see Eclipse perspective ) , click on Clone a repository and choose Gerrit connector, then NEXT button

 

  • Select the Repository you want to Clone, and clik NEXT. Follow instruction, selecting master branch

 

 

 

  •  You'll get your repository cloned as shown:

 

 

 

  • it's time to import the repository in your workspace, select Import project as a general project

 

 

·        Open your Pydev Perspective,you should have you repository settled and you are ready to work with GIT/GERRIT

 

 

CREATING YOUR JIRA TICKET with MYLYN

CREATINGYOUR GIT BRANCH WITH EGIT PLUGIN

 

·        Prior to create a branch youneed to make sure your repository is sync-up with server repository, then youneed to perform a GIT PULL

 

 

 

 

  • In Pydev perspective and in Navigation view, Select Team, new branch , enter name of your branch.( you could insert in the name your JIRA ticket for instance).

See result how the name is reported in Navigator:

 

 

CODING IN YOUR GIT BRANCH WITH EGIT

 

  • Once a branch is created you are ready to start coding your own code. There is not a unique way of doing it but the following one is may the safest one

 

DO NOT WORK in  your MASTER branch. It is not compulsarybut it'll prevent making mistakes.

 

CHECKING/CONFIGURINGWHERE TO PUSH

 

  • As we can push to gerrit master branch but also for drafts , we need to check/configure where we are pushing
    to change the mapping, click on Advanced

 

 

In that way you could change refs/for/masterto refs/drafts/masterif you want to push into GErrit draft. Knowing that a Draft can be convertedeasly into a formal review into Mater branch

Doucle click on refs/for/master to change, then finish andsave settings

 

 

EDITING, COMMITING, PUSHING CODE WITH EGIT

 

  • Once a branch is created you are ready to start coding your own code. There is not a unique way of doing it but the following one is may the safest one

 

DO NOT WORK in  your MASTER branch. It is notcompulsary but it'll prevent making mistakes.

 

 

  • You can start coding using the Pydev Editor, File modification will be shown in Navigator View as followed, see symbol ">"

 

 

  • Next step , we need to COMMIT the change , ( better to do COMMIT first and then PUSH )

 

IT IS THE FIRST TIME YOUR ARE COMMITING in this branch

 

  • Write in Commit message the JIRA ticket number , do not forget as shown below ( do not forget the : , it won't pass the GERRIT hook otherwise), then insert a short description, don't use exotic characters
  • Check you email, it has to match you're email addresses declared in gerrit server.
  • Check the file you are commiting

 

IT IS THE SECOND  TIME YOUR ARE COMMITING in thisbranch

 

  • USE APPEND button ( right-up corner in the picture) , once pressed the button recalls automatically the previous modification and ammend it.

 

 

  • If you intend to commit without any modification , Eclipse would ask you to amend the previous commit. This is veru usefull when you want to modify eventually your email address or description of your commit

 

 

  • Looking in Team-Show history we can see our commit in our branch, Now we need to push it to GERRIT server

 

 

 

You might have issue when pushing , GERRIT might see someconflict with what you want to submit and what's in the repostitory

Main reason is that developpers were being busy on the samefile, or when you created your branch you did not perform a git pull tore-sync.

In any case , if gerrit can't resolve the conflict byhimself , you'll need a rebase. This would be addressed later in this document.

 

  • Finally , let's push, here the PUSH is rejected because the review in GErrit is closed

 

 

REBASINGVS MERGING

 

Now, let’s say that the new commits in masterare relevant to the feature that you’re working on. To incorporate the newcommits into your feature branch, you have two options: merging orrebasing.

TheMerge Option

 

Merging is nice because it’s a non-destructive operation. The existingbranches are not changed in any way. This avoids all of the potential pitfallsof rebasing (discussed below).

On the other hand, this also means that the featurebranch will have an extraneous merge commit every time you need to incorporateupstream changes. If master is very active, this can pollute yourfeature branch’s history quite a bit. While it’s possible to mitigate thisissue with advanced git log options, it can make it hard for otherdevelopers to understand the history of the project.

TheRebase Option

 

The major benefit of rebasing is that you get a muchcleaner project history. First, it eliminates the unnecessary merge commitsrequired by git merge. Second, as you can see in the abovediagram, rebasing also results in a perfectly linear project history—you canfollow the tip of feature all the way to the beginning of theproject without any forks. This makes it easier to navigate your project withcommands like git log, git bisect, and gitk.

But, there are two trade-offs for this pristine commithistory: safety and traceability. If you don’t follow the GoldenRule of Rebasing, re-writing project history can be potentiallycatastrophic for your collaboration workflow. And, less importantly, rebasingloses the context provided by a merge commit—you can’t see when upstreamchanges were incorporated into the feature.

MERGING

REBASING

STARTING INTERACTIVE REBASE

 

 

ABORTING INTERACTIVE REBASE

 

 

 

ACCESS YOU GERRIT REVIEW WITH GERRIT CONNECTOR

 

  • Go back to Mylyn perspective ( perspective ) and choose gerrit code review and click Next, enter now the gerrit repository
    Before closing the windows click on Valid settings, it will check your credentials

 

 

 

  • Create your query, you could ask for only your reviews as well as all open changes and other custom query. click Finish

 

 

  • In you task_list view you should have all GERRIT open changes

 

 

  • Double clciking on a review will open it in the Eclipse Editor. You are able to perform a review  within Eclipse
    You can add reviewers, add comments, publish comments, compare new and former versions. Have a view per users with open in search feature.

 

 

 

HOW TO ACCESS JENKINS JOBS FROM ECLIPSE

Configuring MYLYN JENKINS CONNECTOR

  • In your Pydev perspective => Click on Window, show view other to get the Buils view from Mylyn

 

·         

    • Add a Jenkins server

  • Edit the build server properties: Enter jenkins server URL , your jenkins crendential ( login and password ) , click on refresh to get a list of Jenkins Jobs and then tick
    the ones you want to use. Click on Validate to confirm a valid connection , then press FINISH

 

  • You are ready to work with Mylyn Jenkins connector, ny double clicking on one JOB you might see something similar to this
    You can get all saved artifacts,  you can access the console , filtering only failed test cases, see recent GIT changes ...

 

  • Another nice view is the JUNIT view, you will get quickly the failure trace raised by the TC

  • LAST but no LEAST you can run a job from this conncetor as well

 

 

LIGHWEIGHTENVIRONMENT TO DEBUG/CREATE ONE TEST CASE

 

RUNNING ONE TEST CASE

 

Prerequisite:

JAVA  and JRE + Eclipse + Pydev + EGIT + Python 2.7installed on your machine

On the top of that , Gerrit and Jenkins connectors will beappreciated.

 

If you intend to create or debug one Test case by printing someinfo in the console, you don't really need a debugger, neither to run you'repython script inside Eclipse.

better to let JEnkins Job running the test case for you whileyou'll focuss only on  editing / coding your script with Eclipse.

 

This is how you should proceed:

 

  • First , ask for a development job in jenkins, request to be sent to automation team.
    E.g viewed from Jenkins plugin in Eclipse

  • getsync with GIT repository and create your own development branch, see chapter egit
  • When pushing into GIT/GERRIT go for "Drafts" ==> refs/drafts/master, see chapter pushing in GIT
  • Get the reference of the changes ( if GERRIT connector is not installed , grab it from your web browser

 

 

 

 

 

 

 

  • You've just started a new build, then just wait for the completion by clicking into console jenkinsC

 

GETTING AND PARSING LOGS

 

RSEECLISPE PLUGIN

 

To get our Logs of interest we will use RSE plugin, no needto install it it is already in Eclipse.

RSE is a plugin that allows you to connect remote machine(windows and Unix/Linux) via multiple protocoles such as Telnet , SFTP, SSH.....

You can transfer files, synchronising folder between twomachines, opening remote files ...., comparing files between two machines.

 

  • Connect a remote Target, in Pydev perspective , open Remote Systems View.
    Choose SSH only , that's the simplest and best option for what we want to do.

 

  • Insert host name could be IP or machine name, insert a connection , that's gonna be the name of your remote machine in RSE menu
    Eventually put down a description.

 

 

  • It is now possible to browse the remote machine like if you were locally on your explorer

 

 

 

  • It is possible to copy/paste from a remote mahcine to your local drive

 

  • As well as defining some filters like figure above that will points a specific folder in your directory structure.
    Here TMP points out C:\mars2\workspace\auto\TMP in another word it is like a shortcut.

 

 

  • Another feature is to create a Remote project, and this is the coolest feature with RSE

You need write access !!! to create your remote project

 

 

  •  You are now able to open your remote project, go into Navigator or Project view on open the project.

 

 

 

  • You are now seeing files via scp connection , then think refreshing your project to get the latest status/content of your files

 

 

  • Closing your project

 

  • Deleting your Project from RSE perspective.

 

WATCH OUT, if you tick Delete Project Contents on diskyou will ERASE remote files and/or folders

 

USING RSE ECLISPE PLUGIN to get/parse LOGs

 

  • As depicted above, it could be interesting to get .log from jenkins connecting either the MASTER OR the SLAVE.
  • Connecting to JENKINS MASTER will provide one access to your logs once the test is finished , meaning  archives were completed. For instance, If you interupt the test manually artifact won't be saved.
  • Connecting to JENKINS SLAVE could be good to grab logs while the test is still running.

 

DEBUGGING USING REMOTE PYDEV FEATURE

 

SETTINGS  AND PREREQUISITE

 

You have on your PC : Eclipse + Pydev plugins ( git/gerritare appreciated but not compulsary)

  • Pydev lib must be installed on the remote target

 

  • You have a development job

 

CREATING YOUR REMOTE PROJECT FROM JENKINS SLAVE TO YOUR PC

 

Seeremoteproject, this project must embed you Jenkins dev job, therefore youneed to point at least /home/jenkins

MODIFY the configuration to MATCH your ENVIRONMENT

 

To be able to set some breakpoint you need to modify thefile pydev_file_utils

PATHS_FROM_ECLIPSE_TO_PYTHON = [(r'C:\MARS2\workspace\RemoteSystemsTempFiles\LALX04SI4\home\jenkins\auto',
                                 r'/home/jenkins/auto'),
                                (r'C:\MARS2\workspace\RemoteSystemsTempFiles\LALX04SI4\home\jenkins\workspace\dev-all-fv2-emarguero\src',
                                 r'/home/jenkins/workspace/Dev-All-FV2-emarguero/src')
                               ]

Tupple must contain the way to identify the src betweenyour target ( JEnkins slave) and your PC

First you need to point out the file within the RSE configwhich is under REmoteSystemsTempFiles, the after that point it depends on youJenkins dev job and how you've created the remote project.

 

 

MODIFYING the MAIN() procedure

 

Target PC , then Jenkins SLAVE needs you PC @ip adresss inorder to communicate.

In our case the Main module is jenkins_worker

 

  def main():
    """main function"""
 
    #Add pydevd to the PYTHONPATH (may be skipped if that path is already added in the PyDev configurations)
    import sys
    sys.path.append(r'/home/jenkins/auto/org.python.pydev_4.4.0.201510052309/pysrc')
    print sys.path
    import pydevd
    pydevd.settrace("135.117.153.136", stdoutToServer=True,stderrToServer=True)

First you need to tell the path to the pydev module (you've just modified pydev_file_utils)

then you need to insert you ip .

 

STARTINGDEBUGING

 

  • First Start Pydev Client pressing the "green bug" in your menu

  • Check in console :

Debug Server at port: 5678

  • Setenv your PYHTONPATH and virtual environement
export PYTHONPATH=src
export PYTHONPATH=$PYTHONPATH:~/workspace/Dev-All-FV2-emarguero/src
echo $PYTHONPATH
. /home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/bin/activate
 

Please note that sdmvirtaulenv can be upgraded to a newversion, please see your dev jenkins job and look at the console output to getthe current version.

As well you should not need to update the SLAVE using pip ,but just in case this is the command : pip install -r requirements.txt--proxy="global.proxy.alcatel-lucent.com:8000"--quiet

 

  • Run the appropriate commande using jenkins_worker, E.g
(sdmvirtualenv_5.0)jenkins@lalx04si4:~/workspace/Dev-All-FV2-emarguero$ python src/framework/jenkins_worker.py --testenv LN-HPG8-2
2016-04-06 17:49:11,181  - INFO      -   MainThread - logger.py                 - 120  - Global PostBuild Log directory is : 
/log/20160406-CEST-174911.176741_debug.log
['/home/jenkins/workspace/Dev-All-FV2-emarguero/src/framework', '/home/jenkins/workspace/Dev-All-FV2-emarguero/src', '/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7', '/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/plat-linux2', '/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/lib-tk', '/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/lib-old', '/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/local/lib/python2.7/site-packages', '/home/jenkins/CommonVirtualEnv/sdmvirtualenv_5.0/lib/python2.7/site-packages', '/home/jenkins/auto/org.python.pydev_4.4.0.201510052309/pysrc']

At this time you shoul have avalid debug session , select your debug perspective

 

 

If the translation in the pydev_file_utils is not correct ,you will have a red notification in the console.

You can now enjoy the remote debug session, usingbreakpoints and all other features. Print will be redirected in the terminalwindow:

 

Then you can modify the python code directely on the SLAVEusing RSE plugin, once the result pleases you , you can report this change intoyour GIT/GERRIT env under eclipse , and then committing and eventually pushingit into the repository

 

OF course if you start you JENKINS dev Job from a browser,you might  loose all your modifications as it'll download a version of thecode that's might not corresponds to your latest local edition.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值