Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manifest uri value not used if version value set to known value or blank #6

Open
mikepedeupe opened this issue Sep 16, 2021 · 0 comments

Comments

@mikepedeupe
Copy link

Hello. I'm not sure what the intended order of precedence is supposed to be between the uri and version settings in the manifest.yml.

But I think line 242 in supply.go is not working as intended.

if (nrDownloadURL == "" || isAgenVersionEnvSet || in_array(strings.ToLower(nrVersion), []string{"", "0.0.0", "0.0.0.0", "latest", "current"})) {

With the default manifest.yml file, the uri and version are set.

language: newrelic-hwc-extension
default_versions:
dependency_deprecation_dates:
dependencies:
- name: newrelic
  version: latest
  # version: 8.39.0.0
  uri: http://download.newrelic.com/dot_net_agent/previous_releases/8.39.0/newrelic-agent-win-x64-8.39.0.0.zip
  sha256: b12d7c2a08d7456f063283be4fc696038404ee31aaf1012b8174568352b5cfe3
  cf_stacks:
  - windows2012R2
  - windows2016
  - windows

Since evaluating line 242 passes the last of the OR tests when evaluating the value of version = "latest", the code will run to get the latest version of the agent.

I'm okay with that if it is intended that version has precedence over uri. If that is the case, then shouldn't I be allowed to leave the value for version to blank or omit it completely. In the case it is blank or omitted, I would expect the value of uri to be used. In this case the 3rd OR statement includes "" as true condition and causes the code to run, instead of using the uri value.

I can get around this by putting in a version value like "none" that doesn't match the 3rd OR. But I don't think this is the intended behavior.

I'm thinking potential fixes are to make the first OR condition: nrDownloadURL != "" to make the uri have precedence over the other options. Or remove the "" from the list of matching values in the 3rd OR condition, if we want version to have precedence over uri.

Either way, the version lookup doesn't appear to work for the HWC agent. I get the following error.

-----> Newrelic-Hwc-Extension Buildpack version 1.1.7
-----> Supplying Newrelic HWC Extension
Detecting New Relic...
-----> Installing NewRelic .Net Framework Agent
-----> Creating cache directory \tmp\cache\38ac941affb1650adcaf17c42780eb0d
Obtaining latest agent version
**ERROR** Unable to obtain latest agent version from the metadata bucket%!(EXTRA *url.Error=Get https://nr-downloads-main.s3.amazonaws.com/?delimiter=/&prefix=dot_net_agent/latest_release/: net/http: TLS handshake timeout)
**ERROR** Error: Get https://nr-downloads-main.s3.amazonaws.com/?delimiter=/&prefix=dot_net_agent/latest_release/: net/http: TLS handshake timeout
Failed to run all supply scripts: exit status 15
Exit status 225

I actually prefer being able to have it download the latest version. But with the lookup failing, I need to be able to point to a specific uri. While doing that, I found the issue with the blank version not using the uri.

Thanks!
Mike

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant