Jenkins Pipeline Blue Ocean Plugin

Jenkins Pipelines and the Blue Ocea...

With the big wave of DevOps, Pipelines are one of the most used words. Why? Because continuous integration and continuous delivery are about pipelines...

java 8 stream

Tip: Java 8 Streams flatmap map lis...

A little example, I had to develop as a teaching use case, of how to take a map with Integer keys and values with a List as value and find a specific ...

Qual o teu estilo?

Qual o teu estilo? ...

Jenkins Pipelines and the Blue Ocean plugin

With the big wave of DevOps, Pipelines are one of the most used words. Why? Because continuous integration and continuous delivery are about pipelines.

Jenkins is one of the most used components in a Continuous Integration environment, and its community decided to take into this wave too. How?

Well, redefining how the pipelines are configured and developed in Jenkins.

The new pipelines are developed using Groovy Language, which opens a very wide spectrum of possibilities of configurations to the integration process. (so… who said Groovy lang was dying?)

There are 2 ways of developing pipelines in Jenkins, the Declarative and the Scripted way

In the Scripted approach you use the full power of Groovy language, however, the blue ocean plugin will not be used as expected and you cant visualize the pipeline. More on this later.

node {
    stage('chekout from git') {
        checkout([$class: 'GitSCM', 
                branches: [[name: '*/master']], 
                doGenerateSubmoduleConfigurations: false, 
                extensions: [], 
                submoduleCfg: [], 
                userRemoteConfigs: [[]]
        try {
            sh 'mvn test'
        } catch (e) {
            currentBuild.result = 'FAILURE'
            throw e
        } finally {
            cleanWs cleanWhenFailure: false

    stage('build the project') {
        steps {
            sh 'mvn -B -DskipTests clean package'

But it’s the declarative way that draws the pipeline flow as we expected.

This approach brings first an elegant structure of the code and the use of the Blue Ocean plugin where we will visualize the pipeline flow, literally!

An example of a declarative pipeline can be something like this:

pipeline {
    agent none 
    stages {
        stage('chekout from git') {
            steps {
                checkout([$class: 'GitSCM', 
                    branches: [[name: '*/master']], 
                    doGenerateSubmoduleConfigurations: false, 
                    extensions: [], 
                    submoduleCfg: [], 
                    userRemoteConfigs: [[]]
        stage('build the project') {
            steps {
                sh 'mvn -B -DskipTests clean package'

If you install the Blue Ocean plugin and run a declarative pipeline you will see something like this:
(this example was taken from Jenkins website)

Jenkins Pipeline Blue Ocean Plugin

So, should I use Declarative or Scripted Pipelines?
– Scripted Pipelines use the full Groovy language, but you will not have the enhanced visualization.
– Well, declarative is a little more restricted in the structure of the code, but you can always use the step “script { }” to extended the use of Groovy. But you will use the Blue Ocean plugin, something that has its value in a workspace for instance.

The Jenkins website as a good tutorial to follow, please visit it to move forward in this technology.

Hope this post was enough to capture your attention about how Jenkins can have a really beautiful and useful visualization of a pipeline.

Fun – Obsolete Technology

Obsolete Technology

Tip: Java 8 Streams flatmap map lists

A little example, I had to develop as a teaching use case, of how to take a map with Integer keys and values with a List as value and find a specific value in any List in the whole map using Java Streams.

boolean b1 returns true because the element exists
boolean b2 is the response to an element that doesn’t exist

Qual o teu estilo?

Qual o teu estilo?

Different roles in meetings

it’s funny because it’s true

Deja vu?

Go Language, First Steps

Go, first experience.


We are living in a very rich IT ecosystem, where developers aren’t afraid to explore new languages, tools and to use out of the box thinking. It’s a great time to living in this IT era! Following this trend, and due to some need I had to start to learn
a new language, GO.

Go, also called golang, was developed at Google. The motivation was to have a language less complex than C++.

Go has great advantages, such as:

  • Concurrency system, far superior than Python, for instance.
  • Compiled language, which makes it faster
  • The executable is static linked, which allows to create an executable for the destination platform. It means, it doesn’t need an interpreter.
  • strongly handling exceptions
  • Low memory footprint
  • Very easy to learn
  • Docker is built in Go



Just visit the Golang web site
The binaries are here.

Baby steps

First things first: IDEs


I started with the “official” tutorial A Tour of Go

The big points:

  • Every Go program is made up of packages
  • Programs start running in package main
  • By convention, the package name is the same as the last element of the import path
  • In Go, a name is exported if it begins with a capital letter
  • In functions, the type comes after the variable name
  • When two or more consecutive named function parameters share a type, you can omit the type from all but the last
  • A function can return any number of results
  • Go’s return values may be named. Also called naked return
  • The var statement declares a list of variables (package or function level)
  • Inside a function, the := short assignment statement can be used in place of a var declaration with implicit type
  • The expression T(v) converts the value v to the type T (casting)
  • Constants are declared with the const keyword
  • loop: for – like c, java, c++ but without the parentesis
  • The while> in Go its the for. for {} = infine loop
  • if doesnt need the parentesis
  • the if> allows a statement before the condition: if v := math.Pow(x, n); condition {
  • switch doesnt have the “break”, it is implicit
  • switch without a condition is the same as switch true. Good for long sequence of “if”
  • A defer statement defers the execution of a function until the surrounding function returns. defer add(2,3) PS: call’s arguments are evaluated immediately
  • Go has pointers!
  • The type *T is a pointer to a T value. Its zero value is nil.
  • The &var operator generates a pointer to its operand.
  • Unlike C, Go has no pointer arithmetic.
  • A struct is a collection of fields “type Complex struct”
  • arrays: var a [10]int
  • slices: var s []int = primes[1:4] – A slice does not store any data, it just describes a section of an underlying array
  • A slice has both a length (number of elements it contains) and a capacity (the number of elements in the underlying array)
  • Slices of slices
  • A map maps keys to values: var m map[string]int
  • Go functions may be closures. return func(x int) int { return x }
  • Go does not have classes. However, you can define methods on types. func (v Vertex) Abs() float64 {}
  • An interface type is defined as a set of method signatures. type Abser interface {Abs() float64}
  • Interfaces are implemented implicitly
  • The empty interface – may hold values of any type
  • A type assertion provides access to an interface value’s underlying concrete value. t := i.(T)
  • ype switches switch v := i.(type) { case T:…
  • Go programs express error state with error values. type error interface {…
  • The io package specifies the io.Reader interface.
  • A goroutine is a lightweight thread managed by the Go runtime. go f(x, y, z)
  • Channels are a typed conduit through which you can send and receive values with the channel operator, <-.
  • Like maps and slices, channels must be created before use: ch :=make(chan int)
  • Channels can be buffered.
  • The select statement lets a goroutine wait on multiple communication operations.


In a first impression I would say its a very good language for scripting. No complications around object oriented concepts. Just got the best of native languages and modern languages. While reading some articles everyone has the same option, Go its very
suited for concurrent applications, since its very easy to use channels, select and goroutines.
For sure, a very good challenger to my usual preference on python

Spiritual IT–Words and Programs

spiritual_mindAt this end of year I would like to mix a little bit IT and some Christian teachings. It is not unusual, Donald Knuth on the book Things a Computer Scientist Rarely Talks About do an experience on the 3:16 versicle of the Bible.

Christian Bible talks about how God created the world using only His Words.

As humans, we use words too, of course, to talk, to transmit ideas and sometimes to change others behavior.

As IT People we develop programs with specific objectives that will run inside a computer.(or more)

If we create a metaphor and suppose we are like computers (in some way we are organic computers), we are somehow running code in our mind (in a different programming language in another paradigm). Code that can change itself or develop new code taking current statements. (Yes, this is possible now in several languages, like prolog, list, and even popular languages like C# where it is possible to “emit” code).

When we, as people, are talking to each other, we are “putting” code inside the other person, hoping it will change something inside him/her.

If she is a girl that we are trying to conquer, we create a program that will try to create a sense of good impression inside her, and try to hacker her in a way we touch the right place so she can start to be in love with us. There are books, tips, friends, all of it trying to teach us how to create a program like that.

A salesman tries to create programs to convince the others to accept his arguments, and buy his products. There are a lot of hacks about this, books, courses, seminars, etc., about hacking “persons” to force them to say yes!

Every day we are trying to hack the other person with our language.

Politicians are master hackers, with great programs, to hack several people at same time, with statements that can unify a group of people and push them to the same idea!

There are even NLP, the discipline that teaches to hack ourselves and hack the others! And, look to the name “Neuro-Linguistic Programming

You got the picture!

Moral of this

One of the most important things a person should be careful is the tongue in our mouth because it is the  keyboard that writes the program that will be inserted on the other person, and is capable of great and wonderful things and capable of really bad things, as we all know.

Every time you will be talking to someone, remember, you are inserting a program on the other person. Try to be constructive, something that brings value, and not something destructive, because there are people that have great security measures and knows how to defend from hacking, but others don’t, and this can be very destructive for their lives. Depressions, bad decisions, and others, very well know consequences of this.

Likewise, the tongue is a small part of the body, but it makes great boasts. Consider what a great forest is set on fire by a small spark.” James 3:5

Have a great new year!

dynamic and ExpandoObject

tree_volteretaThe dynamic and ExpandoObject have a relation of love and hate with .NET developers. One side defends strongly typed objects to handle data, so it’s possible to handle a lot of issues at compile time. The other side, are developers used to develop scripts, python, and in other similar languages. They defend the dynamic nature of the current projects, with a lot of Xml, Json and unstructured data, so they prefer to use the more dynamic and functional structures of C#. Both are right! Some like to live strong typed and predictable, others like to live on the edge!

Personally, I am a hybrid developer, I like the strong type of languages, but love python and dynamic freedom, like C# provides. So it’s usual for me to use strongly typed objects on my projects, but every time I have to deal with unstructured data, I use the dynamic word and other constructs like Tuple class.

Because sometimes there are too many DTOs on the project!

ExpandoObject Basic Usage

ExpandoObject with methods

Reflection on the ExpandoObject

Office Games – The Leverage

leverageOffice games is a thing in all jobs. All the time, intentionally or not, it is something being played. If you are in a game, and you don’t know the rules or even that you are playing it, you will loose it for sure.

The most important think in every office games it’s the leverage. Many people think its fairness, but it’s not. Life isn’t fair, maybe the “time” will make it fair in the long term, but for the job, most of the times it’s too late.

People aren’t on the job to be fair, they are for their personal reasons, money, success, satisfaction, recognition, power, etc. If you are an obstacle for them, they will defend their goals as they can, and usually not being fair.

The excellent Netflix series “House of Cards” is an example of managing “leverage”. There is a passage from Frank Underwood, the master of creating leverage when he is talking with the president:

“Do I think she oversteps sometimes? Yes. Does she wrongly equate her advice with mine? Often. But the question that occurs to me is not about Linda. Let’s say you refuse her resignation if this gets out, and it could, won’t you be sending a signal to anyone who works for you that you can be leveraged? “

So, learn the game, learn the rules, play it!

Here some tips to get leverage:

  • Have something the other person needs
  • Have more authority.
  • Try to have a positive attitude
  • Try to be “cold”. Don’t be too emotional.
  • Have skills hard to be replaced
  • Have a good reputation
  • Try to have something that only you can provide
  • Build a network of empathy and cooperative attitude with the others.

Yes, these are things we all know from working, but are we developing them as much as we are developing our hard skills?

One of the definitions of Leverage
“The ability to influence a system, or an environment, in a way that multiplies the outcome of one’s efforts without a corresponding increase in the consumption of resources.” (from the BusinessDictionary)

Bad Behavior has blocked 95 access attempts in the last 7 days.

Hyper Smash