Executing a custom script on your projects - Cloud - 8.0

Talend Software Development Life Cycle Best Practices Guide

Version
Cloud
8.0
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Administration Center
Talend Artifact Repository
Talend CommandLine
Talend JobServer
Talend Management Console
Talend Remote Engine
Talend Studio
Content
Administration and Monitoring
Deployment
Design and Development
Last publication date
2024-02-16
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.