Configuring an external database for Build

You can configure Build to use the same external MySQL database that is used by Deploy. When using an external database, the Build Helm chart must be configured to connect to the existing MySQL instance instead of creating a database inside the Kubernetes cluster.

Before you begin

You must have completed the following tasks:

  • Ensured that the external MySQL database used by Deploy is available and accessible from the Kubernetes cluster.
  • Ensured that the following information is available:
    • MySQL host name or IP address
    • MYSQL port
    • Database name
    • Database user name
    • Database password
  • Ensured that the database user has permission to access the required database.

  • Ensured that the Kubernetes cluster is connected to the MySQL server.

  • Esnured that a Kubernetes secret containing the database password exists in the deployment namespace.

Procedure

  1. Add variables for the external MySQL database in the installation script:
    MYSQL_HOST=<mysql-host>
    MYSQL_PORT=3306
    DATABASE_NAME=<database-name>
    DATABASE_USER=<database-user>
    BUILD_DB_SECRET=build-secret

    These variables define the connection details for the external MySQL database used by the Build.

  2. Create a Kubernetes secret that contains the database password by running the following command:
    BUILD_DB_PASSWORD=<DATABASE_PASSWORD>
    kubectl create secret generic build-secret -n devops-loop --from-literal=dbpassword="$BUILD_DB_PASSWORD"

    ⚠️ Important: The BUILD_DB_PASSWORD must match the password assigned to the MySQL user.

  3. Add the following Helm values to the HELM_OPTIONS section of the installation script. These parameters configure the Build Helm chart to use the external database.
    --set hcl-devops-build.externalDB.enabled=true \
    --set hcl-devops-build.externalDB.hostname=<MYSQL_HOST> \
    --set hcl-devops-build.externalDB.port=<MYSQL_PORT> \
    --set hcl-devops-build.externalDB.database=<DATABASE_NAME> \
    --set hcl-devops-build.externalDB.user=<DATABASE_USER> \
    --set hcl-devops-build.secret.name=build-secret

Results

After you run the installation script, DevOps Loop is installed and the Build capability connects to the external MySQL database by using the credentials stored in the Kubernetes secret.

What to do next

You must install DevOps Loop to apply the configuration. See Installation of DevOps Loop.