Merge pull request #7117 from inspec/sb/allow-telemetry-url-override

Allow dev/CI to override the telemetry URL to a staging service
This commit is contained in:
Sathish Babu 2024-08-07 15:32:30 +05:30 committed by GitHub
commit e984269b41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View file

@ -36,6 +36,8 @@ vault version
echo "--- fetching License serverl url and keys from vault"
# Note: Currently, the value for the local license server is a static IP address. Please update this to a DNS name when available.
$Env:CHEF_LICENSE_SERVER=vault kv get -field ci secret/inspec/licensing/server
# Note: Currently, this returns blank response
$Env:CHEF_TELEMETRY_URL=vault kv get -field ci secret/inspec/telemetry/server
echo "--- verifying if environment variables are set"

View file

@ -30,6 +30,8 @@ unzip -o $VAULT_HOME/vault.zip -d $VAULT_HOME
echo "--- fetching License serverl url and keys from vault"
# Note: Currently, the value for the local license server is a static IP address. Please update this to a DNS name when available.
export CHEF_LICENSE_SERVER=$($VAULT_HOME/vault kv get -field ci secret/inspec/licensing/server)
# Note: Currently, this returns blank response
export CHEF_TELEMETRY_URL=$($VAULT_HOME/vault kv get -field ci secret/inspec/telemetry/server)
if [ -n "${CI_ENABLE_COVERAGE:-}" ]; then
echo "--- fetching Sonar token from vault"

View file

@ -6,11 +6,8 @@ module Inspec
class Telemetry
class HTTP < Base
TELEMETRY_JOBS_PATH = "v1/job"
TELEMETRY_URL = if ChefLicensing::Config.license_server_url&.match?("acceptance")
ENV["CHEF_TELEMETRY_URL"]
else
"https://services.chef.io/telemetry/"
end
# Allow dev/CI to override the telemetry URL to a staging service
TELEMETRY_URL = ENV["CHEF_TELEMETRY_URL"] || "https://services.chef.io/telemetry/"
def run_ending(opts)
payload = super
response = connection.post(TELEMETRY_JOBS_PATH) do |req|