Skip to content

Commit f6432ab

Browse files
use custom image. simplify script
1 parent 01e00b5 commit f6432ab

File tree

2 files changed

+8
-37
lines changed

2 files changed

+8
-37
lines changed

.buildkite/pipeline.agentless-tests.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ steps:
1818
- label: ":docker: Validate docker image is built for all architectures"
1919
command: ".buildkite/scripts/steps/validate-agentless-docker-image.sh"
2020
agents:
21-
provider: "gcp"
21+
provider: "docker.elastic.co/ci-agent-images/observability/oci-image-tools-agent:latest@sha256:a4ababd1347111759babc05c9ad5a680f4af48892784951358488b7e7fc94af9"
22+
plugins:
23+
- elastic/vault-docker-login#v0.6.1:
24+
secret_path: 'kv/ci-shared/platform-ingest/elastic_docker_registry'
2225

2326
- wait
2427

.buildkite/scripts/steps/validate-agentless-docker-image.sh

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,53 +23,21 @@ REQUIRED_ARCHITECTURES=("amd64" "arm64")
2323
_SELF=$(dirname "$0")
2424
source "${_SELF}/../common.sh"
2525

26-
setup_extract_sha() {
27-
# Ensure repo is available - redirect output to /dev/null
28-
if [ ! -d "serverless-gitops" ]; then
29-
git clone --depth 1 [email protected]:elastic/serverless-gitops.git
30-
else
31-
(cd serverless-gitops && git pull)
32-
fi
33-
34-
# Install yq for YAML parsing
35-
go install github.com/mikefarah/yq/[email protected]
36-
}
37-
38-
extract_sha() {
39-
local env=$1
40-
41-
# Extract first matching SHA for the environment pattern
42-
yq eval ".services.agentless.versions | with_entries(select(.key | test(\"^${env}.*\"))) | to_entries | .[0].value // \"\"" serverless-gitops/services/agentless/versions.yaml
43-
}
44-
45-
echo "--- :docker: Validating Docker image architectures"
46-
47-
# Check environment variable
48-
if [ -z "${ENVIRONMENT:-}" ]; then
49-
echo "ENVIRONMENT variable is not set"
50-
exit 1
51-
fi
52-
53-
setup_extract_sha
54-
55-
# Extract the SHA for the specified environment
56-
COMMIT_SHA=$(extract_sha "$ENVIRONMENT")
57-
58-
if [ -z "$COMMIT_SHA" ]; then
26+
if [ -z "$SERVICE_VERSION" ]; then
5927
echo "No SHA found for environment: $ENVIRONMENT"
6028
exit 1
6129
fi
6230

63-
DOCKER_TAG="git-${COMMIT_SHA}"
31+
DOCKER_TAG="git-${SERVICE_VERSION}"
6432
PRIVATE_IMAGE="${PRIVATE_REPO}:${DOCKER_TAG}"
6533

6634
echo "Environment: ${ENVIRONMENT}"
67-
echo "Commit SHA: ${COMMIT_SHA}"
35+
echo "Commit SHA: ${SERVICE_VERSION}"
6836
echo "Validating image: ${PRIVATE_IMAGE}"
6937

7038
# Inspect the manifest to get architecture information
7139
echo "--- :mag: Inspecting image manifest"
72-
MANIFEST_OUTPUT=$(docker manifest inspect "$PRIVATE_IMAGE" 2>&1) || {
40+
MANIFEST_OUTPUT=$(skopeo inspect docker://"${PRIVATE_IMAGE}" --raw 2>&1) || {
7341
echo "Failed to inspect manifest for image: ${PRIVATE_IMAGE}"
7442
echo "Error: ${MANIFEST_OUTPUT}"
7543
exit 1

0 commit comments

Comments
 (0)