Skip to content
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

Updated the hardcoded dependencies #1051

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export GOOS=windows
export GOFLAGS="${GOFLAGS} -mod=vendor"
echo "$GOFLAGS"

PLUGINS=$(cat plugins/windows_only.txt | dos2unix )
PLUGINS=$(cat plugins/windows_only.txt | sed 's/\r//' )
for d in $PLUGINS; do
plugin="$(basename "$d").exe"
echo "building $plugin"
Expand Down
35 changes: 27 additions & 8 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@ set -xe

SRC_DIR="${SRC_DIR:-$PWD}"
DOCKER="${DOCKER:-docker}"
GOLANG="${GOLANG:-golang:1.22-alpine}"

TAG=$(git describe --tags --dirty)
GO_IMAGE="${GO_IMAGE:-golang}"
GO_VERSION="${GO_VERSION:-1.22-alpine}"
GOLANG="${GO_IMAGE}:${GO_VERSION}"

_defaultTag=$(git describe --tags --dirty)
TAG=${TAG:-$_defaultTag}
RELEASE_DIR=release-${TAG}

BUILDFLAGS="-ldflags '-extldflags -static -X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${TAG}'"
DOCKER_RUN_ARGS=${DOCKER_RUN_ARGS:-'-ti'}

CGO_ENABLED="${CGO_ENABLED:-0}"
EXTLDFLAGS_LINUX=""
if [ "${CGO_ENABLED}" == "0" ]; then
EXTLDFLAGS_LINUX="-extldflags -static"
fi

GOARCH_LIST="${GOARCH_LIST:-amd64 arm arm64 ppc64le s390x mips64le riscv64}"

BUILDFLAGS_LINUX="-ldflags '${EXTLDFLAGS_LINUX} -X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${TAG}'"
BUILDFLAGS_WINDOWS="-ldflags '-extldflags -static -X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${TAG}'"

OUTPUT_DIR=bin

Expand All @@ -17,14 +32,18 @@ rm -Rf ${SRC_DIR}/${RELEASE_DIR}
mkdir -p ${SRC_DIR}/${RELEASE_DIR}
mkdir -p ${OUTPUT_DIR}

$DOCKER run -ti -v ${SRC_DIR}:/go/src/github.com/containernetworking/plugins:z --rm "${GOLANG}" \
$DOCKER run ${DOCKER_RUN_ARGS} -v ${SRC_DIR}:/go/src/github.com/containernetworking/plugins:z --rm "${GOLANG}" \
/bin/sh -xe -c "\
apk --no-cache add bash tar;
for cmd in bash tar; do
command -v apk && apk --no-cache add \$cmd
command -v \$cmd || (echo \$cmd not found && exit 1);
done

cd /go/src/github.com/containernetworking/plugins; umask 0022;

for arch in amd64 arm arm64 ppc64le s390x mips64le riscv64; do \
for arch in ${GOARCH_LIST}; do \
rm -f ${OUTPUT_DIR}/*; \
CGO_ENABLED=0 GOARCH=\$arch ./build_linux.sh ${BUILDFLAGS}; \
CGO_ENABLED=${CGO_ENABLED} GOARCH=\$arch ./build_linux.sh ${BUILDFLAGS_LINUX}; \
for format in tgz; do \
FILENAME=cni-plugins-linux-\$arch-${TAG}.\$format; \
FILEPATH=${RELEASE_DIR}/\$FILENAME; \
Expand All @@ -33,7 +52,7 @@ $DOCKER run -ti -v ${SRC_DIR}:/go/src/github.com/containernetworking/plugins:z -
done;

rm -rf ${OUTPUT_DIR}/*; \
CGO_ENABLED=0 GOARCH=amd64 ./build_windows.sh ${BUILDFLAGS}; \
CGO_ENABLED=0 GOARCH=amd64 ./build_windows.sh ${BUILDFLAGS_WINDOWS}; \
for format in tgz; do \
FILENAME=cni-plugins-windows-amd64-${TAG}.\$format; \
FILEPATH=${RELEASE_DIR}/\$FILENAME; \
Expand Down