Parameterize the AIQ Controller URL in a GitLab CI/CD Pipeline
Edit
Parameterize the gitlab-ci.ymlAIQ file and add the lines as in the following sample code.
The following example assumes that your controller JSON file is named controller.json. If your file is named differently adjust the code as needed.
variables:
CONTROLLER: "http://10.70.10.1:8080"
SCENARIO: "REPOSITORY/Appvance/scenarios/test.scenario"
script:
- perl -pi -e 's/"url": "[^"]*"/"url": "$CONTROLLER"/' controller.json
- export CONTROLLER=$CONTROLLER
- ant createScenariosDashboard -Dscenario=$SCENARIOThe perl command line in the script section, searches for the value of theController URL in thea JSONGitLab andCI/CD replacesPipeline
it with
Parameterize the valueAIQ setController inURL so the same GitLab variableCI/CD namedpipeline CONTROLLER.can Thenrun against different AIQ environments without changing the valuepipeline isscript addedfor every deployment.
Recommended approach
- Store the Controller URL as a
environmentalGitLab CI/CD variablesoinsteadtheofbuild.xml file can usehard-coding itto create the URL from where theRestClient.jarneeds to be downloaded.
In the build.xmlfile add a line before the targets definitions, to get the controller from the environment variable.
<property name="controller" value="${env.CONTROLLER}"/>
Modify the deps target so the URL to download the RestClient.jar will use the parameterized controller URL.
<target name="deps" depends="init">
<mkdir dir="${lib}"/>
<get src="${controller}/UI/container/AppvanceCIClientWithDeps.jar" dest="${lib}/RestClient.jar"/>
</target>When triggering the pipeline manually or in the pipeline scheduler,file.
Pipeline checklist
- Define the
ControllerSCENARIOandURLvariableCONTROLLERvariables.in GitLab settings or the pipeline environment. - Reference the variable from the AIQ execution command or integration script.
- Run a small smoke test to confirm the pipeline reaches the intended controller.
- Review logs to make sure sensitive values are not printed.
- Promote the same pipeline definition across environments by changing only variable values.
Last updated: SeptemberOctober 25,8, 20242026
If you have any feedback on this topic, please contact us at documentation@appvance.ai