void run()

in src/com/epam/digital/data/platform/pipelines/stages/impl/lowcode/CreatePermissionsBusinessProcess.groovy [31:67]


    void run() {
        if (context.registryRegulations.deployStatus("create-permissions-business-process",
                "${RegulationType.BUSINESS_PROCESS_AUTH.value}")) {
            try {
                context.logger.info("Creating ${RegulationType.BUSINESS_PROCESS_AUTH.value}")
                ArrayList<String> filesList = []
                context.registryRegulations.getAllRegulations(RegulationType.BUSINESS_PROCESS_AUTH).each { file ->
                    String fileContent = context.script.readFile(file: file)
                    if (fileContent.isEmpty()) {
                        context.logger.info("Skip empty ${file} auth file")
                    } else {
                        filesList.add(file)
                    }
                }

                String tokenFile = "token.txt"
                if (!filesList.isEmpty()) {
                    context.script.writeFile(file: tokenFile,
                            text: context.keycloak.getAccessToken(context.jenkinsDeployer))
                    context.script.sh(script: "java -jar ${CAMUNDA_AUTH_CLI} " +
                            "--BPMS_URL=${BusinessProcMgmtSys.URL} " +
                            "--BPMS_TOKEN=${tokenFile} " +
                            "--AUTH_FILES=${filesList.join(",")} ${context.logLevel == "DEBUG" ? "1>&2" : ""};" +
                            "rm -f ${tokenFile}")
                }

            } catch (any) {
                context.logger.error("Error during creating business process permissions")
                context.stageFactory.runStage(context.RESTORE_STAGE, context)
            }
            context.registryRegulations.getChangedStatusOrFiles("save", "create-permissions-business-process",
                    "--file ${context.getWorkDir()}/${RegulationType.BUSINESS_PROCESS_AUTH.value}")
        } else {
            context.logger.info("Skip ${RegulationType.BUSINESS_PROCESS_AUTH.value}" +
                    " files upload due to empty change list")
        }
    }