From c789fcaa8ee3d3169fc0d99c1653e881e64d8b1b Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 29 Apr 2021 17:33:05 -0400 Subject: [PATCH 1/2] Show that `Base64` can be used in Groovy for simple manipulations --- README.md | 2 +- pom.xml | 5 +++++ .../AbstractFileParameterDefinitionTest.java | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c9e4f85..9eef043 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Nor can you use the `withFileParameter` wrapper here. You can use Base64 parameters for passing _small_ files to downstream builds: ```groovy -build job: 'downstream', parameters: [base64File(name: 'file', base64: 'aGVsbG8=')] +build job: 'downstream', parameters: [base64File(name: 'file', base64: Base64.encoder.encodeToString('hello'.bytes)))] ``` ## LICENSE diff --git a/pom.xml b/pom.xml index 69fdb47..4a85867 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,11 @@ import pom + + org.jenkins-ci.plugins + script-security + 1.77-rc1068.93d45dd18835 + diff --git a/src/test/java/io/jenkins/plugins/file_parameters/AbstractFileParameterDefinitionTest.java b/src/test/java/io/jenkins/plugins/file_parameters/AbstractFileParameterDefinitionTest.java index cd48523..ab21c58 100644 --- a/src/test/java/io/jenkins/plugins/file_parameters/AbstractFileParameterDefinitionTest.java +++ b/src/test/java/io/jenkins/plugins/file_parameters/AbstractFileParameterDefinitionTest.java @@ -113,4 +113,16 @@ public class AbstractFileParameterDefinitionTest { r.assertLogContains("received null: null", b); } + @Test public void buildStep() throws Exception { + WorkflowJob us = r.createProject(WorkflowJob.class, "us"); + us.setDefinition(new CpsFlowDefinition("build job: 'ds', parameters: [base64File(name: 'FILE', base64: Base64.encoder.encodeToString('a message'.bytes))]", true)); + WorkflowJob ds = r.createProject(WorkflowJob.class, "ds"); + ds.addProperty(new ParametersDefinitionProperty(new Base64FileParameterDefinition("FILE"))); + ds.setDefinition(new CpsFlowDefinition("echo(/got ${new String(Base64.decoder.decode(FILE))}/)", true)); + r.buildAndAssertSuccess(us); + WorkflowRun b = ds.getBuildByNumber(1); + assertNotNull(b); + r.assertLogContains("got a message", b); + } + } From 9778897619a7a80a210944aa5c64d275a0a1dede Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 27 May 2021 17:59:20 -0400 Subject: [PATCH 2/2] https://github.com/jenkinsci/script-security-plugin/pull/339 already in `bom` --- pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pom.xml b/pom.xml index 15723e4..7a3bb08 100644 --- a/pom.xml +++ b/pom.xml @@ -29,11 +29,6 @@ import pom - - org.jenkins-ci.plugins - script-security - 1.77-rc1068.93d45dd18835 -