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
dbc7c724
Unverified
Commit
dbc7c724
authored
Oct 28, 2022
by
Silvio Moioli
Committed by
GitHub
Oct 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable optimizations and symbol stripping on debug builds (#6147)
Signed-off-by:
Silvio Moioli
<
silvio@moioli.net
>
Co-authored-by:
Brad Davidson
<
brad@oatmail.org
>
parent
61560591
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
Dockerfile.dapper
Dockerfile.dapper
+1
-1
binary_size_check.sh
scripts/binary_size_check.sh
+5
-0
build
scripts/build
+11
-7
No files found.
Dockerfile.dapper
View file @
dbc7c724
...
@@ -42,7 +42,7 @@ ARG SELINUX=true
...
@@ -42,7 +42,7 @@ ARG SELINUX=true
ENV SELINUX $SELINUX
ENV SELINUX $SELINUX
ENV DAPPER_RUN_ARGS --privileged -v k3s-cache:/go/src/github.com/k3s-io/k3s/.cache -v trivy-cache:/root/.cache/trivy
ENV DAPPER_RUN_ARGS --privileged -v k3s-cache:/go/src/github.com/k3s-io/k3s/.cache -v trivy-cache:/root/.cache/trivy
ENV DAPPER_ENV REPO TAG DRONE_TAG IMAGE_NAME SKIP_VALIDATE SKIP_AIRGAP GCLOUD_AUTH GITHUB_TOKEN GOLANG
ENV DAPPER_ENV REPO TAG DRONE_TAG IMAGE_NAME SKIP_VALIDATE SKIP_AIRGAP GCLOUD_AUTH GITHUB_TOKEN GOLANG
DEBUG
ENV DAPPER_SOURCE /go/src/github.com/k3s-io/k3s/
ENV DAPPER_SOURCE /go/src/github.com/k3s-io/k3s/
ENV DAPPER_OUTPUT ./bin ./dist ./build/out ./build/static ./pkg/static ./pkg/deploy
ENV DAPPER_OUTPUT ./bin ./dist ./build/out ./build/static ./pkg/static ./pkg/deploy
...
...
scripts/binary_size_check.sh
View file @
dbc7c724
...
@@ -24,6 +24,11 @@ fi
...
@@ -24,6 +24,11 @@ fi
CMD_NAME
=
"dist/artifacts/k3s
${
BIN_SUFFIX
}
"
CMD_NAME
=
"dist/artifacts/k3s
${
BIN_SUFFIX
}
"
SIZE
=
$(
stat
-c
'%s'
${
CMD_NAME
})
SIZE
=
$(
stat
-c
'%s'
${
CMD_NAME
})
if
[
-n
"
${
DEBUG
}
"
]
;
then
echo
"DEBUG is set, ignoring binary size"
exit
0
fi
if
[
${
SIZE
}
-gt
${
MAX_BINARY_SIZE
}
]
;
then
if
[
${
SIZE
}
-gt
${
MAX_BINARY_SIZE
}
]
;
then
echo
"k3s binary
${
CMD_NAME
}
size
${
SIZE
}
exceeds max acceptable size of
${
MAX_BINARY_SIZE
}
bytes (
${
MAX_BINARY_MB
}
MiB)"
echo
"k3s binary
${
CMD_NAME
}
size
${
SIZE
}
exceeds max acceptable size of
${
MAX_BINARY_SIZE
}
bytes (
${
MAX_BINARY_MB
}
MiB)"
exit
1
exit
1
...
...
scripts/build
View file @
dbc7c724
...
@@ -42,8 +42,12 @@ VERSIONFLAGS="
...
@@ -42,8 +42,12 @@ VERSIONFLAGS="
-X
${
PKG_CNI_PLUGINS
}
/plugins/meta/flannel.Commit=
${
COMMIT
}
-X
${
PKG_CNI_PLUGINS
}
/plugins/meta/flannel.Commit=
${
COMMIT
}
-X
${
PKG_CNI_PLUGINS
}
/plugins/meta/flannel.buildDate=
${
buildDate
}
-X
${
PKG_CNI_PLUGINS
}
/plugins/meta/flannel.buildDate=
${
buildDate
}
"
"
LDFLAGS
=
"
-w -s"
if
[
-n
"
${
DEBUG
}
"
]
;
then
GCFLAGS
=
"-N -l"
else
LDFLAGS
=
"-w -s"
fi
STATIC
=
"
STATIC
=
"
-extldflags '-static -lm -ldl -lz -lpthread'
-extldflags '-static -lm -ldl -lz -lpthread'
...
@@ -106,12 +110,12 @@ if [ ! -x ${INSTALLBIN}/cni ]; then
...
@@ -106,12 +110,12 @@ if [ ! -x ${INSTALLBIN}/cni ]; then
WORKDIR
=
$TMPDIR
/src/github.com/containernetworking/plugins
WORKDIR
=
$TMPDIR
/src/github.com/containernetworking/plugins
git clone
-b
$VERSION_CNIPLUGINS
https://github.com/rancher/plugins.git
$WORKDIR
git clone
-b
$VERSION_CNIPLUGINS
https://github.com/rancher/plugins.git
$WORKDIR
cd
$WORKDIR
cd
$WORKDIR
GO111MODULE
=
off
GOPATH
=
$TMPDIR
CGO_ENABLED
=
0
"
${
GO
}
"
build
-tags
"
$TAGS
"
-ldflags
"
$VERSIONFLAGS
$LDFLAGS
$STATIC
"
-o
$INSTALLBIN
/cni
GO111MODULE
=
off
GOPATH
=
$TMPDIR
CGO_ENABLED
=
0
"
${
GO
}
"
build
-tags
"
$TAGS
"
-
gcflags
=
"all=
${
GCFLAGS
}
"
-
ldflags
"
$VERSIONFLAGS
$LDFLAGS
$STATIC
"
-o
$INSTALLBIN
/cni
)
)
fi
fi
echo
Building k3s
echo
Building k3s
CGO_ENABLED
=
1
"
${
GO
}
"
build
-tags
"
$TAGS
"
-ldflags
"
$VERSIONFLAGS
$LDFLAGS
$STATIC
"
-o
bin/k3s ./cmd/server/main.go
CGO_ENABLED
=
1
"
${
GO
}
"
build
-tags
"
$TAGS
"
-
gcflags
=
"all=
${
GCFLAGS
}
"
-
ldflags
"
$VERSIONFLAGS
$LDFLAGS
$STATIC
"
-o
bin/k3s ./cmd/server/main.go
ln
-s
k3s ./bin/k3s-agent
ln
-s
k3s ./bin/k3s-agent
ln
-s
k3s ./bin/k3s-server
ln
-s
k3s ./bin/k3s-server
ln
-s
k3s ./bin/k3s-etcd-snapshot
ln
-s
k3s ./bin/k3s-etcd-snapshot
...
@@ -127,14 +131,14 @@ export GOPATH=$(pwd)/build
...
@@ -127,14 +131,14 @@ export GOPATH=$(pwd)/build
echo
Building containerd
echo
Building containerd
pushd
./build/src/github.com/containerd/containerd
pushd
./build/src/github.com/containerd/containerd
TAGS
=
"
${
TAGS
/netcgo/netgo
}
"
TAGS
=
"
${
TAGS
/netcgo/netgo
}
"
CGO_ENABLED
=
1
"
${
GO
}
"
build
-tags
"
$TAGS
"
-ldflags
"
$VERSIONFLAGS
$LDFLAGS
$STATIC
"
-o
bin/containerd ./cmd/containerd
CGO_ENABLED
=
1
"
${
GO
}
"
build
-tags
"
$TAGS
"
-
gcflags
=
"all=
${
GCFLAGS
}
"
-
ldflags
"
$VERSIONFLAGS
$LDFLAGS
$STATIC
"
-o
bin/containerd ./cmd/containerd
CGO_ENABLED
=
1
"
${
GO
}
"
build
-tags
"
$TAGS
"
-ldflags
"
$VERSIONFLAGS
$LDFLAGS
$STATIC
"
-o
bin/containerd-shim-runc-v2 ./cmd/containerd-shim-runc-v2
CGO_ENABLED
=
1
"
${
GO
}
"
build
-tags
"
$TAGS
"
-
gcflags
=
"all=
${
GCFLAGS
}
"
-
ldflags
"
$VERSIONFLAGS
$LDFLAGS
$STATIC
"
-o
bin/containerd-shim-runc-v2 ./cmd/containerd-shim-runc-v2
popd
popd
cp
-vf
./build/src/github.com/containerd/containerd/bin/
*
./bin/
cp
-vf
./build/src/github.com/containerd/containerd/bin/
*
./bin/
echo
Building runc
echo
Building runc
pushd
./build/src/github.com/opencontainers/runc
pushd
./build/src/github.com/opencontainers/runc
rm
-f
runc
rm
-f
runc
make
EXTRA_
LDFLAGS
=
"-w -s
"
BUILDTAGS
=
"
$RUNC_TAGS
"
$RUNC_STATIC
make
EXTRA_
FLAGS
=
"-gcflags=
\"
all=
${
GCFLAGS
}
\"
"
EXTRA_LDFLAGS
=
"
$LDFLAGS
"
BUILDTAGS
=
"
$RUNC_TAGS
"
$RUNC_STATIC
popd
popd
cp
-vf
./build/src/github.com/opencontainers/runc/runc ./bin/
cp
-vf
./build/src/github.com/opencontainers/runc/runc ./bin/
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