Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Fix s3 uri format so that its explicitly a s3 URI #2060

Merged
4 commits merged into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/rust/plugin-registry/src/server/deploy_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rust_proto::graplinc::grapl::api::plugin_registry::v1beta1::PluginType;

use super::{
plugin_nomad_job,
s3_url::get_s3_url,
s3_uri::get_s3_uri,
service::PluginRegistryServiceConfig,
};
use crate::{
Expand Down Expand Up @@ -54,7 +54,7 @@ pub fn get_job(
let plugin_artifact_url = {
let key = &plugin.artifact_s3_key;
let bucket = &service_config.bucket_name;
get_s3_url(bucket, key)
get_s3_uri(bucket, key)
};
let passthru = service_config.passthrough_vars;
let plugin_type = PluginType::try_from(plugin.plugin_type.as_str())
Expand Down
2 changes: 1 addition & 1 deletion src/rust/plugin-registry/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ mod create_plugin;
mod deploy_plugin;
mod get_plugin_health;
mod plugin_nomad_job;
mod s3_url;
mod s3_uri;
pub mod service;
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use grapl_config::env_helpers::ENV_ENDPOINT;

pub fn get_s3_url(bucket: &str, key: &str) -> String {
/// This gets a s3 URI to be used by Nomad's artifact stanza (in particular the grapl-plugin).
/// The underlying go-getter lib, doesn't work with the `http://` schema prefix, but does work with
/// an explicit s3 prefix `s::` or without a prefix. We've opted for the s3 prefix to be explicit.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s:: -> s3::

pub fn get_s3_uri(bucket: &str, key: &str) -> String {
let local_endpoint = std::env::var(ENV_ENDPOINT).ok();
// If the above is specified, we're running locally against Localhost
// Otherwise, it's against prod S3; so we can use virtual-hosted-style URLs
Expand Down