Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
649cfd22
Unverified
Commit
649cfd22
authored
Jul 24, 2018
by
Davanum Srinivas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid sed bundled with Darwin for building test images
Change-Id: I4fc1d495c9a42d081107829cfae0cad6d5aa29ff Signed-off-by:
Davanum Srinivas
<
davanum@gmail.com
>
parent
4e5c781b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
image-util.sh
test/images/image-util.sh
+8
-5
No files found.
test/images/image-util.sh
View file @
649cfd22
...
...
@@ -22,6 +22,7 @@ TASK=$1
IMAGE
=
$2
KUBE_ROOT
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
}
"
)
/../.."
&&
pwd
-P
)
"
source
"
${
KUBE_ROOT
}
/hack/lib/util.sh"
# Mapping of go ARCH to actual architectures shipped part of multiarch/qemu-user-static project
declare
-A
QEMUARCHS
=(
[
"amd64"
]=
"x86_64"
[
"arm"
]=
"arm"
[
"arm64"
]=
"aarch64"
[
"ppc64le"
]=
"ppc64le"
[
"s390x"
]=
"s390x"
)
...
...
@@ -48,6 +49,8 @@ build() {
archs
=
${
!QEMUARCHS[@]
}
fi
kube::util::ensure-gnu-sed
for
arch
in
${
archs
}
;
do
echo
"Building image for
${
IMAGE
}
ARCH:
${
arch
}
..."
...
...
@@ -66,19 +69,19 @@ build() {
if
[[
-f
BASEIMAGE
]]
;
then
BASEIMAGE
=
$(
getBaseImage
${
arch
})
sed
-i
"s|BASEIMAGE|
${
BASEIMAGE
}
|g"
Dockerfile
${
SED
}
-i
"s|BASEIMAGE|
${
BASEIMAGE
}
|g"
Dockerfile
fi
# copy the qemu-*-static binary to docker image to build the multi architecture image on x86 platform
if
[[
$(
grep
"CROSS_BUILD_"
Dockerfile
)
]]
;
then
if
[[
"
${
arch
}
"
==
"amd64"
]]
;
then
sed
-i
"/CROSS_BUILD_/d"
Dockerfile
${
SED
}
-i
"/CROSS_BUILD_/d"
Dockerfile
else
sed
-i
"s|QEMUARCH|
${
QEMUARCHS
[
$arch
]
}
|g"
Dockerfile
${
SED
}
-i
"s|QEMUARCH|
${
QEMUARCHS
[
$arch
]
}
|g"
Dockerfile
# Register qemu-*-static for all supported processors except the current one
docker run
--rm
--privileged
multiarch/qemu-user-static:register
--reset
curl
-sSL
https://github.com/multiarch/qemu-user-static/releases/download/
${
QEMUVERSION
}
/x86_64_qemu-
${
QEMUARCHS
[
$arch
]
}
-static
.tar.gz |
tar
-xz
-C
${
temp_dir
}
sed
-i
"s/CROSS_BUILD_//g"
Dockerfile
${
SED
}
-i
"s/CROSS_BUILD_//g"
Dockerfile
fi
fi
...
...
@@ -101,7 +104,7 @@ push() {
done
# Make archs list into image manifest. Eg: 'amd64 ppc64le' to '${REGISTRY}/${IMAGE}-amd64:${TAG} ${REGISTRY}/${IMAGE}-ppc64le:${TAG}'
manifest
=
$(
echo
$archs
|
sed
-e
"s~[^ ]*~
$REGISTRY
\/
$IMAGE
\-
&:
$TAG
~g"
)
manifest
=
$(
echo
$archs
|
${
SED
}
-e
"s~[^ ]*~
$REGISTRY
\/
$IMAGE
\-
&:
$TAG
~g"
)
docker manifest create
--amend
${
REGISTRY
}
/
${
IMAGE
}
:
${
TAG
}
${
manifest
}
for
arch
in
${
archs
}
;
do
docker manifest annotate
--arch
${
arch
}
${
REGISTRY
}
/
${
IMAGE
}
:
${
TAG
}
${
REGISTRY
}
/
${
IMAGE
}
-
${
arch
}
:
${
TAG
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment