Skip to content

Commit

Permalink
enos: use the correct install during upgrade (#27496)
Browse files Browse the repository at this point in the history
Fix the upgrade scenario by utilizing the correct Vault install location
for the initial install and by using different initial upgrade versions.
Before we had upgrade versions that were only available for Enterprise
which would fail on CE.

Signed-off-by: Ryan Cragun <me@ryan.ec>
  • Loading branch information
ryancragun authored Jun 13, 2024
1 parent c966ee6 commit 456f180
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
9 changes: 8 additions & 1 deletion enos/enos-globals.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ globals {
"Project" : "Enos",
"Environment" : "ci"
}, var.tags)
// This reads the VERSION file, strips any pre-release metadata, and selects only initial
// versions that are less than our current version. E.g. A VERSION file containing 1.17.0-beta2
// would render: semverconstraint(v, "<1.17.0-0")
upgrade_version_stripped = join("-", [split("-", chomp(file("../version/VERSION")))[0], "0"])
// NOTE: when backporting, make sure that our initial versions are less than that
// release branch's version. Also beware if adding versions below 1.11.x. Some scenarios
// that use this global might not work as expected with earlier versions. Below 1.8.x is
// not supported in any way.
upgrade_initial_versions = ["1.8.12", "1.9.10", "1.10.11", "1.11.12", "1.12.11", "1.13.13", "1.14.13", "1.15.9", "1.16.3"]
upgrade_all_initial_versions_ce = ["1.8.12", "1.9.10", "1.10.11", "1.11.12", "1.12.11", "1.13.13", "1.14.10", "1.15.6", "1.16.3", "1.17.0"]
upgrade_all_initial_versions_ent = ["1.8.12", "1.9.10", "1.10.11", "1.11.12", "1.12.11", "1.13.13", "1.14.13", "1.15.10", "1.16.4", "1.17.0"]
upgrade_initial_versions_ce = [for v in global.upgrade_all_initial_versions_ce : v if semverconstraint(v, "<${global.upgrade_version_stripped}")]
upgrade_initial_versions_ent = [for v in global.upgrade_all_initial_versions_ent : v if semverconstraint(v, "<${global.upgrade_version_stripped}")]
vault_install_dir = {
bundle = "/opt/vault/bin"
package = "/usr/bin"
Expand Down
5 changes: 1 addition & 4 deletions enos/enos-scenario-autopilot.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ scenario "autopilot" {
config_mode = global.config_modes
distro = global.distros
edition = global.enterprise_editions
// This reads the VERSION file, strips any pre-release metadata, and selects only initial
// versions that are less than our current version. E.g. A VERSION file containing 1.17.0-beta2
// would render: semverconstraint(v, "<1.17.0-0")
initial_version = [for v in global.upgrade_initial_versions : v if semverconstraint(v, "<${join("-", [split("-", chomp(file("../version/VERSION")))[0], "0"])}")]
initial_version = global.upgrade_initial_versions_ent
seal = global.seals

# Autopilot wasn't available before 1.11.x
Expand Down
22 changes: 11 additions & 11 deletions enos/enos-scenario-upgrade.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ scenario "upgrade" {
consul_version = global.consul_versions
distro = global.distros
edition = global.editions
// This reads the VERSION file, strips any pre-release metadata, and selects only initial
// versions that are less than our current version. E.g. A VERSION file containing 1.17.0-beta2
// would render: semverconstraint(v, "<1.17.0-0")
initial_version = [for v in global.upgrade_initial_versions : v if semverconstraint(v, "<${join("-", [split("-", chomp(file("../version/VERSION")))[0], "0"])}")]
initial_version = global.upgrade_initial_versions_ce
seal = global.seals


Expand Down Expand Up @@ -342,17 +339,18 @@ scenario "upgrade" {
]

variables {
timeout = 120 # seconds
vault_hosts = step.create_vault_cluster_targets.hosts
vault_install_dir = global.vault_install_dir[matrix.artifact_type]
timeout = 120 # seconds
vault_hosts = step.create_vault_cluster_targets.hosts
// Use the install dir for our initial version, which always comes from a zip bundle
vault_install_dir = global.vault_install_dir["bundle"]
vault_root_token = step.create_vault_cluster.root_token
}
}

step "get_vault_cluster_ips" {
description = global.description.get_vault_cluster_ip_addresses
module = module.vault_get_cluster_ips
depends_on = [step.create_vault_cluster]
depends_on = [step.wait_for_leader]

providers = {
enos = local.enos_provider[matrix.distro]
Expand All @@ -365,8 +363,9 @@ scenario "upgrade" {
]

variables {
vault_hosts = step.create_vault_cluster_targets.hosts
vault_install_dir = global.vault_install_dir[matrix.artifact_type]
vault_hosts = step.create_vault_cluster_targets.hosts
// Use the install dir for our initial version, which always comes from a zip bundle
vault_install_dir = global.vault_install_dir["bundle"]
vault_root_token = step.create_vault_cluster.root_token
}
}
Expand Down Expand Up @@ -394,7 +393,8 @@ scenario "upgrade" {
leader_public_ip = step.get_vault_cluster_ips.leader_public_ip
leader_private_ip = step.get_vault_cluster_ips.leader_private_ip
vault_instances = step.create_vault_cluster_targets.hosts
vault_install_dir = global.vault_install_dir[matrix.artifact_type]
// Use the install dir for our initial version, which always comes from a zip bundle
vault_install_dir = global.vault_install_dir["bundle"]
vault_root_token = step.create_vault_cluster.root_token
}
}
Expand Down

0 comments on commit 456f180

Please sign in to comment.