Skip to content

Commit

Permalink
Log when barnes is installed, or isn't
Browse files Browse the repository at this point in the history
This presents a tip to the user to tell them how to enable metrics collection.
  • Loading branch information
schneems committed Sep 11, 2023
1 parent b5540ad commit 8e40054
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/layers/metrics_agent_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ fn write_execd_script(
}

fn install_agentmon(dir: &Path) -> Result<PathBuf, MetricsAgentInstallError> {
let agentmon = download_untar(DOWNLOAD_URL, &dir).map(|_| dir.join("agentmon"))?;
let agentmon = download_untar(DOWNLOAD_URL, dir).map(|_| dir.join("agentmon"))?;

chmod_plus_x(&agentmon).map_err(MetricsAgentInstallError::PermissionError)?;
Ok(agentmon)
Expand Down
9 changes: 7 additions & 2 deletions buildpacks/ruby/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,18 @@ impl Buildpack for RubyBuildpack {
let ruby_version = gemfile_lock.resolve_ruby("3.1.3");

// ## Install metrics agent
let section = build_output::section("Metrics agent");
if lockfile_contents.contains("barnes") {
let section = build_output::section("Metrics agent");
context.handle_layer(
layer_name!("metrics_agent"),
MetricsAgentInstall { section },
)?;
}
} else {
section.say_with_details(
"Skipping install",
"`gem 'barnes'` not found in Gemfile.lock",
);
};

// ## Install executable ruby version

Expand Down

0 comments on commit 8e40054

Please sign in to comment.