Skip to content

Commit

Permalink
Merge branch 'development' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
mvousden committed Jul 28, 2016
2 parents 0a52f25 + 261ed1a commit 6009593
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 45 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@

## Container targets
full-container:
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=full playbook=provision_virtualmicromagnetics_full.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=full playbook=provision_virtualmicromagnetics_full.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/ container_push=false"

lite-container:
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=lite playbook=provision_virtualmicromagnetics_lite.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=lite playbook=provision_virtualmicromagnetics_lite.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/ container_push=false"

oommf-container:
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=oommf playbook=provision_virtualmicromagnetics_oommf.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=oommf playbook=provision_virtualmicromagnetics_oommf.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/ container_push=false"

magpar-container:
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=magpar playbook=provision_virtualmicromagnetics_magpar.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=magpar playbook=provision_virtualmicromagnetics_magpar.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/ container_push=false"

nmag-container:
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=nmag playbook=provision_virtualmicromagnetics_nmag.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=nmag playbook=provision_virtualmicromagnetics_nmag.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/ container_push=false"

fidimag-container:
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=fidimag playbook=provision_virtualmicromagnetics_fidimag.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/"
ansible-playbook master.yml -c local -i localhost, -v -k --extra-vars="type=container container_name=fidimag playbook=provision_virtualmicromagnetics_fidimag.yml hookbook=hook_container.yml extra_resources_dir=guest_resources/ container_push=false"

## VM targets
full-vm: full
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
# built documents.
#
# The short X.Y version.
version = u'1.0.4'
version = u'1.1.0'
# The full version, including alpha/beta/rc tags.
release = u'1.0.4'
release = u'1.1.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _dev-notes:

Developer Notes (valid for version 1.0.4)
Developer Notes (valid for version 1.1.0)
=========================================

In :ref:`getting-started-poweruser`, we created a virtual environment from
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started-user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Your user will need to be in the docker group on the machine you are running on
[#]_. After restarting your machine, command the following in an empty
directory::

docker run -ti virtualmicromagnetics/full:release /bin/bash
docker run -ti virtualmicromagnetics/lite:1.1.0 /bin/bash -l

This command will download the Full Virtual Micromagnetics container image from
the Internet to your computer, and start bash in your shell.
Expand All @@ -58,5 +58,5 @@ besides the Full Virtual Micromagnetics environment.

.. [#] Note that the docker group is root-equivalent, so you will likely need
to own the machine to use Virtual Micromagnetics containers. To avoid this,
consider using a different provider that does not require root priveleges,
consider using a different provider that does not require root privileges,
but beware, as Docker is the only container provider supported at present.
81 changes: 53 additions & 28 deletions jobs/hook_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,75 @@
name={{ artefact_dir }}
state=directory

- name: Obtain the current tag, (or version if untagged) of this repository.
shell: |
TAG=$(git name-rev --tags --name-only HEAD | cut -f1 -d^)
if [ "$(echo $TAG | tr -d [:space:])" == "undefined" ]; then
git rev-parse --short HEAD
else
echo $TAG
fi
- name: Obtain current tag of this repository, if any.
shell: git name-rev --tags --name-only HEAD | cut -f1 -d^
args:
chdir: "{{ container_dir }}"
executable: /bin/bash
register: current_version
register: tag

- name: Set artefact name.
- name: Obtain current version hash of this repository.
shell: git rev-parse --short HEAD
args:
chdir: "{{ container_dir }}"
executable: /bin/bash
register: version

# Alternatively, we can obtain the branch in detached-head state using the
# environment variable GIT_BRANCH if it is set. This helps out Jenkins.
- name: Obtain current branch of this repository.
shell: if [ -z "$GIT_BRANCH" ]; then git symbolic-ref HEAD | grep -o [^/]*$; else echo "$GIT_BRANCH" | grep -o [^/][a-zA-Z0-9-]*$; fi
args:
chdir: "{{ container_dir }}"
executable: /bin/bash
register: branch

# Exporting container filesystem as tarball.

- name: Set artefact name with tag, if we could find one.
set_fact:
artefact_name: "{{ container_name }}_{{ tag.stdout }}.tar"
when: tag.stdout != "undefined"

- name: Set artefact name with version hash, if we could not find a tag.
set_fact:
artefact_name: "{{ container_name }}_{{ current_version.stdout }}.tar"
artefact_name: "{{ container_name }}_{{ version.stdout }}.tar"
when: tag.stdout == "undefined"

- name: Export the container filesystem as an artefact.
command: docker export --output={{ artefact_dir }}{{ artefact_name }} {{ container_name }}
args:
creates: "{{ artefact_dir }}{{ artefact_name }}"

- name: Obtain the current tag (or branch if untagged) of this repository.
shell: |
TAG=$(git name-rev --tags --name-only HEAD | cut -f1 -d^)
if [ "$(echo $TAG | tr -d [:space:])" == "undefined" ]; then
git describe --all | grep -o [^/]*$
else
echo $TAG
fi
args:
chdir: "{{ container_dir }}"
executable: /bin/bash
register: current_branch
# Storing container with tag=branch.

- name: Define the name used for the output Docker image using the branch.
set_fact:
output_image_name_branch: virtualmicromagnetics/{{ container_name }}:{{ branch.stdout }}

- name: Define the name used for the output Docker image
- name: Create a Docker image from our provisioned container.
command: docker commit {{ container_name }} {{ output_image_name_branch }}

- name: Push the Docker image with tag equal to branch.
command: docker push {{ output_image_name_branch }}
when: container_push

# Storing container with tag=tag.

- name: Define the name used for the output Docker image using the tag.
set_fact:
output_image_name: virtualmicromagnetics/{{ container_name }}:{{ current_branch.stdout }}
output_image_name_tag: virtualmicromagnetics/{{ container_name }}:{{ tag.stdout }}
when: tag.stdout != "undefined"

- name: Create a Docker image from our provisioned container.
command: docker commit {{ container_name }} {{ output_image_name }}
command: docker commit {{ container_name }} {{ output_image_name_tag }}
when: tag.stdout != "undefined"

- name: Push the Docker image with tag equal to tag.
command: docker push {{ output_image_name_tag }}
when: (container_push == "true") and (tag.stdout != "undefined")

- name: Push the Docker image.
command: docker push {{ output_image_name }}
# Remove the evidence.

- name: Destroy the container.
command: vagrant destroy --force
Expand Down
5 changes: 4 additions & 1 deletion jobs/hook_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@
when: (not vagrantfile.stat.exists) and (not box_status.stat.exists or (box_status.stat.isreg and clobber_output))

- name: Extract the virtual machine disk (VMDK) file from the box.
command: tar -xvf {{ output_box }} -C {{ artefact_dir }} ./box-disk1.vmdk
command: tar -xzvf {{ output_box }} -C {{ artefact_dir }} ./box-disk1.vmdk
chdir={{ artefact_dir }}
creates={{ artefact_dir }}/box-disk1.vmdk
when: not zip_status.stat.exists or (zip_status.stat.isreg and clobber_output)
register: result
until: result.rc == 0
retries: 3

- name: Convert the virtual machine disk (VMDK) to a virtual hard disk (VHD).
command: VBoxManage clonehd --format VHD box-disk1.vmdk {{ output_name }}.vhd
Expand Down
2 changes: 0 additions & 2 deletions jobs/provision_virtualmicromagnetics_fidimag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
- { role: rst_to_html, SOURCE_PATH: "/vagrant/extra_resources/welcome/welcome_{{ name }}.rst" }
- fidimag
- fidimag_examples
- xserver
- add_super_user
- { role: xserver, when: type == "vm" }
- { role: add_super_user, when: type == "vm" }
- { role: copy_skeleton, TYPE: type }
Expand Down
2 changes: 1 addition & 1 deletion roles/create_container/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
executable: /bin/bash

- name: Start the container. Vagrant may attempt to install VirtualBox Guest Additions here.
shell: vagrant up --no-provision > {{ container_name }}.log
shell: vagrant up --no-provision --provider docker > {{ container_name }}.log
chdir={{ container_dir }}

- name: Provision the container. A log exists in machines/.
Expand Down
7 changes: 5 additions & 2 deletions roles/fidimag/tasks/make_fidimag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
# SUNDIALS.

# Install local dependencies.
- name: Install FFTW and SUNDIALS from the Fidimag installation script.
command: bash ubuntu_install_script.sh
- name: Install FFTW and SUNDIALS from Fidimag installation scripts.
command: bash {{ item }}
args:
chdir: "{{ FIDIMAG_INSTALL_PATH }}/bin"
with_items:
- install-fftw.sh
- install-sundials-2.5.sh
sudo: yes

# Build Fidimag. Makefile module?
Expand Down

0 comments on commit 6009593

Please sign in to comment.