From a22b66f3858b52d42633a832c1b2d2800068ac6b Mon Sep 17 00:00:00 2001 From: nekoimi Date: Tue, 23 May 2023 12:19:32 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=B6=88=E6=81=AF=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../io/jenkins/plugins/wxwork/WXWorkPipelineBuilder.java | 8 ++++---- .../io/jenkins/plugins/wxwork/bo/RobotPipelineVars.java | 2 +- .../plugins/wxwork/transfer/MarkdownMessageTransfer.java | 2 +- .../plugins/wxwork/transfer/TextMessageTransfer.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 7638c07..f4da4ae 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 1.0.1 999999-SNAPSHOT - 2.332.4 + 2.324 jenkinsci/${project.artifactId}-plugin diff --git a/src/main/java/io/jenkins/plugins/wxwork/WXWorkPipelineBuilder.java b/src/main/java/io/jenkins/plugins/wxwork/WXWorkPipelineBuilder.java index 270e7bf..a867590 100644 --- a/src/main/java/io/jenkins/plugins/wxwork/WXWorkPipelineBuilder.java +++ b/src/main/java/io/jenkins/plugins/wxwork/WXWorkPipelineBuilder.java @@ -124,7 +124,7 @@ public void setImageUrl(String imageUrl) { public void perform( @NonNull Run run, @NonNull FilePath workspace, - @NonNull EnvVars env, + @NonNull EnvVars envVars, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException { RobotProperty property = WXWorkGlobalConfig.instance().getRobotPropertyById(robot); @@ -134,9 +134,9 @@ public void perform( } RunUser runUser = JenkinsUtils.getRunUser(run, listener); RobotPipelineVars pipelineVars = RobotPipelineVars.builder() - .robot(this.robot).type(this.type).atMe(this.atMe).atAll(this.atAll) - .at(this.at).text(this.text).imageUrl(this.imageUrl).runUser(runUser) - .env(env).workspace(workspace).listener(listener).build(); + .robot(envVars.expand(this.robot)).type(this.type).atMe(this.atMe).atAll(this.atAll) + .at(this.at).text(this.text).imageUrl(envVars.expand(this.imageUrl)).runUser(runUser) + .envVars(envVars).workspace(workspace).listener(listener).build(); RobotRequest robotRequest = RobotMessageFactory.makeRobotRequest(pipelineVars); if (robotRequest == null) { listener.error("不支持的消息!"); diff --git a/src/main/java/io/jenkins/plugins/wxwork/bo/RobotPipelineVars.java b/src/main/java/io/jenkins/plugins/wxwork/bo/RobotPipelineVars.java index ad7b81a..95b806a 100644 --- a/src/main/java/io/jenkins/plugins/wxwork/bo/RobotPipelineVars.java +++ b/src/main/java/io/jenkins/plugins/wxwork/bo/RobotPipelineVars.java @@ -65,7 +65,7 @@ public class RobotPipelineVars { /** * 环境变量 */ - private EnvVars env; + private EnvVars envVars; /** * workspace diff --git a/src/main/java/io/jenkins/plugins/wxwork/transfer/MarkdownMessageTransfer.java b/src/main/java/io/jenkins/plugins/wxwork/transfer/MarkdownMessageTransfer.java index 0cd0b23..e0e06fc 100644 --- a/src/main/java/io/jenkins/plugins/wxwork/transfer/MarkdownMessageTransfer.java +++ b/src/main/java/io/jenkins/plugins/wxwork/transfer/MarkdownMessageTransfer.java @@ -27,7 +27,7 @@ public RobotRequest transferRobotRequest(RobotPipelineVars pipelineVars) { MarkdownMessage.Builder builder = MarkdownMessage.builder(); List textList = pipelineVars.getText(); List textCollect = textList.stream().filter(StrUtils::isNotBlank).collect(Collectors.toList()); - builder.content(String.join("\n", textCollect)); + builder.content(pipelineVars.getEnvVars().expand(String.join("\n", textCollect))); return builder.build(); } } diff --git a/src/main/java/io/jenkins/plugins/wxwork/transfer/TextMessageTransfer.java b/src/main/java/io/jenkins/plugins/wxwork/transfer/TextMessageTransfer.java index c609a95..d524d39 100644 --- a/src/main/java/io/jenkins/plugins/wxwork/transfer/TextMessageTransfer.java +++ b/src/main/java/io/jenkins/plugins/wxwork/transfer/TextMessageTransfer.java @@ -36,7 +36,7 @@ public RobotRequest transferRobotRequest(RobotPipelineVars pipelineVars) { List textList = pipelineVars.getText(); List textCollect = textList.stream().filter(Objects::nonNull).filter(StrUtils::isNotBlank).collect(Collectors.toList()); - builder.content(String.join("\n", textCollect)); + builder.content(pipelineVars.getEnvVars().expand(String.join("\n", textCollect))); return builder.build(); } }