If you are not familiar with pipelines or how they function, refer to the Automated Deployment Using Pipelines article.
How to Check
If the Git repository is hosted in one of the following:
-
Pricefx GitLab (https://gitlab.pricefx.eu).
-
Other GitLab services, such as https://gitlab.com
Then verify the contents of the .gitlab-ci.yml file. If the file begins with the following lines:
include:
- project: 'public-tools/build-templates'
It means that the Pricefx deployment templates are already in use, and component folders are auto-deployed. In this case, you can skip this guide.
What If Customer Is Not Using Auto-deployment?
If the partner or customer does not use auto-deployment for the root folder objects, then enabling it for component folders is optional and may be handled manually. However, if the customer’s repository does not yet include component folders, this is a good opportunity to enable auto-deployment for them.
How to Enable
Locate the .deploy section in the .gitlab-ci.yml (public-tools/build-templates) file.
This section is responsible for deploying objects in the root folder using a Bash script that executes the pfxpackagecommand.
.deploy:
stage: deploy
when: manual
image: pricefx/pfxpackage
variables:
COMPONENT_FOLDER: ".PfxComponents"
script:
#PFX_USER: should be set as masked variable in project's settings on gitlab -> Settings -> CI/CD -> Variable
#PFX_PASS: the same applies to PFX_PASS do not ever put it here\
- |
#!/bin/bash
# deploy anything in project root directory
pfxpackage -import -timeout 120 -url ${URL} -user ${PFX_USER} -password ${PFX_PASS} -partition ${PARTITION} -from . ${OPTIONS}
-
Lines starting with
#are comments and can be omitted. -
The line
#!/bin/bashmust remain, as it is required by the Linux shell.
Next, check for a section that deploys component folders. It should use the variable COMPONENT_FOLDER, which is typically defined earlier in the script. If this section is missing, it should be added to the pipeline following the example below.
Example
# deploy anything in PfxComponents directory
# Check if COMPONENT_FOLDER is defined and the folder exists
if [ -z "$COMPONENT_FOLDER" ] || [ ! -d "./$COMPONENT_FOLDER" ]; then
echo "COMPONENT_FOLDER is not defined or does not exist. Skipping directory loop."
else
# Loop through the contents of COMPONENT_FOLDER if it exists
for dir in ./$COMPONENT_FOLDER/*/
do
dir=${dir%*/} # remove the trailing "/"
pfxpackage -import -timeout 120 -url ${URL} -user ${PFX_USER} -password ${PFX_PASS} -partition ${PARTITION} -from $dir ${OPTIONS}
done
fi
This configuration ensures that all accelerators stored within the .PfxComponents directory are automatically deployed, just like objects in the root folder.