Package: facile-gitlab-trigger
Facile GitLab HelperThis library provides help to microservices inside gitLab C.I pipelines, integrating different repositories within different pipelines and projects.Getting StartedOpen the terminal and install the given library:pipinstallfacile-gitlab-triggerExecute the command below to make sure the library has been installed correctly:facile-trigger--helpThe list of commands below should be displayed:usage:facile-trigger-aGITLAB_API_TOKEN[-hGIT_LAB_HOST][--help][-tTARGET_BRANCH]-pPROJECT_ID-bREF_NAME-fYAML_FILE

Gilabtriggerhelper

optionalarguments:-aGITLAB_API_TOKEN,--api-tokenGITLAB_API_TOKENpersonalaccesstoken(notrequiredwhenrunningdetached)-hGIT_LAB_HOST,--hostGIT_LAB_HOST--helpshowthishelpmessageandexit-tTARGET_BRANCH,--target-refTARGET_BRANCHtargetref(branch,tag,commit)-pPROJECT_ID,--project-idPROJECT_IDrepositoryidfoundonsettings-bREF_NAME,--branch-mergedREF_NAMEfilledbygitCOMMIT_REF_NAME-fYAML_FILE,--yaml-fileYAML_FILEfilledbygitCOMMIT_REF_NAMEUsageRunning a pipeline with Facile GitLab Helper requires only few steps.
Use the arguments below in order to run a pipeline:Branch TitleThis argument can be dynamically filled using gitlab variables, like $CI_COMMIT_TITLE. In this case, Facile GitLab Helper will get the string provided by the given variable and will match it with the running rules lists - which are stored in the .yaml file. So, tests will run a specific path, based on the ID provided in the string. E.g. let's say our variable "$CI_COMMIT_TITLE" contains "PROJECT_NAME", tests will only run the specific path to the project, accordingly with the running rules lists.Project IDIt's the ID shown on gitLab Project Root>>Settings>>Geral.API KeyThis can be generated by going on user Profile >> Access Tokens >> Add a personal access token. Use the generated value for this argument.Gitlab Host DomainHere goes the gitlab domain: "https://gitlab.domain_name/". For example, facile.it domain would be "https://gitlab.facile.it/".Target BranchThis should be the branch we want the tests to run against. It could be "master", "develop" and so on.Create lambdatest tunnelAs capability is also possibile to create tunnel running test against lambdatest cloud, this feature by the default will be always false but once a tunnel is needed to ben run from the trigger just passt to the flag "-u True" then a tunnel will be created and attached to the given automation sessionYaml FileThis should be the .yaml file (or files) which provides the rules based on the "ID"s:projects:paytv:project_id:PAYTVCApath:Tests/pay_tv_online.robot Tests/pay_tv_tradizionale.robotwhere:desktopbrowser:chromeversion:"79.0"platform:"Windows10"noleggio_mobile_Huawei_Pro:project_id:NOLEGGIOCApath:Tests/noleggio_responsive.robotwhere:mobiledevice:"HuaweiP20Pro"browser:chromeplatform:Androidversion:"9"....For instance, if the branch title contains "NTL", test automation will run the test path Tests/noleggio.robot if it contains "ABC", then Tests/abc.robot will run. So, -f should be the path to where you created your .yaml rules file.
Below you can find an example of a full command to run a pipeline:facile-trigger-b<branch_title>-p<project_id>-a<api_key>-h<gitlab_host_domain>-t<target_branch>-f<yaml_file>After that terminal will display the project name, status and the pipeline link triggered+ projectName is running on https://gitlab.facile.it/qa/new-business-group/nattp/pipelines/164014Once it get failed terminal will display the given pipeline weblink which can be checked for further information as shown bellow:- projectName is failed please check on https://gitlab.facile.it/qa/new-business-group/nattp/pipelines/164014Running simple static projectsYou may also run simple static projects where the capabilities will be specified directly in the gitLab c.i file as shown below:job_with_capabilities:<<:*test_robotframeworkvariables:WHERE:"desktop"TestType:"desktop"BROWSER:"Chrome"VERSION:"83.0"TESTS:"test.robot"PLATFORM:"Windows10"This kind of project approach happens when the repository holds single product tests where is not necessary sort of logic behind the scenes which. Running those kind of projects the command is:facile-trigger-b<branch_title>-p<project_id>-a<api_key>-h<gitlab_host_domain>-t<target_branch>-kTrueAbove as you can see the flag "-k" was used which means that automation will run "by project" in another words, capabilities will be simply defined in the gitlab.yml file.Env url to run automationIt's also possible to specify the end point where the automation will run as shown below:facile-trigger-b<branch_title>-p<project_id>-a<api_key>-h<gitlab_host_domain>-t<target_branch>-f<yaml_file>-uTrue-e<my_end_point>Notice that to use the URL in the target repository is necessary to use "START_URL" which will be the variable that will receive the url specified in the given commando above.Extra feature tunnel creationCurrently, facile_gitlab_trigger also holds a super nice capability which creates a tunnel for the automation. This capability currently works only on facile.it bundle environment as we use "lambdatest" as test automation device cloud. By the default the given flag is "False" where once the feature is not needed then will be ignored by the library. To leave the trigger create the tunnel for your test just use the flag -u = True as shown below:facile-trigger-b<branch_title>-p<project_id>-a<api_key>-h<gitlab_host_domain>-t<target_branch>-f<yaml_file>-uTrueRemember that this feature do not work for "static" projects where the capabilities are defined in the gitLab yml c.i. In the case the project by itself create its own tunnel to start the test automation.