Skip to content

Commit

Permalink
Make buildvcs=false conditional on go version
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekchaudhry committed Jul 12, 2022
1 parent 079ddca commit 3bc440c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/build-cni-plugins
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ esac
if [ "$architecture" == "amd64" ]; then export GOARCH=amd64; fi
if [ "$architecture" == "arm64" ]; then export GOARCH=arm64; fi

goversion=`go version | cut -d' ' -f3 | cut -c 3-`

# this script assumes we've run the get-cni-sources make target to update the cni submodules
ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )
cd "${ROOT}"
Expand All @@ -52,6 +54,12 @@ ln -s "${ROOT}/amazon-vpc-cni-plugins" "${GITPATH}"
cd ${GITPATH}/amazon-ecs-cni-plugins && GO111MODULE=auto make plugins
mkdir -p ${ROOT}/misc/plugins && cp -a ./bin/plugins/. ${ROOT}/misc/plugins/
make clean
cd ${GITPATH}/amazon-vpc-cni-plugins && GO111MODULE=on GOFLAGS="-mod=vendor -buildvcs=false" make aws-appmesh vpc-branch-eni

# buildvcs=false excludes version control information in golang >= 1.18. This is required for compiling agent with included repositories
if [[ $goversion < "1.18" ]]; then
cd ${GITPATH}/amazon-vpc-cni-plugins && GO111MODULE=on GOFLAGS="-mod=vendor" make aws-appmesh vpc-branch-eni
else
cd ${GITPATH}/amazon-vpc-cni-plugins && GO111MODULE=on GOFLAGS="-mod=vendor -buildvcs=false" make aws-appmesh vpc-branch-eni
fi
cp -a ./build/linux_${GOARCH}/. ${ROOT}/misc/plugins/
make clean

0 comments on commit 3bc440c

Please sign in to comment.