void run()

in src/com/epam/digital/data/platform/pipelines/stages/impl/lowcode/CreateTrembitaBusinessProcess.groovy [28:64]


    void run() {
        if (context.registryRegulations.deployStatus("create-trembita-business-process",
                "${RegulationType.BUSINESS_PROCESS_TREMBITA.value}")) {
        try {
            String BP_TREMBITA_FILE = "${RegulationType.BUSINESS_PROCESS_TREMBITA.value}/external-system.yml"
            String value = context.script.sh(script: """awk '{printf "%s%s\\n", "", \$0}' ${BP_TREMBITA_FILE}""",
                    returnStdout: true).replaceAll("\n", "\\\\n")
            boolean patched = context.platform.patchConfigMapKey(
                    "bp-webservice-gateway-trembita-business-processes", "trembita-business-processes.yml", value)
            if (patched)
                context.platform.triggerDeploymentRollout("bp-webservice-gateway")
        }

        catch (any) {
            context.logger.error("Error during uploading trembita business process changes")
            context.stageFactory.runStage(context.RESTORE_STAGE, context)
        }

            try {
                String trembitaConfFile = "${RegulationType.BUSINESS_PROCESS_TREMBITA.value}/configuration.yml"
                String trembitaConfigmapKey = "external-systems-endpoint-configuration.yml"
                String configmapName = "external-systems-endpoint-configuration"
                String trembitaConfigmapYaml = "${context.script.sh(script: """awk '{printf "%s\\n", \$0}' \
                        ${trembitaConfFile}""", returnStdout: true).replaceAll("\n", "\\\\n")}"
                context.bpmsConfigMapsChanged["trembitaConfiguration"] = context.platform.patchConfigMapKey(configmapName,
                        trembitaConfigmapKey, trembitaConfigmapYaml)
                context.logger.info("Configmap external-systems-endpoint-configuration have been successfully updated")
            }
            catch (any) {
                context.logger.error("Error during external-systems-endpoint-configuration configmap updating")
            }
            context.registryRegulations.getChangedStatusOrFiles("save", "create-trembita-business-process",
                    "--file ${context.getWorkDir()}/${RegulationType.BUSINESS_PROCESS_TREMBITA.value}")
        } else {
            context.logger.info("Skip trembita configuration creation due to empty change list")
        }
    }