Skip to main content

Jenkins [DSP2017 #06]


In this entry I want to introduce tool which should be used in each projects. It covers how to install and configure a simple job.


First of all I started from installation of jenkins in my local machine (Ubuntu). You can download installation package from official page or use jenkins wiki. As like always I met some problem:
 The following packages have unmet dependencies:
 jenkins : Depends: daemon but it is not installed


As a resolving of it I used command apt-get -f install and next apt-get upgrade.

Then we should be able see the page like below on address http://localhost:8080





After unlock and installation some pluggins we should be able to see something like below.






Next I added simple job which will check the repository and run command gradle -p nany-server test. The result is on an image below.

I think that few of us met with lost jobs definitions. What then? We need to define each job manually again. From my point of view the better option is to keep configurations of job as a file on version control. I think that one option can be Jenkins job DSL.


So lets do the same think with DSL. Our current job just check-out code and run command gradle -p nany-server test. The same job can be defined by script like here:






job('DSP-Nany') {
  scm {
    git {
      remote {
      github('SebJak/nanny_dsp')
      credentials('github_sjak')
      }
    }
  }

  triggers {
   scm('H/15 * * * *')
  }
  steps {
   gradle{
     useWrapper(false)
     gradleName('Gradle 3.5')
     tasks('test')
     switches('-p nany-server')}
   }
 }

We can put this code in our repository like here and define a job where this script file will be taken and run for define DSP-Nany job.

After run a defined job probably your receive error:



 
Processing DSL script dspNanyDSL.groovy
ERROR: script not yet approved for use
Finished: FAILURE

The solution of it is to approve the script in Manage Jenkins -> In-process Script Approval. Next build should work and the result should be a new job named DSP-Nany.



Thanks for reading :)

Comments

Popular posts from this blog

Types of tests [DSP2017 #04]

As a java developer with more than 3 years of experience I had opportunity of participating in few projects. To be honest only in a last one a testing strategy is on high level.  I encourage you for introduce and put more pressure on testing strategy during a delivery process. As with all new things the beginnings are difficult but I'm sure that it is worth. As almost testers know undermentioned pyramid I need to put it for people who have not seen it. In a big amount of projects we can meet this pyramid in inverted order. What can impact of quality of a system. For example when we have a lot of manual tests it is boring for users and sometimes they can be skipped what can missed bug. So in the lowest level we see the Unit tests and the count of this should be the bigger and on the highest level, there are manual tests. As we can expect the count should of them should be the lowest. A few words about each of them: Unit tests - should be quick and small. They check jus...

Nany - opis projektu [DSP2017 #03]

" Nany " Wymagania: Użytkownik może podłączyć/odłączyć się do detektora wysyłającego powiadomienia. Użytkownik musi zostać poinformowany o dochodzącym dźwięku z pokoju dziecka. Powiadomienia powinny zostać wysłane do wszystkich zarejestrowanych urządzeń. Użytkownik musi zareagować na powiadomienie. Schemat:   Pierwszy etap prac (13.03.2017): [Telefon*] Prosta aplikacja android umożliwiająca odbieranie powiadomień. [Detektor*] Obsługa detekcji dźwięku. *Telefon - urządzenie z systemem android. *Detektor - Raspberry Pi B  wraz z mikrofonem.

Do odważnych świat należy [DSP2017 #01]

Witam wszystkich uczestników ;) Od jakiegoś czasu chodziło mi po głowie założenie bloga niestety nie miałem do tego wystarczającej motywacji. Wtedy wpadł mi w ręce artykuł zachęcający do wzięcia udziału w DSP 2017. Myślę, że jest to fantastyczna okazja na powstanie (od dawna planowanego) projektu oraz spróbowania własnych sił w tworzeniu bloga :) Projekt "Nany" Celem projektu jest stworzenie aplikacji zbierającej dźwięk z pokoju dziecka. W momencie wykrycia dźwięku system powinien informować rodziców o zaistniałej sytuacji. Projekt prowadzony będzie w metodologii Agile, a o wszystkich rezultatach oraz zmianach będę informował na blogu. Technologie: Python – aplikacja do zbierania dźwięku i wysyłania sygnału do serwera, Java – implementacja serwera aplikacji.