2022-07-28 test test-day-173 Today’s Task Build Script User Friendly Changes Refactor Build Scripts Hadar Groovy Liquibase Job Support Additional TaskThought试着在 Jenkins Job 执行完之前拿到了当前 job 的 console log 需要去 Approve 一些奇怪的权限 12345678910111213141516171819202122stage('Result Analysis') { steps { script { def logContent = Jenkins.getInstance().getItemByFullName(env.JOB_NAME).getBuildByNumber(Integer.parseInt(env.BUILD_NUMBER)).logFile.text writeFile file: "${env.WORKSPACE}/buildConsolelog.txt", text: logContent def consoleOutput = readFile "${env.WORKSPACE}/buildConsolelog.txt" def keywords = ["ERROR", "WARNING", "author", "conflict"] for(line in consoleOutput.split("\n")) { for (keyword in keywords) { if (line.contains(keyword)) { echo line } else if (line.contains("changes")) { changes += line echo line } } } } }} Newer test-day-175 Older test-day-172