Skip to main content

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=$SCENARIO

    The 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.

    • Store the Controller URL as a environmentalGitLab CI/CD variable soinstead theof build.xml file can usehard-coding it to create the URL from where the RestClient.jar needs 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.

    Use provideseparate variables for development, staging, and production-like AIQ environments.Keep authentication tokens and credentials in protected or masked variables.Validate the newURL desiredbefore valuetriggering fora long-running suite so failed configuration is caught early.

    Pipeline checklist

    1. Define the SCENARIOController andURL CONTROLLERvariable variables.in GitLab settings or the pipeline environment.
    2. Reference the variable from the AIQ execution command or integration script.
    3. Run a small smoke test to confirm the pipeline reaches the intended controller.
    4. Review logs to make sure sensitive values are not printed.
    5. 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