Search code examples
openshiftto-be-continuous

Multi-openshift deployment with to-be-continuous


I use Gitlab CI pipelines with To be Continuous templates to deploy my application. My production environment is splitted on 2 different Openshift clouds. So I have 2 different OS_TOKEN values. Reading To be Continuous documentation I understand that it is mandatory to store my Openshift token in the OS_TOKEN variable which is unique for the production environment_type.

Did someone try and succeed to deploy an application on different Openshift instances in the same pipeline ?


Solution

  • I've finaly found a solution.

    In a variable $MY_CLOUD I define the name of the cloud I want to deploy to: "CLOUD1", "CLOUD2", ...

    I store the token of each cloud in a dedicated variable: $OS_TOKEN_CLOUD1, $OS_TOKEN_CLOUD2, ...

    And after the classic variables definitions I add the following instructions, using scoped variables:

    OS_TOKEN: ${OS_TOKEN_CLOUD1} #default value
    scoped__OS_TOKEN__if__MY_CLOUD__equals__CLOUD2: ${OS_TOKEN_CLOUD2}
    

    Limit: I have to run the pipeline once by cloud. I would have prefered a pipeline launched once and deploying on every cloud.