Executing a custom script on your projects
Before you begin
About this task
Procedure
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 <!-- This parameter is only supported and needed for users with Talend Studio 8.0.1 R2024-04 or lower -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 <!-- This parameter is only supported and needed for users with Talend Studio 8.0.1 R2024-04 or lower -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.
For more information about Talend CommandLine, see Talend CommandLine API.