This repository contains X-Road lxd harmonized test automation environment installations used in conjunction with X-Road.
- ansible
Ansible scripts for environment setup
- harmonized-test-environment
Shell scripts for environment setup
- server-config
Configuration files for the servers
- jenkins_config
Test environment jenkins configuration files
- pipelines
Jenkins pipelines used in LXD, stage and product
- plugins
Jenkins plugins
- vars
Groovy vars for jenkins pipelines
Guide for installing the harmonized test environment
- Get the latest Ubuntu 16.04 LTS image: http://releases.ubuntu.com/16.04/ or Lubuntu 16.04 LTS image: https://lubuntu.net/downloads/
- Note! Virtualbox installation needs 10gb of ram, 30gb of hard disk space, 2 cores and 3d acceleration with 128 video memory
- Note! Lubuntu might work better in slower environments
- Note! Recommend install default admin user as "jenkins"
- Ubuntu
- Remove lock from settings > brightness & lock > lock off and turn screen off when inactive for to never.
- Lubuntu
- Remove lock from power management settings
- Install ibus and remove check from ibus advanced settings options.
- Check keyboard layout is set to use ibus
- Create jenkins user if it does not exist
usermod -aG sudo jenkins
- Add jenkins user to sudoers file
sudo sh -c 'echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
- Change user to jenkins
- Add git and keys ( use jenkins user)
sudo su jenkins
sudo apt-get -y install git
mkdir -p /home/jenkins/github
mkdir -p /home/jenkins/.ssh
- Clone repositories under Github folder
cd /home/jenkins/github
git clone https://github.com/nordic-institute/X-Road.git
git clone https://github.com/nordic-institute/X-Road-tests-environment.git
Shell script to install Ansible and LXD.
cd /home/jenkins/github/X-Road-tests-environment/harmonized-test-environment
sudo chmod u+x install_pre_setup.sh
./install_pre_setup.sh
Accept LXD init with all default values
-
Ansible playbook install tools:
- SOAP mockserver
- SOAP UI
- SSH server
- Pycharm
- Webserver
- QAutomate
- Jenkins
- Other libraries and modules
-
Run installation scripts
cd /home/jenkins/github/X-Road/ansible sudo ansible-playbook -i /home/jenkins/github/X-Road-tests-environment/ansible/hosts/xroad_hosts.txt xroad_init.yml cd /home/jenkins/github/X-Road-tests-environment/ansible sudo ansible-playbook -i hosts/xroad_hosts.txt xroad_automation.yml
In case of failure retry.
# Copy or create ssh key
# e.g https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
ssh-keygen -t rsa -b 4096 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
sudo chmod 400 /home/jenkins/.ssh/id_rsa
Restart cmd
# When asked give yes and password which is secret
ssh-copy-id -i .ssh/id_rsa.pub [email protected]
# When asked give yes and password which is secret
ssh-copy-id -i .ssh/id_rsa.pub [email protected]
# When asked give yes and password which is secret
ssh-copy-id -i .ssh/id_rsa.pub [email protected]
# When asked give yes and password which is secret
ssh-copy-id -i .ssh/id_rsa.pub [email protected]
cd /home/jenkins/.config
sudo chown -R jenkins:jenkins lxc
Restart linux for changes to take effect
- Open jenkins on localhost:8080
- Upload softreset and other configuration files to LXD containers by running jenkins job environment-job-upload-lxd-confs
- Run regression or environment jobs from jenkins
- Jobs descriptions can be found in jenkins_config README
There are three ways of resetting X-Road servers.
sudo ansible-playbook -i hosts/xroad_hosts.txt xroad_automation.yml
lxc exec xroad-lxd-cs ./softreset.sh
lxc exec xroad-lxd-ss0 ./softreset.sh
lxc exec xroad-lxd-ss1 ./softreset.sh
lxc exec xroad-lxd-ss2 ./softreset.sh
LXD jenkins configuration jobs are maintained with ansible playbook scripts
-
Reload jenkins config from SCM git:
- Option 1 Update all jenkins jobs ( updating and new jobs )
cd /home/jenkins/github/X-Road-tests-environment/ansible sudo ansible-playbook -i hosts/xroad_hosts.txt xroad_jenkins_pull.yml
- Option 2 Fetch all jenkins configs, plugins and jobs (removing old jobs)
cd /home/jenkins/github/X-Road-tests-environment/ansible sudo ansible-playbook -i hosts/xroad_hosts.txt xroad_jenkins_pull.yml -e "clean_install=true"