summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipeline_new/utils/filter_variables.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/pipeline_new/utils/filter_variables.js')
-rw-r--r--app/assets/javascripts/pipeline_new/utils/filter_variables.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/assets/javascripts/pipeline_new/utils/filter_variables.js b/app/assets/javascripts/pipeline_new/utils/filter_variables.js
new file mode 100644
index 00000000000..57ce3d13a9a
--- /dev/null
+++ b/app/assets/javascripts/pipeline_new/utils/filter_variables.js
@@ -0,0 +1,13 @@
+// We need to filter out blank variables
+// and filter out variables that have no key
+// before sending to the API to create a pipeline.
+
+export default (variables) => {
+ return variables
+ .filter(({ key }) => key !== '')
+ .map(({ variable_type, key, value }) => ({
+ variable_type,
+ key,
+ secret_value: value,
+ }));
+};