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

testsys: Add testsys-image-tag to Test.toml #2653

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
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
40 changes: 14 additions & 26 deletions tools/testsys-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ pub struct Test {

/// A registry containing all TestSys images
pub testsys_image_registry: Option<String>,

/// The tag that should be used for TestSys images
pub testsys_image_tag: Option<String>,
}

/// Create a vec of relevant keys for this variant ordered from most specific to least specific.
Expand Down Expand Up @@ -254,42 +257,27 @@ pub struct TestsysImages {

impl TestsysImages {
/// Create an images config for a specific registry.
pub fn new<S>(registry: S) -> Self
pub fn new<S>(registry: S, tag: Option<String>) -> Self
where
S: Into<String>,
{
let registry = registry.into();
let agent_version = format!("v{}", TESTSYS_VERSION);
let tag = tag.unwrap_or_else(|| format!("v{}", TESTSYS_VERSION));
Self {
eks_resource_agent_image: Some(format!(
"{}/eks-resource-agent:{agent_version}",
registry
)),
ecs_resource_agent_image: Some(format!(
"{}/ecs-resource-agent:{agent_version}",
registry
)),
eks_resource_agent_image: Some(format!("{}/eks-resource-agent:{tag}", registry)),
ecs_resource_agent_image: Some(format!("{}/ecs-resource-agent:{tag}", registry)),
vsphere_k8s_cluster_resource_agent_image: Some(format!(
"{}/vsphere-k8s-cluster-resource-agent:{agent_version}",
registry
)),
ec2_resource_agent_image: Some(format!(
"{}/ec2-resource-agent:{agent_version}",
"{}/vsphere-k8s-cluster-resource-agent:{tag}",
registry
)),
ec2_resource_agent_image: Some(format!("{}/ec2-resource-agent:{tag}", registry)),
vsphere_vm_resource_agent_image: Some(format!(
"{}/vsphere-vm-resource-agent:{agent_version}",
registry
)),
sonobuoy_test_agent_image: Some(format!(
"{}/sonobuoy-test-agent:{agent_version}",
registry
)),
ecs_test_agent_image: Some(format!("{}/ecs-test-agent:{agent_version}", registry)),
migration_test_agent_image: Some(format!(
"{}/migration-test-agent:{agent_version}",
"{}/vsphere-vm-resource-agent:{tag}",
registry
)),
sonobuoy_test_agent_image: Some(format!("{}/sonobuoy-test-agent:{tag}", registry)),
ecs_test_agent_image: Some(format!("{}/ecs-test-agent:{tag}", registry)),
migration_test_agent_image: Some(format!("{}/migration-test-agent:{tag}", registry)),
testsys_agent_pull_secret: None,
}
}
Expand Down Expand Up @@ -325,7 +313,7 @@ impl TestsysImages {
}

pub fn public_images() -> Self {
Self::new("public.ecr.aws/bottlerocket-test-system")
Self::new("public.ecr.aws/bottlerocket-test-system", None)
}
}

Expand Down
3 changes: 3 additions & 0 deletions tools/testsys/Test.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ repo = "default"
# The registry containing alternate TestSys agent images
testsys-images-registry = "public.ecr.aws/bottlerocket-test-system"

# The tag that should be used with `testsys-images-registry` for image pulls
testsys-images-registry = "latest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we push a "latest" tag for the TestSys images? I don't think we do for the other container images we publish under Bottlerocket, should we follow that rule here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not push to the latest tag. We only push the testsys version. Due to image cacheing in k8s clusters, latest should be used when debugging new images. This feature allows someone testing new agents to specify a tag and a registry instead of explicitly listing each agent.


# The URI for the EKS resource agent that should be used. An individual agent's provided URI will be
# used even if `testsys-images-registry` is present.
eks-resource-agent-image = "public.ecr.aws/bottlerocket-test-system/eks_resource_agent:v0.0.2"
Expand Down
6 changes: 3 additions & 3 deletions tools/testsys/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ impl Run {
let images = vec![
Some(self.agent_images.into()),
Some(test_opts.testsys_images),
test_opts
.testsys_image_registry
.map(testsys_config::TestsysImages::new),
test_opts.testsys_image_registry.map(|registry| {
testsys_config::TestsysImages::new(registry, test_opts.testsys_image_tag)
}),
Some(testsys_config::TestsysImages::public_images()),
]
.into_iter()
Expand Down