mirror of
https://github.com/rancher/os.git
synced 2025-07-07 20:08:37 +00:00
Merge pull request #969 from ibuildthecloud/scripts
More build script changes
This commit is contained in:
commit
6fd0beda35
@ -10,3 +10,6 @@ tests/integration/.venv*
|
|||||||
tests/integration/.tox
|
tests/integration/.tox
|
||||||
*/*/*/*.pyc
|
*/*/*/*.pyc
|
||||||
*/*/*/__pycache__
|
*/*/*/__pycache__
|
||||||
|
.trash-cache
|
||||||
|
.dapper
|
||||||
|
vendor/*/*/*/.git
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -14,4 +14,5 @@
|
|||||||
/tests/integration/.idea
|
/tests/integration/.idea
|
||||||
*.pyc
|
*.pyc
|
||||||
__pycache__
|
__pycache__
|
||||||
.dapper
|
/.dapper
|
||||||
|
/.trash-cache
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
FROM ubuntu:16.04
|
FROM ubuntu:16.04
|
||||||
|
# FROM arm64=aarch64/ubuntu:16.04 arm=armhf/ubuntu:16.04
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
@ -33,6 +34,7 @@ ENV DAPPER_DOCKER_SOCKET true
|
|||||||
ENV DAPPER_SOURCE /go/src/github.com/rancher/os
|
ENV DAPPER_SOURCE /go/src/github.com/rancher/os
|
||||||
ENV DAPPER_OUTPUT ./bin ./dist ./build/initrd
|
ENV DAPPER_OUTPUT ./bin ./dist ./build/initrd
|
||||||
ENV DAPPER_RUN_ARGS --privileged
|
ENV DAPPER_RUN_ARGS --privileged
|
||||||
|
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
|
||||||
ENV SHELL /bin/bash
|
ENV SHELL /bin/bash
|
||||||
WORKDIR ${DAPPER_SOURCE}
|
WORKDIR ${DAPPER_SOURCE}
|
||||||
|
|
||||||
@ -73,6 +75,7 @@ ARG OS_BASE_URL_arm=https://github.com/rancher/os-base/releases/download/v2016.0
|
|||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
# Set up environment
|
# Set up environment
|
||||||
|
ENV GOARCH $ARCH
|
||||||
ENV DOCKER_URL DOCKER_URL_${ARCH}
|
ENV DOCKER_URL DOCKER_URL_${ARCH}
|
||||||
ENV KERNEL_URL KERNEL_URL_${ARCH}
|
ENV KERNEL_URL KERNEL_URL_${ARCH}
|
||||||
ENV OS_BASE_URL OS_BASE_URL_${ARCH}
|
ENV OS_BASE_URL OS_BASE_URL_${ARCH}
|
||||||
@ -120,6 +123,12 @@ RUN URL=DOCKER_URL_${HOST_ARCH} && \
|
|||||||
# Install Docker
|
# Install Docker
|
||||||
RUN curl -fL ${!DOCKER_URL} > ${DOWNLOADS}/docker && \
|
RUN curl -fL ${!DOCKER_URL} > ${DOWNLOADS}/docker && \
|
||||||
chmod +x ${DOWNLOADS}/docker
|
chmod +x ${DOWNLOADS}/docker
|
||||||
|
# Install Trash
|
||||||
|
RUN go get github.com/rancher/trash
|
||||||
|
|
||||||
|
# Install dapper
|
||||||
|
RUN curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > /usr/bin/dapper && \
|
||||||
|
chmod +x /usr/bin/dapper
|
||||||
|
|
||||||
# Install toolchain
|
# Install toolchain
|
||||||
RUN TOOLCHAIN=TOOLCHAIN_${ARCH} && \
|
RUN TOOLCHAIN=TOOLCHAIN_${ARCH} && \
|
||||||
@ -168,10 +177,6 @@ RUN source /usr/src/toolchain-env; if [ "${TOOLCHAIN}" != "" ]; then \
|
|||||||
make install \
|
make install \
|
||||||
;fi
|
;fi
|
||||||
|
|
||||||
ENV GOARCH $ARCH
|
|
||||||
|
|
||||||
RUN curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > /usr/bin/dapper && \
|
|
||||||
chmod +x /usr/bin/dapper
|
|
||||||
|
|
||||||
RUN mkdir -p images/00-rootfs/build && \
|
RUN mkdir -p images/00-rootfs/build && \
|
||||||
curl -pfL ${!OS_BASE_URL} | tar xvJf - -C images/00-rootfs/build
|
curl -pfL ${!OS_BASE_URL} | tar xvJf - -C images/00-rootfs/build
|
||||||
|
3
Makefile
3
Makefile
@ -25,6 +25,9 @@ run: build/initrd/.id
|
|||||||
dapper -m bind build-target
|
dapper -m bind build-target
|
||||||
./scripts/run
|
./scripts/run
|
||||||
|
|
||||||
|
shell-bind:
|
||||||
|
dapper -m bind -s
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@./scripts/clean
|
@./scripts/clean
|
||||||
|
|
||||||
|
@ -14,4 +14,5 @@ fi
|
|||||||
|
|
||||||
OUTPUT=${OUTPUT:-bin/ros}
|
OUTPUT=${OUTPUT:-bin/ros}
|
||||||
echo Building $OUTPUT
|
echo Building $OUTPUT
|
||||||
go build -tags netgo -installsuffix netgo -ldflags "-X github.com/rancher/os/config.VERSION=${VERSION} -linkmode external -extldflags -static" -o ${OUTPUT}
|
go build -tags "selinux cgo daemon netgo" -installsuffix netgo -ldflags "-X github.com/rancher/os/config.VERSION=${VERSION} -linkmode external -extldflags -static" -o ${OUTPUT}
|
||||||
|
strip --strip-all ${OUTPUT}
|
||||||
|
5
scripts/hash-initrd
Executable file
5
scripts/hash-initrd
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd $(dirname $0)/../build/initrd
|
||||||
|
|
||||||
|
md5sum $(find -type f | sort -u ) | md5sum - | awk '{print $1}' > .id
|
@ -24,7 +24,19 @@ ln -s usr/sbin ${INITRD_DIR}/sbin
|
|||||||
|
|
||||||
|
|
||||||
if [ -e ${DOWNLOADS}/kernel.tar.gz ]; then
|
if [ -e ${DOWNLOADS}/kernel.tar.gz ]; then
|
||||||
tar xf ${DOWNLOADS}/kernel.tar.gz -C ${INITRD_DIR}/usr/ lib/
|
mkdir -p ${BUILD}/kernel
|
||||||
|
tar xf ${DOWNLOADS}/kernel.tar.gz -C ${BUILD}/kernel
|
||||||
|
|
||||||
|
if [ -e ${BUILD}/kernel/boot/vmlinuz-* ]; then
|
||||||
|
mkdir -p dist/artifacts
|
||||||
|
cp ${BUILD}/kernel/boot/vmlinuz-* dist/artifacts/vmlinuz
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d ${BUILD}/kernel/lib ]; then
|
||||||
|
rm -rf ${INITRD_DIR}/usr/lib
|
||||||
|
cp -rf ${BUILD}/kernel/lib ${INITRD_DIR}/usr/
|
||||||
|
depmod -b ${INITRD_DIR}/usr $(basename ${INITRD_DIR}/usr/lib/modules/*)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e ${DOWNLOADS}/policy.29 ]; then
|
if [ -e ${DOWNLOADS}/policy.29 ]; then
|
||||||
@ -43,11 +55,4 @@ docker export ${DFS_ARCH} | tar xf - -C ${INITRD_DIR} --exclude=usr/bin/dockerla
|
|||||||
--exclude=usr/libexec/git-core \
|
--exclude=usr/libexec/git-core \
|
||||||
usr
|
usr
|
||||||
|
|
||||||
tar xf ${DOWNLOADS}/kernel.tar.gz -C ${BUILD} boot/
|
./scripts/hash-initrd
|
||||||
|
|
||||||
if [ -e ${BUILD}/boot/vmlinuz-* ]; then
|
|
||||||
mkdir -p dist/artifacts
|
|
||||||
cp ${BUILD}/boot/vmlinuz-* dist/artifacts/vmlinuz
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat /proc/sys/kernel/random/uuid > ${INITRD_DIR}/.id
|
|
||||||
|
@ -111,6 +111,7 @@ fi
|
|||||||
|
|
||||||
if [ "$REBUILD" == "1" ] || [ ! -e ${INITRD} ]; then
|
if [ "$REBUILD" == "1" ] || [ ! -e ${INITRD} ]; then
|
||||||
cp bin/ros ${INITRD_SRC}/usr/bin/ros
|
cp bin/ros ${INITRD_SRC}/usr/bin/ros
|
||||||
|
./scripts/hash-initrd
|
||||||
pushd ${INITRD_SRC} >/dev/null
|
pushd ${INITRD_SRC} >/dev/null
|
||||||
find . | cpio -H newc -o | gzip -1 > ${INITRD}
|
find . | cpio -H newc -o | gzip -1 > ${INITRD}
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
@ -8,4 +8,7 @@ echo Running tests
|
|||||||
|
|
||||||
PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"
|
PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"
|
||||||
|
|
||||||
go test -race -cover -tags=test ${PACKAGES}
|
if [ "$ARCH" = "amd64" ]; then
|
||||||
|
RACE="-race"
|
||||||
|
fi
|
||||||
|
go test $RACE -cover -tags=test ${PACKAGES}
|
||||||
|
Loading…
Reference in New Issue
Block a user