pub fn docker_exporter_spec(workspace: &Workspace) -> DockerExporterSpec {
    // TODO fn: Using this value struct was done to keep the validation, JSON parsing, and
    // craziness in one place and out of the Docker-specific code. Oi, this is embarrassing.

    // Note: There are a lot of `.expect()` calls in this function. That is because the
    // integrations data is assumed to have been already validated via `validate_integrations()`
    // above. As a result, Any panics that occur are most likely due to programmer error and not
    // input validation.

    let origin_integration = workspace
        .job
        .get_integrations()
        .first()
        .expect("Origin integrations must not be empty");

    let creds: JsonValue = serde_json::from_str(origin_integration.get_body())
        .expect("Origin integrations body must be JSON");

    let opts: JsonValue = serde_json::from_str(
        workspace
            .job
            .get_project_integrations()
            .first()
            .expect("Project integrations must not be empty")
            .get_body(),
    )
    .expect("Project integrations body must be JSON");

    let custom_tag = get_optional_args(&opts, String::from("custom_tag"));
    let registry_url = get_optional_args(&creds, String::from("registry_url"));
    let registry_type = origin_integration.get_integration().to_string();

    DockerExporterSpec {
        username: creds
            .get("username")
            .expect("username key is present")
            .as_str()
            .expect("username value is a string")
            .to_string(),
        password: creds
            .get("password")
            .expect("password key is present")
            .as_str()
            .expect("password value is a string")
            .to_string(),
        registry_type,
        registry_url,
        docker_hub_repo_name: opts
            .get("docker_hub_repo_name")
            .expect("docker_hub_repo_name key is present")
            .as_str()
            .expect("docker_hub_repo_name value is a string")
            .to_string(),
        latest_tag: opts
            .get("latest_tag")
            .expect("latest_tag key is present")
            .as_bool()
            .expect("latest_tag value is a bool"),
        version_tag: opts
            .get("version_tag")
            .expect("version_tag key is present")
            .as_bool()
            .expect("version_tag value is a bool"),
        version_release_tag: opts
            .get("version_release_tag")
            .expect("version_release_tag key is present")
            .as_bool()
            .expect("version_release_tag value is a bool"),
        custom_tag,
    }
}
/// Builds the Docker exporter details from the origin and project integrations.
Builds the Docker exporter details from the origin and project integrations.
Builds the Docker exporter details from the origin and project integrations .
pub fn docker_exporter_spec(workspace: &Workspace) -> DockerExporterSpec {
    // TODO fn: Using this value struct was done to keep the validation, JSON parsing, and
    // craziness in one place and out of the Docker-specific code. Oi, this is embarrassing.
    // Note: There are a lot of `.expect()` calls in this function. That is because the
    // integrations data is assumed to have been already validated via `validate_integrations()`
    // above. As a result, Any panics that occur are most likely due to programmer error and not
    // input validation.
    let origin_integration = workspace
        .job
        .get_integrations()
        .first()
        .expect("Origin integrations must not be empty");
    let creds: JsonValue = serde_json::from_str(origin_integration.get_body())
        .expect("Origin integrations body must be JSON");
    let opts: JsonValue = serde_json::from_str(
        workspace
            .job
            .get_project_integrations()
            .first()
            .expect("Project integrations must not be empty")
            .get_body(),
    )
    .expect("Project integrations body must be JSON");
    let custom_tag = get_optional_args(&opts, String::from("custom_tag"));
    let registry_url = get_optional_args(&creds, String::from("registry_url"));
    let registry_type = origin_integration.get_integration().to_string();
    DockerExporterSpec {
        username: creds
            .get("username")
            .expect("username key is present")
            .as_str()
            .expect("username value is a string")
            .to_string(),
        password: creds
            .get("password")
            .expect("password key is present")
            .as_str()
            .expect("password value is a string")
            .to_string(),
        registry_type,
        registry_url,
        docker_hub_repo_name: opts
            .get("docker_hub_repo_name")
            .expect("docker_hub_repo_name key is present")
            .as_str()
            .expect("docker_hub_repo_name value is a string")
            .to_string(),
        latest_tag: opts
            .get("latest_tag")
            .expect("latest_tag key is present")
            .as_bool()
            .expect("latest_tag value is a bool"),
        version_tag: opts
            .get("version_tag")
            .expect("version_tag key is present")
            .as_bool()
            .expect("version_tag value is a bool"),
        version_release_tag: opts
            .get("version_release_tag")
            .expect("version_release_tag key is present")
            .as_bool()
            .expect("version_release_tag value is a bool"),
        custom_tag,
    }
}
pub fn docker_exporter_spec ( workspace : & Workspace ) -> DockerExporterSpec { // TODO fn: Using this value struct was done to keep the validation, JSON parsing, and // craziness in one place and out of the Docker-specific code. Oi, this is embarrassing. // Note: There are a lot of `.expect()` calls in this function. That is because the // integrations data is assumed to have been already validated via `validate_integrations()` // above. As a result, Any panics that occur are most likely due to programmer error and not // input validation. let origin_integration = workspace . job . get_integrations ( ) . first ( ) . expect ( " " ) ; let creds : JsonValue = serde_json :: from_str ( origin_integration . get_body ( ) ) . expect ( " " ) ; let opts : JsonValue = serde_json :: from_str ( workspace . job . get_project_integrations ( ) . first ( ) . expect ( " " ) . get_body ( ) , ) . expect ( " " ) ; let custom_tag = get_optional_args ( & opts , String :: from ( " " ) ) ; let registry_url = get_optional_args ( & creds , String :: from ( " " ) ) ; let registry_type = origin_integration . get_integration ( ) . to_string ( ) ; DockerExporterSpec { username : creds . get ( " " ) . expect ( " " ) . as_str ( ) . expect ( " " ) . to_string ( ) , password : creds . get ( " " ) . expect ( " " ) . as_str ( ) . expect ( " " ) . to_string ( ) , registry_type , registry_url , docker_hub_repo_name : opts . get ( " " ) . expect ( " " ) . as_str ( ) . expect ( " " ) . to_string ( ) , latest_tag : opts . get ( " " ) . expect ( " " ) . as_bool ( ) . expect ( " " ) , version_tag : opts . get ( " " ) . expect ( " " ) . as_bool ( ) . expect ( " " ) , version_release_tag : opts . get ( " " ) . expect ( " " ) . as_bool ( ) . expect ( " " ) , custom_tag , } }
Builds the Docker exporter details from the origin and project integrations.
Builds the Docker exporter details from the origin and project integrations .
workspace
&Workspace