Adding support to run hcsshim from local clone

Signed-off-by: Mohit Sharma <mohit94614@gmail.com>
This commit is contained in:
Mohit Sharma 2023-01-24 22:55:12 +05:30
parent 3f565daf68
commit 77e51e9b03

View File

@ -16,6 +16,7 @@
: ${RUNHCS_VERSION:="$(grep 'Microsoft/hcsshim ' go.mod | awk '{print $2}')"} : ${RUNHCS_VERSION:="$(grep 'Microsoft/hcsshim ' go.mod | awk '{print $2}')"}
: ${RUNHCS_REPO:="https://github.com/Microsoft/hcsshim.git"} : ${RUNHCS_REPO:="https://github.com/Microsoft/hcsshim.git"}
: ${HCSSHIM_SRC:=''}
: ${DESTDIR:=''} : ${DESTDIR:=''}
: ${GOOS:="windows"} : ${GOOS:="windows"}
@ -28,13 +29,15 @@ cleanup() {
trap 'cleanup' EXIT trap 'cleanup' EXIT
export GOOS export GOOS
if [ "$HCSSHIM_SRC" == "" ]
( then
set -e -x set -e -x
cd "$tmpdir" cd "$tmpdir"
git init . git init .
git remote add origin "$RUNHCS_REPO" git remote add origin "$RUNHCS_REPO"
git fetch --tags --depth=1 origin ${RUNHCS_VERSION} git fetch --tags --depth=1 origin ${RUNHCS_VERSION}
else
cd "${HCSSHIM_SRC}"
fi
git checkout "refs/tags/${RUNHCS_VERSION}" || git checkout "refs/heads/${RUNHCS_VERSION}" || git checkout "${RUNHCS_VERSION}" git checkout "refs/tags/${RUNHCS_VERSION}" || git checkout "refs/heads/${RUNHCS_VERSION}" || git checkout "${RUNHCS_VERSION}"
GO111MODULE=on go build -mod=vendor -o "${DESTDIR}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1 GO111MODULE=on go build -mod=vendor -o "${DESTDIR}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1
)