Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wajahat Ch
Pod
Commits
30247c00
Unverified
Commit
30247c00
authored
4 years ago
by
Vasili Novikov
Browse files
Options
Download
Plain Diff
Merge branch 'jlowry/pod-fix-compilation-error' into dev
parents
8b472c28
97f6779b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/internal_api.rs
+0
-23
src/internal_api.rs
src/plugin_run.rs
+11
-11
src/plugin_run.rs
with
11 additions
and
34 deletions
+11
-34
src/internal_api.rs
+
0
-
23
View file @
30247c00
...
...
@@ -475,29 +475,6 @@ mod tests {
.contains
(
expected_error
));
}
{
// ignore already defined Schemas
let
json
=
json!
({
"type"
:
"ItemPropertySchema"
,
"itemType"
:
"Person"
,
"propertyName"
:
"dateCreated"
,
"valueType"
:
"DateTime"
,
});
let
create_item
:
CreateItem
=
serde_json
::
from_value
(
json
)
.unwrap
();
assert_eq!
(
internal_api
::
create_item_tx
(
&
tx
,
&
minimal_schema
,
create_item
,
""
,
&
cli
,
&
database_key
)
.unwrap
(),
"___ignored___"
);
}
let
bad_empty_schema
=
Schema
{
property_types
:
HashMap
::
new
(),
};
...
...
This diff is collapsed.
Click to expand it.
src/plugin_run.rs
+
11
-
11
View file @
30247c00
...
...
@@ -30,28 +30,28 @@ pub fn run_plugin_container(
"Trying to run plugin container for target_item_id {}"
,
target_item_id
);
let
item
=
internal_api
::
get_item_tx
(
tx
,
schema
,
target_item_id
)
?
;
let
item
=
item
.into_iter
()
.next
()
.ok_or_else
(||
Error
{
let
target_
item
=
internal_api
::
get_item_tx
(
tx
,
schema
,
target_item_id
)
?
;
let
target_item
=
target_
item
.into_iter
()
.next
()
.ok_or_else
(||
Error
{
code
:
StatusCode
::
BAD_REQUEST
,
msg
:
format!
(
"Failed to find target item {} to run a plugin against"
,
target_item_id
),
})
?
;
let
item
=
serde_json
::
to_string
(
&
item
)
?
;
let
target_item_json
=
serde_json
::
to_string
(
&
target_
item
)
?
;
let
auth
=
database_key
.create_plugin_auth
()
?
;
let
auth
=
serde_json
::
to_string
(
&
auth
)
?
;
let
container_id
=
format!
(
"{}-{}-{}"
,
pod_owner
.chars
()
.take
(
10
)
.collect
(),
container_image
.chars
()
.take
(
15
)
.collect
(),
pod_owner
.chars
()
.take
(
10
)
.collect
::
<
String
>
(),
container_image
.chars
()
.take
(
15
)
.collect
::
<
String
>
(),
new_random_item_id
()
);
if
cli_options
.use_kubernetes
{
run_kubernetes_container
(
&
container_image
,
container_id
,
&
target_item_
id
,
&
target_item_
json
,
pod_owner
,
&
auth
,
triggered_by_item_id
,
...
...
@@ -61,7 +61,7 @@ pub fn run_plugin_container(
run_docker_container
(
&
container_image
,
container_id
,
&
target_item_
id
,
&
target_item_
json
,
pod_owner
,
&
auth
,
triggered_by_item_id
,
...
...
@@ -84,7 +84,7 @@ pub fn run_plugin_container(
fn
run_docker_container
(
container_image
:
&
str
,
container_id
:
String
,
target_item
:
&
str
,
target_item
_json
:
&
str
,
pod_owner
:
&
str
,
pod_auth
:
&
str
,
triggered_by_item_id
:
&
str
,
...
...
@@ -101,7 +101,7 @@ fn run_docker_container(
"--env=POD_FULL_ADDRESS={}"
,
callback_address
(
cli_options
)
));
args
.push
(
format!
(
"--env=POD_TARGET_ITEM={}"
,
target_item
));
args
.push
(
format!
(
"--env=POD_TARGET_ITEM={}"
,
target_item
_json
));
args
.push
(
format!
(
"--env=POD_PLUGINRUN_ID={}"
,
triggered_by_item_id
));
args
.push
(
format!
(
"--env=POD_OWNER={}"
,
pod_owner
));
args
.push
(
format!
(
"--env=POD_AUTH_JSON={}"
,
pod_auth
));
...
...
@@ -122,7 +122,7 @@ fn run_docker_container(
fn
run_kubernetes_container
(
container_image
:
&
str
,
container_id
:
String
,
target_item
:
&
str
,
target_item
_json
:
&
str
,
pod_owner
:
&
str
,
pod_auth
:
&
str
,
triggered_by_item_id
:
&
str
,
...
...
@@ -136,7 +136,7 @@ fn run_kubernetes_container(
"--env=POD_FULL_ADDRESS={}"
,
callback_address
(
cli_options
)
));
args
.push
(
format!
(
"--env=POD_TARGET_ITEM={}"
,
target_item
));
args
.push
(
format!
(
"--env=POD_TARGET_ITEM={}"
,
target_item
_json
));
args
.push
(
format!
(
"--env=POD_PLUGINRUN_ID={}"
,
triggered_by_item_id
));
args
.push
(
format!
(
"--env=POD_OWNER={}"
,
pod_owner
));
args
.push
(
format!
(
"--env=POD_AUTH_JSON={}"
,
pod_auth
));
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets