Skip to content
This repository was archived by the owner on Apr 27, 2022. It is now read-only.
Merged
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
37 changes: 36 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,45 @@ language: python
python:
- "2.7"

sudo: required

install:
- pip install pep8

script:
services:
- docker

before_script:
# Run pep8 on all .py files in all subfolders
# ignore E402: module level import not at top of file
- find . -name \*.py -exec pep8 --ignore=E402 {} +

# Run Ceph Container and Wait for some time so that ceph runs
- sudo docker run -d -v ceph:/etc/ceph -e MON_IP=172.17.0.2 -e CEPH_PUBLIC_NETWORK=172.17.0.0/24 --name ceph ceph/demo:tag-build-master-hammer-centos-7
- sleep 30

# Run HIL Container
- sudo docker run -d --name hil bmis/hil

# Build BMI Container From Environment Image
- sudo docker pull bmis/bmi-ci
- sudo docker build -t bmi-test -f Dockerfile_ci .
- sudo docker run -d -e TRAVIS=$TRAVIS -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID -e TRAVIS_BRANCH=$TRAVIS_BRANCH -v ceph:/etc/ceph --name bmi bmi-test

# Just for debugging purposes to check if all containers run
- sudo docker ps

# Insert Image into Ceph using ceph client in BMI Container
- sudo docker exec bmi rbd create --image-format 2 --size 10 bmi_test

script:
# Run Tests in BMI container
- sudo docker exec bmi pytest -v --random-order-bucket=global --cov=ims --ignore tests/unit/picasso tests/

after_success:
# Submit Coverage to Coveralls
- sudo docker exec bmi coveralls
after_script:
# Extract and Upload logs for debugging incase of failure
- sudo docker cp bmi:/var/log/bmi/ims.log ./ims.log
- curl -sT ./ims.log chunk.io
24 changes: 24 additions & 0 deletions Dockerfile_ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This will be by CI tool to build BMI image that will be used for testing.

# Basing on image stored in docker hub for faster build
FROM bmis/bmi-ci

# Copy source code
USER bmi
COPY .git/ /home/bmi/.git
COPY ims/ /home/bmi/ims/
COPY tests/ /home/bmi/tests/
COPY scripts/ /home/bmi/scripts/
COPY setup.py /home/bmi/setup.py

# Install
USER root
WORKDIR /home/bmi
RUN python setup.py develop

# Create DB
USER bmi
RUN bmi db ls

# Start dependencies when container starts
CMD dumb-init /home/bmi/runbmi.sh
47 changes: 47 additions & 0 deletions Dockerfile_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This File is to create the image for BMI environment.
# It will install all dependencies and create the required folder structure
# The CI Tool will just create a new image based of this and run tests

# Using ubuntu as base
FROM ubuntu

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this file used anywhere.

@chemistry-sourabh chemistry-sourabh May 23, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knikolla This is the file is used to build the docker image that is pulled in the yaml file. I'll add a comment on top saying the same.


# Install all dependencies except dnsmasq
RUN apt-get -y update && apt-get install -y tgt-rbd ceph-common python python-dev python-setuptools build-essential python-pip sudo sqlite3 git

# Install test stuff
RUN pip install dumb-init pytest pytest-random-order coverage==4.3 pytest-cov coveralls

# Create user and remove password for root
RUN useradd -ms /bin/bash bmi
RUN passwd -d bmi
RUN passwd -d root
RUN usermod -aG sudo bmi

# Create required folders
RUN mkdir /etc/bmi/
RUN mkdir /var/log/bmi/
RUN mkdir /var/lib/tftpboot/
RUN mkdir /var/lib/tftpboot/pxelinux.cfg/
RUN mkdir /var/lib/bmi/

# Add config file
COPY docker/bmi_config.cfg /etc/bmi/bmiconfig.cfg
ENV BMI_CONFIG=/etc/bmi/bmiconfig.cfg

# Set Permissions
RUN chown bmi:bmi /etc/tgt/conf.d/
RUN chown bmi:bmi /var/log/bmi/
RUN chown bmi:bmi /var/lib/tftpboot/
RUN chown bmi:bmi /var/lib/tftpboot/pxelinux.cfg/
RUN chown bmi:bmi /var/lib/bmi/

# Add the BMI execute script
COPY docker/runbmi.sh /home/bmi/runbmi.sh
RUN chmod a+x /home/bmi/runbmi.sh

# Set Environment variables
ENV HAAS_USERNAME=admin
ENV HAAS_PASSWORD=admin

# Expose as volume to get keyring and ceph config
VOLUME /etc/ceph
58 changes: 58 additions & 0 deletions Dockerfile_env_centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This File is to create the image for BMI environment.
# It will install all dependencies and create the required folder structure
# The CI Tool will just create a new image based of this and run tests

# Using ubuntu as base
FROM centos

# Install all dependencies except dnsmasq
RUN yum install -y epel-release
RUN rpm --import 'https://download.ceph.com/keys/release.asc'
COPY docker/yum.repo /etc/yum.repos.d/ceph.repo
RUN yum -y update && yum install -y ceph-common-0.94.9 librbd1-devel-0.94.9 librados2-devel-0.94.9 python python-setuptools python-pip sudo sqlite cpan perl-Config-General libxslt-devel git make gcc

# Install test stuff
RUN pip install dumb-init pytest pytest-random-order coverage==4.3 pytest-cov coveralls

RUN git clone https://github.com/fujita/tgt
WORKDIR tgt/
RUN git reset --hard 3c8c9e96b82d87a334b1d340fa29218b7b94f26d
RUN sudo make CEPH_RBD=1 clean
RUN sudo make CEPH_RBD=1
RUN sudo make CEPH_RBD=1 install

WORKDIR ../
# Create user and remove password for root
RUN useradd -ms /bin/bash bmi
RUN passwd -d bmi
RUN passwd -d root
RUN usermod -aG wheel bmi

# Create required folders
RUN mkdir /etc/bmi/
RUN mkdir /var/log/bmi/
RUN mkdir /var/lib/tftpboot/
RUN mkdir /var/lib/tftpboot/pxelinux.cfg/
RUN mkdir /var/lib/bmi/

# Add config file
COPY docker/bmi_config.cfg /etc/bmi/bmiconfig.cfg
ENV BMI_CONFIG=/etc/bmi/bmiconfig.cfg

# Set Permissions
RUN chown bmi:bmi /etc/tgt/conf.d/
RUN chown bmi:bmi /var/log/bmi/
RUN chown bmi:bmi /var/lib/tftpboot/
RUN chown bmi:bmi /var/lib/tftpboot/pxelinux.cfg/
RUN chown bmi:bmi /var/lib/bmi/

# Add the BMI execute script
COPY docker/runbmi.sh /home/bmi/runbmi.sh
RUN chmod a+x /home/bmi/runbmi.sh

# Set Environment variables
ENV HAAS_USERNAME=admin
ENV HAAS_PASSWORD=admin

# Expose as volume to get keyring and ceph config
VOLUME /etc/ceph
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/CCI-MOC/ims.svg?branch=dev)](https://travis-ci.org/CCI-MOC/ims)
[![Coverage Status](https://coveralls.io/repos/github/CCI-MOC/ims/badge.svg?branch=dev)](https://coveralls.io/github/CCI-MOC/ims?branch=dev)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, you need to separate the coverage part out as it is not part of BMI CI. You may be running CI to get coverage report but that wasn't explicitly mentioned in issue. So the steps would be to

  • Update the existing issue to reflect this.
  • Create 2 commits - One for BMI CI , one for coverage part.

# BMI

The Bare Metal Imaging (BMI) is a core component of the Massachusetts Open Cloud and an Image Management System(IMS) that
Expand Down
23 changes: 23 additions & 0 deletions docker/yum.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[ceph]
name=Ceph packages for $basearch
baseurl=https://download.ceph.com/rpm-hammer/el7/$basearch
enabled=1
priority=2
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc

[ceph-noarch]
name=Ceph noarch packages
baseurl=https://download.ceph.com/rpm-hammer/el7/noarch
enabled=1
priority=2
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc

[ceph-source]
name=Ceph source packages
baseurl=https://download.ceph.com/rpm-hammer/el7/SRPMS
enabled=0
priority=2
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc