Skip to content

Commit

Permalink
Transform the fetch external artifact task's plugin properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
varshavaradarajan authored and tomzo committed Jul 9, 2018
1 parent 78f3723 commit c6fe7a8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class ConfigurationTransform {


void addConfiguration(JsonObject json, Map<String, Object> configurationMap) {
if (configurationMap == null) {
return;
}
JsonArray configuration = new JsonArray();
Object options = configurationMap.get(YAML_PLUGIN_STD_CONFIG_FIELD);
Object optionsSecure = configurationMap.get(YAML_PLUGIN_SEC_CONFIG_FIELD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ public JsonObject transform(Map.Entry<String, Object> taskEntry) {
Map<String, Object> taskMap = (Map<String, Object>) taskEntry.getValue();
addOnCancel(taskJson, taskMap);

addOptionalObject(taskJson, taskMap, JSON_TASK_PLUGIN_CONFIGURATION_FIELD, YAML_PLUGIN_CONFIGURATION_FIELD);
super.addConfiguration(taskJson, taskMap);
if ("fetch".equals(taskType)) {
addOptionalObject(taskJson, taskMap, JSON_PLUGIN_CONFIGURATION_FIELD, YAML_PLUGIN_CONFIGURATION_FIELD);
super.addConfiguration(taskJson, (Map<String, Object>) taskMap.get(JSON_PLUGIN_CONFIGURATION_FIELD));
} else {
addOptionalObject(taskJson, taskMap, JSON_TASK_PLUGIN_CONFIGURATION_FIELD, YAML_PLUGIN_CONFIGURATION_FIELD);
super.addConfiguration(taskJson, taskMap);
}


addOptionalBoolean(taskJson, taskMap, JSON_TASK_IS_FILE_FIELD, YAML_TASK_IS_FILE_FIELD);
addOptionalStringList(taskJson, taskMap, JSON_TASK_EXEC_ARGS_FIELD, YAML_TASK_EXEC_ARGS_FIELD);
Expand Down
12 changes: 11 additions & 1 deletion src/test/resources/parts/tasks/fetch_external_artifact.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,15 @@
"pipeline": "upstream",
"stage": "upstream_stage",
"job": "upstream_job",
"artifact_id": "upstream_artifact_id"
"artifact_id": "upstream_artifact_id",
"configuration": [
{
"key": "Foo",
"value": "bar"
},
{
"key": "secure_property",
"encrypted_value": "ssd#%fFS*!Esx"
}
]
}
7 changes: 6 additions & 1 deletion src/test/resources/parts/tasks/fetch_external_artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ fetch:
pipeline: upstream
stage: upstream_stage
job: upstream_job
artifact_id: upstream_artifact_id
artifact_id: upstream_artifact_id
configuration:
options:
Foo: bar
secure_options:
secure_property: ssd#%fFS*!Esx

0 comments on commit c6fe7a8

Please sign in to comment.