Skip to content
Merged
Changes from all commits
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
20 changes: 17 additions & 3 deletions acceptance/tests/test_upgrade_puppet8_to_puppet9.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'beaker-puppet'
require 'open-uri'
require 'json'
require_relative '../helpers'

# Tests FOSS upgrades from the latest Puppet 8 (the puppet8-nightly collection)
Expand All @@ -17,8 +18,7 @@
# crashes the puppet_agent class; empty SHA produces a nonsense dev_builds
# URL). Use Ruby HTTP with retry rather than shelling out to curl, since
# `--retry-connrefused` isn't supported on older curl versions (e.g. CentOS 7).
fetch_passing_sha = ->(name) do
url = "https://builds.delivery.puppetlabs.net/passing-agent-SHAs/#{name}"
fetch_with_retry = ->(url) do
attempts = 5
last_error = nil
attempts.times do |i|
Expand All @@ -34,8 +34,22 @@
end
fail_test("Failed to fetch #{url} after #{attempts} attempts: #{last_error}")
end
fetch_passing_sha = ->(name) { fetch_with_retry.call("https://builds.delivery.puppetlabs.net/passing-agent-SHAs/#{name}") }

latest_version = fetch_passing_sha.call('puppet-agent-9.x-version')
# The `puppet-agent-9.x-version` convenience file reports the eventual release
# version (e.g. "9.0.0.204.g<sha>", derived from the build's `:version:` field),
# but pre-9.0.0 nightlies are still packaged under Puppet's next-major
# pre-release convention (8.99.99.<build>). mac/windows/solaris/aix install
# from a hand-built, exact filename (see osfamily/{darwin,windows,solaris,aix}.pp),
# so using the "friendly" version 404s -- apt/yum below are unaffected, since
# they resolve `latest` via repo metadata rather than a literal filename.
#
# Resolve the real, currently-packaged version from the generic "suite"
# report instead of trusting the convenience file or a single build's own
# YAML (per-SHA YAML lookups don't reflect the version once that build is
# promoted to a tagged release -- see PR #846 review discussion).
report = JSON.parse(fetch_with_retry.call('https://artifactory.delivery.puppetlabs.net/artifactory/generic/api/v1/json/report-9.x'))
latest_version = report['suite-version'] || fail_test("No 'suite-version' found in report-9.x: #{report}")
logger.info("Using latest puppet-agent-9.x #{latest_version}")

puppet_testing_environment = new_puppet_testing_environment
Expand Down
Loading