Skip to main content Skip to complementary content
Close announcements banner

Executing a custom script on your projects

Talend CI Builder allows you to execute a custom script on your projects using the mvn org.talend.ci:builder-maven-plugin:8.0.X:executeScript and -DexecuteRawScript=true/false commands.

Before you begin

About this task

To execute a custom script on your projects:

Procedure

Run the mvn org.talend.ci:builder-maven-plugin:8.0.X:executeScript command along with the -DscriptFile and the -DexecuteRawScript=true/false commands under the directory where your projects have been checked out.

Pay attention to the following before executing the script on your projects:

  • If -DexecuteRawScript=false (default):
    • the connection to every project available in the workspace is established automatically.
    • the createProject command is executed inside the workspace and declares all the projects detected in the workspace.
    • the CI-CommandLine instance then executes the customer script on all projects detected in your workspace unless you have filtered your projects using the -DprojectFilter parameter.

    Example:

    # The content of the script named importFile.txt
    importItems /home/talend/Patch_dynamic_issue.zip
    regenerateAllPoms
    # To execute the importFile.txt custom script 
    mvn org.talend.ci:builder-maven-plugin:<version>:executeScript 
    -Dlicense.path=/home/talend/studio/license 
    -Dtalend.studio.p2.base=https://update.talend.com/Studio/8/base 
    -Dtalend.studio.p2.update=https://update.talend.com/Studio/8/updates/R2023-01  
    -DscriptFile=D:/importFile.txt 

    This script will then be executed on all detected projects (here, TALEND_CI_1 and TALEND_CI_2). This script calls the importItems command to import an archive file and the regenerateAllPoms command to regenerate POM files for your projects:

    initLocal
    logonProject -pn 'TALEND_CI_1' -ul 'jobbuilder@talend.com' -gt 
    importItems /home/talend/Patch_dynamic_issue.zip -o 
    regenerateAllPoms
    logoffProject
    logonProject -pn 'TALEND_CI_2' -ul 'jobbuilder@talend.com' -gt 
    importItems /home/talend/Patch_dynamic_issue.zip -o regenerateAllPoms
    logoffProject
  • If -DexecuteRawScript=true:
    • the script only executes the stated commands once.
    • the connection to projects is not established automatically and dedicated parameters need to be declared manually (initLocal, createProject, logonProject and logoffProject).

    Example:

    # The content of the script named importFile.txt
    initLocal
    logonProject -pn 'TALEND_CI_1' -ul 'jobbuilder@talend.com' -gt 
    importItems /home/talend/Patch_dynamic_issue.zip -o 
    regenerateAllPoms
    logoffProject
    # To execute the importFile.txt custom script 
    mvn org.talend.ci:builder-maven-plugin:<version>:executeScript 
    -DexecuteRawscript=true
    -Dlicense.path=/home/talend/studio/license 
    -Dtalend.studio.p2.base=https://update.talend.com/Studio/8/base 
    -Dtalend.studio.p2.update=https://update.talend.com/Studio/8/updates/R2023-01  
    -DscriptFile=d:/importFile.txt 

    This script will be executed according to the exact commands declared previously. This script calls the importItems command to import an archive file and the regenerateAllPoms command to regenerate the POM files for your TALEND_CI_1 project:

    initLocal
    logonProject -pn 'TALEND_CI_1' -ul 'jobbuilder@talend.com' -gt 
    importItems /home/talend/Patch_dynamic_issue.zip -o 
    regenerateAllPoms
    logoffProject

For more information about CI related parameters, see CI builder-related Maven parameters.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!