mirror of
https://github.com/rancher/os.git
synced 2025-07-01 17:21:50 +00:00
Merge pull request #1011 from imikushin/fix-installer
Fix installer build
This commit is contained in:
commit
a002939a3f
@ -2,9 +2,11 @@ FROM debian:jessie
|
|||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
RUN apt-get update && apt-get install -y grub2 parted kexec-tools
|
RUN apt-get update && apt-get install -y grub2 parted kexec-tools
|
||||||
|
|
||||||
COPY conf lay-down-os seed-data set-disk-partitions /scripts/installer/
|
COPY conf lay-down-os seed-data set-disk-partitions /scripts/
|
||||||
COPY ./build/build.conf /scripts/
|
|
||||||
COPY ./build/vmlinuz /dist/vmlinuz
|
COPY ./build/vmlinuz /dist/vmlinuz
|
||||||
COPY ./build/initrd /dist/initrd
|
COPY ./build/initrd /dist/initrd
|
||||||
|
|
||||||
|
ARG VERSION
|
||||||
|
ENV VERSION=${VERSION}
|
||||||
|
|
||||||
ENTRYPOINT ["/scripts/lay-down-os"]
|
ENTRYPOINT ["/scripts/lay-down-os"]
|
||||||
|
@ -9,9 +9,11 @@ RUN mkdir -p /usr/local/src && \
|
|||||||
git clone https://git.linaro.org/people/takahiro.akashi/kexec-tools.git && \
|
git clone https://git.linaro.org/people/takahiro.akashi/kexec-tools.git && \
|
||||||
cd kexec-tools && git checkout kdump/for-14 && ./bootstrap && ./configure && make && make install
|
cd kexec-tools && git checkout kdump/for-14 && ./bootstrap && ./configure && make && make install
|
||||||
|
|
||||||
COPY conf lay-down-os seed-data set-disk-partitions /scripts/installer/
|
COPY conf lay-down-os seed-data set-disk-partitions /scripts/
|
||||||
COPY ./build/build.conf /scripts/
|
|
||||||
COPY ./build/vmlinuz /dist/vmlinuz
|
COPY ./build/vmlinuz /dist/vmlinuz
|
||||||
COPY ./build/initrd /dist/initrd
|
COPY ./build/initrd /dist/initrd
|
||||||
|
|
||||||
|
ARG VERSION
|
||||||
|
ENV VERSION=${VERSION}
|
||||||
|
|
||||||
ENTRYPOINT ["/scripts/lay-down-os"]
|
ENTRYPOINT ["/scripts/lay-down-os"]
|
||||||
|
@ -3,7 +3,6 @@ set -e -x
|
|||||||
|
|
||||||
SCRIPTS_DIR=$(dirname ${0})
|
SCRIPTS_DIR=$(dirname ${0})
|
||||||
|
|
||||||
. "${SCRIPTS_DIR}/build.conf"
|
|
||||||
VERSION=${VERSION:?"VERSION not set"}
|
VERSION=${VERSION:?"VERSION not set"}
|
||||||
|
|
||||||
while getopts "i:f:c:d:t:r:o:p:ka:" OPTION
|
while getopts "i:f:c:d:t:r:o:p:ka:" OPTION
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
# help: Run Python based integration tests
|
# help: Run Python based integration tests
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
source $(dirname $0)/version
|
||||||
|
|
||||||
cd $(dirname $0)/../tests/integration
|
cd $(dirname $0)/../tests/integration
|
||||||
|
|
||||||
if [ ! -e ../../dist/artifacts/initrd ]; then
|
if [ ! -e ../../dist/artifacts/initrd ]; then
|
||||||
|
@ -14,9 +14,8 @@ fi
|
|||||||
|
|
||||||
mkdir -p ./scripts/installer/build
|
mkdir -p ./scripts/installer/build
|
||||||
cp ./dist/artifacts/{initrd,vmlinuz} ./scripts/installer/build
|
cp ./dist/artifacts/{initrd,vmlinuz} ./scripts/installer/build
|
||||||
echo VERSION=$VERSION > ./scripts/installer/build/build.conf
|
|
||||||
trap "rm -rf ./scripts/installer/build" EXIT
|
trap "rm -rf ./scripts/installer/build" EXIT
|
||||||
|
|
||||||
docker build -t ${OS_REPO}/os:${VERSION}${SUFFIX} -f $DOCKERFILE ./scripts/installer
|
docker build -t ${OS_REPO}/os:${VERSION}${SUFFIX} --build-arg VERSION=${VERSION} -f $DOCKERFILE ./scripts/installer
|
||||||
echo ${OS_REPO}/os:${VERSION}${SUFFIX} > dist/images
|
echo ${OS_REPO}/os:${VERSION}${SUFFIX} > dist/images
|
||||||
echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}
|
echo Built ${OS_REPO}/os:${VERSION}${SUFFIX}
|
||||||
|
@ -2,6 +2,7 @@ import subprocess
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import rostest.util as u
|
import rostest.util as u
|
||||||
|
from rostest.util import SSH
|
||||||
|
|
||||||
ssh_command = ['./scripts/ssh', '--qemu']
|
ssh_command = ['./scripts/ssh', '--qemu']
|
||||||
|
|
||||||
@ -16,12 +17,16 @@ def qemu(request):
|
|||||||
@pytest.mark.timeout(40)
|
@pytest.mark.timeout(40)
|
||||||
def test_ros_install_on_formatted_disk(qemu):
|
def test_ros_install_on_formatted_disk(qemu):
|
||||||
u.wait_for_ssh(qemu, ssh_command)
|
u.wait_for_ssh(qemu, ssh_command)
|
||||||
subprocess.check_call(ssh_command + ['sudo', 'mkfs.ext4', '/dev/vda'],
|
|
||||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
|
||||||
|
|
||||||
subprocess.check_call(ssh_command + ['sudo', 'ros', 'install', '-f', '--no-reboot', '-d', '/dev/vda',
|
subprocess.check_call(
|
||||||
'-i', 'rancher/os:v0.4.4-dev' + u.suffix],
|
['sh', '-c', 'docker save rancher/os:%s%s | ./scripts/ssh sudo system-docker load' % (u.version, u.suffix)],
|
||||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||||
|
|
||||||
|
SSH(qemu, ssh_command).check_call('''
|
||||||
|
set -e -x
|
||||||
|
sudo mkfs.ext4 /dev/vda
|
||||||
|
sudo ros install -f --no-reboot -d /dev/vda -i rancher/os:%s%s
|
||||||
|
'''.strip() % (u.version, u.suffix))
|
||||||
|
|
||||||
subprocess.call(ssh_command + ['sudo', 'reboot'],
|
subprocess.call(ssh_command + ['sudo', 'reboot'],
|
||||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||||
|
@ -9,10 +9,12 @@ import pytest
|
|||||||
|
|
||||||
ros_test = 'ros-test'
|
ros_test = 'ros-test'
|
||||||
arch = os.environ.get('ARCH', 'amd64')
|
arch = os.environ.get('ARCH', 'amd64')
|
||||||
|
version = os.environ.get('VERSION')
|
||||||
|
suffix = os.environ.get('SUFFIX')
|
||||||
|
|
||||||
suffix = ''
|
|
||||||
if arch != 'amd64':
|
if version is None or version == '' or suffix is None:
|
||||||
suffix = '_' + arch
|
raise RuntimeError("Could not get VERSION or SUFFIX from environment")
|
||||||
|
|
||||||
|
|
||||||
def iter_lines(s):
|
def iter_lines(s):
|
||||||
@ -46,16 +48,6 @@ def with_effect(p):
|
|||||||
return effect
|
return effect
|
||||||
|
|
||||||
|
|
||||||
def rancheros_version(build_conf):
|
|
||||||
with open(build_conf) as f:
|
|
||||||
for v in it.ifilter(non_empty,
|
|
||||||
it.imap(parse_value('VERSION'),
|
|
||||||
it.ifilter(non_empty,
|
|
||||||
it.imap(strip_comment('#'), iter_lines(f))))):
|
|
||||||
return v
|
|
||||||
raise RuntimeError("Could not parse RancherOS version")
|
|
||||||
|
|
||||||
|
|
||||||
def run_qemu(request, run_args=[]):
|
def run_qemu(request, run_args=[]):
|
||||||
print('\nStarting QEMU')
|
print('\nStarting QEMU')
|
||||||
p = subprocess.Popen(['./scripts/run', '--qemu', '--no-rebuild', '--no-rm-usr', '--fresh'] + run_args,
|
p = subprocess.Popen(['./scripts/run', '--qemu', '--no-rebuild', '--no-rm-usr', '--fresh'] + run_args,
|
||||||
|
@ -4,7 +4,7 @@ skipsdist=True
|
|||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps=-rrequirements.txt
|
deps=-rrequirements.txt
|
||||||
passenv=HOST_ARCH ARCH
|
passenv=HOST_ARCH ARCH VERSION SUFFIX
|
||||||
commands=py.test -s --durations=20 rostest {posargs}
|
commands=py.test -s --durations=20 rostest {posargs}
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
|
Loading…
Reference in New Issue
Block a user