Commit ae0974e1 authored by Jean-Francois Rey's avatar Jean-Francois Rey
Browse files

add CI/CD

update README
parent eb809571
- build
- stock
- deploy
- "virtualbox"
- "ansible"
- "vagrant"
stage: build
- vboxmanage controlvm MacOSCR4 poweroff || true
- vboxmanage unregistervm --delete MacOSCR4 || true
- vagrant box update
#- vagrant up > vagrantup.log
- vagrant up
- vagrant snapshot save bootR4
- vagrant halt
- vagrantup.log
- "virtualbox"
- "ansible"
- "vagrant"
stage: stock
when: manual
- time vagrant package --base MacOSCR4 --output
- time s3cmd --access_key=$EC2_ACCESS_KEY --secret_key=$EC2_SECRET_KEY --host=$S3_HOST --host-bucket="%(bucket)s.$S3_HOST" --region="inra-tls" -v put s3://gaev-stock/
- rm || true
- "virtualbox"
- "ansible"
- "vagrant"
stage: deploy
when: manual
- vboxmanage controlvm MACOSCR4 poweroff || true
- vboxmanage unregistervm --delete MACOSCR4 || true
- vboxmanage modifyvm MacOSCR4 --name MACOSCR4
- sudo vboxmanage unregistervm MACOSCR4 || true
- sudo vboxmanage registervm "/home/gitlab-runner/VirtualBox VMs/MACOSCR4/MACOSCR4.vbox"
# MacOs, R environment and GitLab CI/CD # MacOS, R environment, as GitLab CI/CD
## If you want to develop and test your R packages, build R packages binaries under/for MacOS automatically, this is the right place.
> __This project is only for developpement and testing. For other use you must have Apple equipment.__
> Create a VirtualBox under MacOS Catalina 10.15 with R (>= 4.0.0) and Rtools + some dependencies. And register it as a GitLab-Runner.
## Dependencies
A bare metal or a virtual machine (with nested virtualization on the hypervisor activated) as a server with dependencies installed. Apple equipement.
### Systems
* VirtualBox (>= 6.1.14)
* Vagrant (>= 2.2.10)
* Ansible (>=
* sshpass (1.06)
* GitLab-Runner (>= 10.0.0)
### GitLab Runner
Use GitLab-Runner to register a _shell_ runner. _gitlab-runner_ user have to get access to _vboxmanage_, _vagrant_ and _ansible_.
To register the virtualbox runner create here, called _MACOSCR4_.
gitlab-runner register \
--non-interactive \
--name MACOSCR4
--url <Gitlab_URL> \
--registration-token <registration-token> \
--executor "virtualbox" \
--tag-list MacOS,R4 \
--ssh-user vagrant \
--ssh-password vagrant \
--virtualbox-base-name "MACOSCR4" \
--virtualbox-disable-snapshots = false \
--virtualbox-base-snapshot = "bootR4"
To use this runner, add in your .gitlab-ci.yml jobs:
- MacOS
- R4
## Principle
Every things happen in the [.gitlab-ci.xml](.gitlab-ci.xml) file.
Mainly the [VagrantFile](VagrantFile) set up a virtual machine from Vagrant Cloud [GAEV/MacOS\_Catalina]( box.
Files in [provisioning/](provisioning/) are playbooks for Ansible that will install/configure R, Rtools [](, packages and dependencies, MacTeX, Xquartz and GitLab-Runner.
After the virtual machine creation and configuration, it registered as a new gitlab-runner (by replacing the existing virtualbox machine "MACOSCR4").
## Locally
To set up the VM (called _MacOSCR4_) locally (on your computer), you just need to run :
vagrant up
vagrant snapshot bootR4
vagrant halt
## Customization
* To add R packages : edit file [ansible\_provisioning/files/](ansible\_provisioning/files/ and add systems libraries and R packages to install.
* Make artifacts work on your GitLab instance : edit file [ansible\_provisioning/files/](ansible\_provisioning/files/ and change the gitlab URL and IP.
* Custom VirtualBox : edit file [VagrantFile](VagrantFile) and modify parameters in virtualbox provider.
apt-get install sshpass
...@@ -14,7 +14,7 @@ Vagrant.configure("2") do |config| ...@@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb| config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine # Display the VirtualBox GUI when booting the machine
vb.gui = true vb.gui = true = "MacOS_C_R4" = "MacOSCR4"
vb.customize ["modifyvm", :id, "--memory", 4096] vb.customize ["modifyvm", :id, "--memory", 4096]
vb.customize ["modifyvm", :id, "--cpus", 4] vb.customize ["modifyvm", :id, "--cpus", 4]
vb.customize ["modifyvm", :id, "--vram", 128] vb.customize ["modifyvm", :id, "--vram", 128]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment