Skip to content

Instantly share code, notes, and snippets.

View arnlaugsson's full-sized avatar
🐢
Slowly but surely

Skúli Arnlaugsson arnlaugsson

🐢
Slowly but surely
View GitHub Profile

Keybase proof

I hereby claim:

  • I am arnlaugsson on github.
  • I am arnlaugsson (https://keybase.io/arnlaugsson) on keybase.
  • I have a public key whose fingerprint is 1253 29F7 115E 583D 8E8F A6CA F747 47FA 2669 6B99

To claim this, I am signing this object:

set nocompatible " be iMproved, required
filetype off " required
" Vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive' " Git (Gstatus and more)
Plugin 'git://git.wincent.com/command-t.git' " Auto complete
# Path to your oh-my-zsh installation.
export ZSH=/Users/skuli/.dotfiles
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
#ZSH_THEME="robbyrussell"

Pro tip: SSH án lykilorða

Til að flýta fyrir tengingum við Advania QStack vélina sem hópurinn ykkar fékk úthlutað, er hægt að nota SSH lykill ykkar til að spara ykkur sporin.

Upprifjun: https://help.github.com/articles/generating-ssh-keys/

*Nix (Linux og MacOS)

Í skel (Terminal), gert er ráð fyrir að þið hafið búið til SSH lykill og hafið ekki breytt nafninu á skránni:

  1. Farið í heimasvæði ykkar á vélinni ykkar: cd

Selenium tests on Travis

Note: This is not a guide to run selenium tests locally, for that there are lots of guides out there. To run Selenium tests on Travis CI, as a part of a CI lifecycle, a few things need to be done. First you must understand that Selenium utilises a browser, and browsers require a Desktop environment. Travis runs tests in an environment similar to your Advania QStack servers, which have no Desktop environment. This is where Xvfb comes in.

Xvfb creates a "virtual" Desktop environment, and before running an application that requires a Desktop environment, you can export a display (see below) so that when the application is started, it will be started in that virtual environment. Sounds simple, right?

For Selenium tests, that's it, Selenium will do the rest for you. So let's set this up!

Travis

Travis supports Xvfb and Firefox by default. One of the ways to do this (as done in https://github.com/arnlaugsson/chuck_joke/tree/with-selenium-xvf

set nocompatible " be iMproved, required
filetype off " required
" Vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive' " Git (Gstatus and more)
Plugin 'git://git.wincent.com/command-t.git' " Auto complete
[
{"model": "menu.ingredient", "pk": 1, "fields": {"name": "av\u00f3kad\u00f3", "vegan": true, "vegetarian": true}},
{"model": "menu.ingredient", "pk": 2, "fields": {"name": "basil", "vegan": true, "vegetarian": true}},
{"model": "menu.ingredient", "pk": 3, "fields": {"name": "eldpipar", "vegan": true, "vegetarian": true}},
{"model": "menu.ingredient", "pk": 4, "fields": {"name": "hnetus\u00f3sa", "vegan": true, "vegetarian": true}},
{"model": "menu.ingredient", "pk": 5, "fields": {"name": "jalapeno", "vegan": true, "vegetarian": true}},
{"model": "menu.ingredient", "pk": 6, "fields": {"name": "kj\u00faklingur", "vegan": false, "vegetarian": false}},
{"model": "menu.ingredient", "pk": 7, "fields": {"name": "mang\u00f3", "vegan": true, "vegetarian": true}},
{"model": "menu.ingredient", "pk": 8, "fields": {"name": "mozzarella", "vegan": false, "vegetarian": true}},
{"model": "menu.ingredient", "pk": 9, "fields": {"name": "parmaskinka", "vegan": false, "vegetarian": false}},

Install Oracle Java 8

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Install Gradle 3.1

This can be accomplished in many ways. One way would be to configure Job A to have a build step, that triggers Job B, and fetches variables in a document after Job B has finished. Then Job A can read those variables and use them in later steps.

There are several things to consider here though. First of all this requires Job B to finish before Job A can/should continue, so if you are thinking of parallel job execution this isn't ideal. Secondly, when dealing with env variables you will need a plugin to make variables available outside of the build step (exporting isn't enough), check out the EnvInject plugin. And thirdly, if job configuration is becoming complex, there probably is a better way of doing it. With Jenkinsfile and previously pipelining plugins, Job orchestration has improved a lot, and passing parameters around and such is much easier in this new, shiny world. That being said, here is an example of something that works like what you are asking about.

Job A

  1. As a build step, trigger Job B,