-
Notifications
You must be signed in to change notification settings - Fork 201
Add support for multi-arch image indexes #503
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
Open
jsing-canva
wants to merge
1
commit into
GoogleContainerTools:main
Choose a base branch
from
jsing-canva:multi-arch-upstream
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
schemaVersion: '2.0.0' # Make sure to test the latest schema version | ||
commandTests: | ||
- name: 'fluent-bit' | ||
command: '/fluent-bit/bin/fluent-bit' | ||
args: ['--version'] | ||
expectedOutput: ['Fluent Bit v4.0.4'] | ||
fileContentTests: | ||
- name: 'Passwd file' | ||
expectedContents: ['root:x:0:0:root:/root:/sbin/nologin'] | ||
path: '/etc/passwd' | ||
fileExistenceTests: | ||
- name: 'Root' | ||
path: '/' | ||
shouldExist: true | ||
uid: 0 | ||
gid: 0 | ||
- name: 'libc' | ||
path: '/lib/x86_64-linux-gnu/libc.so.6' | ||
shouldExist: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
schemaVersion: '2.0.0' # Make sure to test the latest schema version | ||
commandTests: | ||
- name: 'fluent-bit' | ||
command: '/fluent-bit/bin/fluent-bit' | ||
args: ['--version'] | ||
expectedOutput: ['Fluent Bit v4.0.4'] | ||
fileContentTests: | ||
- name: 'Passwd file' | ||
expectedContents: ['root:x:0:0:root:/root:/sbin/nologin'] | ||
path: '/etc/passwd' | ||
fileExistenceTests: | ||
- name: 'Root' | ||
path: '/' | ||
shouldExist: true | ||
uid: 0 | ||
gid: 0 | ||
- name: 'libc' | ||
path: '/lib/aarch64-linux-gnu/libc.so.6' | ||
shouldExist: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,6 +246,41 @@ else | |
echo "PASS: oci success test case" | ||
fi | ||
|
||
HEADER "OCI multi-arch image index test case" | ||
|
||
if [[ "$go_architecture" == "amd64" || "$go_architecture" == "arm64" ]]; then | ||
test_index="cr.fluentbit.io/fluent/fluent-bit:4.0.4" | ||
|
||
manifest=$(docker manifest inspect "$test_index") | ||
if [[ $(echo "$manifest" | jq '.mediaType') != '"application/vnd.docker.distribution.manifest.list.v2+json"' ]]; then | ||
echo "FAIL: multi-arch image index test case - $test_index is not an image index" | ||
echo "$manifest" | jq '.mediaType' | ||
failures=$((failures +1)) | ||
fi | ||
image_count=$(echo "$manifest" | jq '.manifests | length') | ||
if [[ $image_count < 2 ]]; then | ||
echo "FAIL: multi-arch image index test case - $test_index only has $image_count image(s)" | ||
failures=$((failures +1)) | ||
fi | ||
|
||
tmp="$(mktemp -d)" | ||
crane pull "$test_index" --format=oci "$tmp" | ||
|
||
res=$(./out/container-structure-test test --image-from-oci-layout="$tmp" --default-image-tag="test.local/$test_index" --config "${test_config_dir}/fluent_bit_test.yaml" 2>&1) | ||
code=$? | ||
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
then | ||
echo "FAIL: oci image index success test case" | ||
echo "$res" | ||
echo "$code" | ||
failures=$((failures +1)) | ||
else | ||
echo "PASS: oci image index test case" | ||
fi | ||
else | ||
echo "SKIP: oci image index text case not supported on $go_architecture" | ||
fi | ||
|
||
HEADER "Platform test cases" | ||
|
||
docker run --rm --privileged tonistiigi/binfmt --install all > /dev/null | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for finding an image within an OCI layout is flawed. It depends on
desc := m.Manifests[0]
from line 175, which means it only ever considers the first manifest in the layout's index. For a multi-arch image, this may not be the correct platform. Instead, usefindImageInIndex
directly on the loaded layout indexl
.