Skip to content

Commit 804723d

Browse files
committed
scripts: Pre-pull extra approved images
Some integration tests might run on more approved images. Find which it is based on the test file then pre-pull it. Signed-off-by: Beñat Gartzia Arruabarrena <bgartzia@redhat.com> Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 860e486 commit 804723d

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

scripts/pre-pull-images.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@
44
#
55
# SPDX-License-Identifier: CC0-1.0
66

7+
secondary_approved_image() {
8+
sed -nE 's/const COMBINE_PCRS_UPDATE_TEST_IMAGE: &str = "(.*)";/\1/p' tests/trusted_execution_cluster.rs
9+
}
710

811
## Special handling for the approved image because of the kind issue with
912
## loading images used by image volumes. See:
1013
## https://github.com/kubernetes-sigs/kind/issues/4099
11-
LOCAL_APPROVED_IMAGE=localhost:5000/approved-image:latest
12-
docker pull $APPROVED_IMAGE
13-
docker tag $APPROVED_IMAGE $LOCAL_APPROVED_IMAGE
14-
docker push $LOCAL_APPROVED_IMAGE
15-
docker exec -ti kind-control-plane crictl pull $LOCAL_APPROVED_IMAGE
14+
pull_approved_image() {
15+
local image=$1
16+
local index=$2
17+
local local_image="localhost:5000/approved-image-${index}:latest"
18+
echo "Pulling approved image: $image"
19+
docker pull "$image"
20+
docker tag "$image" "$local_image"
21+
docker push "$local_image"
22+
docker exec -ti kind-control-plane crictl pull "$local_image"
23+
echo "-------------------------------"
24+
}
25+
26+
pull_approved_image "$APPROVED_IMAGE" 0
27+
pull_approved_image "$(secondary_approved_image)" 1
1628

1729
KV_VERSION=v1.7.0
1830
IMAGES=(

tests/trusted_execution_cluster.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ use trusted_cluster_operator_lib::{
2222
use trusted_cluster_operator_test_utils::constants::*;
2323
use trusted_cluster_operator_test_utils::*;
2424

25+
const COMBINE_PCRS_UPDATE_TEST_IMAGE: &str = "quay.io/trusted-execution-clusters/fedora-coreos@sha256:372a5db90a8695fafc2869d438bacd7f0ef7fd84f63746a450bfcd4b8b64ae83";
26+
2527
fn ak_approved(ak: Option<&AttestationKey>) -> bool {
2628
let is_approved = |c: &Condition| c.type_ == "Approved" && c.status == "True";
2729
let cs = ak.and_then(|ak| ak.status.as_ref().and_then(|s| s.conditions.as_ref()));
@@ -357,7 +359,7 @@ async fn test_approved_image_readoption() -> anyhow::Result<()> {
357359
named_test! {
358360
async fn test_combined_image_pcrs_configmap_updates() -> anyhow::Result<()> {
359361
let test_ctx = setup!([
360-
"quay.io/trusted-execution-clusters/fedora-coreos@sha256:372a5db90a8695fafc2869d438bacd7f0ef7fd84f63746a450bfcd4b8b64ae83",
362+
COMBINE_PCRS_UPDATE_TEST_IMAGE,
361363
]).await?;
362364
let client = test_ctx.client();
363365
let namespace = test_ctx.namespace();

0 commit comments

Comments
 (0)