Juana  Wunsch

Juana Wunsch

1590656160

Jenkins Configuration as Code : step towards stateless CI

enkins is one of the best Continuous Integration Server out there in the market with over 1000 plugins. Back in the days, creating a Jenkins job is as easy as navigating through some pages selecting the type of job, source code management tool, build tool etc. but, as time progressed, we entered an era of “Things-as-Code” or “Things-as-Config” started gaining popularity. Provisioning “Things-as-Code” or “Things-as Config” has its own benefits like Zero-touch provisioning, Version controlling your configurations, creating consistent systems etc. In this article we will take a look at the Jenkins Configuration as Code Plugin.

#devops #ci #docker #jenkins

What is GEEK

Buddha Community

Jenkins Configuration as Code : step towards stateless CI
Juana  Wunsch

Juana Wunsch

1590656160

Jenkins Configuration as Code : step towards stateless CI

enkins is one of the best Continuous Integration Server out there in the market with over 1000 plugins. Back in the days, creating a Jenkins job is as easy as navigating through some pages selecting the type of job, source code management tool, build tool etc. but, as time progressed, we entered an era of “Things-as-Code” or “Things-as-Config” started gaining popularity. Provisioning “Things-as-Code” or “Things-as Config” has its own benefits like Zero-touch provisioning, Version controlling your configurations, creating consistent systems etc. In this article we will take a look at the Jenkins Configuration as Code Plugin.

#devops #ci #docker #jenkins

Jenkins Configuration as Code : step towards stateless CI - CodeBabel

Jenkins is one of the best Continuous Integration Server out there in the market with over 1000 plugins. Back in the days, creating a Jenkins job is as easy as navigating through some pages selecting the type of job, source code management tool, build tool etc. but, as time progressed, we entered an era of “Things-as-Code” or “Things-as-Config” started gaining popularity. Provisioning “Things-as-Code” or “Things-as Config” has its own benefits like Zero-touch provisioning, Version controlling your configurations, creating consistent systems etc. In this article we will take a look at the Jenkins Configuration as Code Plugin.

Jenkins came up with its version of “Jenkins-pipeline-as-code” with the release of version 2.0. The pipeline as code enabled us to configure entire job flow right in our IDE, also opened up a lot of features that would have otherwise been almost impossible or tedious to implement using freestyle jobs. One example could be designing a job spanning over multiple nodes which feels like a breeze using pipeline jobs but is an upstream-downstream hell(pardon my language) using freestyle jobs. Backing up our job is as easy as adding our Jenkinsfile to source control. As pipeline as code eased up the management work on Jenkins jobs, Docker made setting up the Jenkins infrastructure very easy. However, a manual touch is always needed in the Jenkins global configuration.

Here are a few things we will touch upon in this article:

A typical Jenkins setup flow

Here is a simple flow of steps involved in setting up a Jenkins instance:

Jenkins Setup Flow

Jenkins Setup Flow

In simple words, most of the configurations(if not all) that goes under “Manage Jenkins” requires manual setup, some of these configurations include,

  • Setting up security
  • Configuring LDAP settings
  • Setting up tool installations eg: GIT, ANT, Sonar etc.
  • Any custom global settings for plugins installed eg: kubernetes plugin

Is Jenkins config as code really possible?

Now, let’s try to answer the most important question in context to this article. As previously discussed, Jenkins pipeline as code and Docker to some extent help us take a step closer to a “stateless” Jenkins server. Even most of the administrative tasks mentioned above can be automated using initscripts. However, it requires a deeper understanding of Jenkins plugins and expertise in groovy.

Configuration as code is not a new concept in Jenkins, it’s just not as easy to achieve and once achieved, maintain.

‘Jenkins Configuration as Code’ plugin hands-on

Let’s look at the high-level functioning of the Jenkins Config as Code Plugin using a simple example.

#continuous integration #devops #ci #configascode #docker #jenkins

Tyrique  Littel

Tyrique Littel

1604008800

Static Code Analysis: What It Is? How to Use It?

Static code analysis refers to the technique of approximating the runtime behavior of a program. In other words, it is the process of predicting the output of a program without actually executing it.

Lately, however, the term “Static Code Analysis” is more commonly used to refer to one of the applications of this technique rather than the technique itself — program comprehension — understanding the program and detecting issues in it (anything from syntax errors to type mismatches, performance hogs likely bugs, security loopholes, etc.). This is the usage we’d be referring to throughout this post.

“The refinement of techniques for the prompt discovery of error serves as well as any other as a hallmark of what we mean by science.”

  • J. Robert Oppenheimer

Outline

We cover a lot of ground in this post. The aim is to build an understanding of static code analysis and to equip you with the basic theory, and the right tools so that you can write analyzers on your own.

We start our journey with laying down the essential parts of the pipeline which a compiler follows to understand what a piece of code does. We learn where to tap points in this pipeline to plug in our analyzers and extract meaningful information. In the latter half, we get our feet wet, and write four such static analyzers, completely from scratch, in Python.

Note that although the ideas here are discussed in light of Python, static code analyzers across all programming languages are carved out along similar lines. We chose Python because of the availability of an easy to use ast module, and wide adoption of the language itself.

How does it all work?

Before a computer can finally “understand” and execute a piece of code, it goes through a series of complicated transformations:

static analysis workflow

As you can see in the diagram (go ahead, zoom it!), the static analyzers feed on the output of these stages. To be able to better understand the static analysis techniques, let’s look at each of these steps in some more detail:

Scanning

The first thing that a compiler does when trying to understand a piece of code is to break it down into smaller chunks, also known as tokens. Tokens are akin to what words are in a language.

A token might consist of either a single character, like (, or literals (like integers, strings, e.g., 7Bob, etc.), or reserved keywords of that language (e.g, def in Python). Characters which do not contribute towards the semantics of a program, like trailing whitespace, comments, etc. are often discarded by the scanner.

Python provides the tokenize module in its standard library to let you play around with tokens:

Python

1

import io

2

import tokenize

3

4

code = b"color = input('Enter your favourite color: ')"

5

6

for token in tokenize.tokenize(io.BytesIO(code).readline):

7

    print(token)

Python

1

TokenInfo(type=62 (ENCODING),  string='utf-8')

2

TokenInfo(type=1  (NAME),      string='color')

3

TokenInfo(type=54 (OP),        string='=')

4

TokenInfo(type=1  (NAME),      string='input')

5

TokenInfo(type=54 (OP),        string='(')

6

TokenInfo(type=3  (STRING),    string="'Enter your favourite color: '")

7

TokenInfo(type=54 (OP),        string=')')

8

TokenInfo(type=4  (NEWLINE),   string='')

9

TokenInfo(type=0  (ENDMARKER), string='')

(Note that for the sake of readability, I’ve omitted a few columns from the result above — metadata like starting index, ending index, a copy of the line on which a token occurs, etc.)

#code quality #code review #static analysis #static code analysis #code analysis #static analysis tools #code review tips #static code analyzer #static code analysis tool #static analyzer

Jenkins Is Getting Old — It’s Time to Move On

By far, Jenkins is the most adopted tool for continuous integration, owning nearly 50% of the market share. As so many developers are using it, it has excellent community support, like no other Jenkins alternative. With that, it has more than 1,500 plugins available for continuous integration and delivery purposes.

We love and respect Jenkins. After all, it’s the first tool we encountered at the beginning of our automation careers. But as things are rapidly changing in the automation field, Jenkins is** left behind with his old approach**. Even though many developers and companies are using it, most of them aren’t happy with it. Having used it ourselves on previous projects, we quickly became frustrated by its lack of functionality, numerous maintenance issues, dependencies, and scaling problems.

We decided to investigate if other developers face the same problems and quickly saw the need to create a tool ourselves. We asked some developers at last year’s AWS Summit in Berlin about this. Most of them told us that they chose Jenkins because it’s free in the first place. However, many of them expressed interest in trying to use some other Jenkins alternative.

#devops #continuous integration #jenkins #devops adoption #jenkins ci #jenkins pipeline #devops continuous integration #jenkins automation #jenkins scripts #old technology

Alycia  Klein

Alycia Klein

1598619600

Travis CI vs Jenkins: Which CI/CD Tool Is Right For You?

As a DevOps professional, you need to evaluate these tools based on your budget, project requirements, and other data points. This is why we take a deep dive into  Travis CI vs Jenkinscomparison to help you decide the right CI/CD tool for your project requirements.

If you are new to DevOps and are just learning the basics then I recommend you to read this detailed article on  Continuous Integration And Continuous Delivery. Without further ado, let’s get started.

What Is Jenkins?

Jenkins is a popular open-source CI/CD tool that is in usage for a long time. The tool is written entirely in Java. Jenkins has a powerful set of features that can be used to build, test, and integrate changes in a project.

jenkins

It is the go-to choice for startups as it is free to use, supports a wide range of plugins, and is backed by a vibrant community. Developers get the chance to set up a CI/CD environment in Jenkins. Jenkins is available for a wide range of platforms – Windows, macOS, and various flavors of Unix (i.e. Ubuntu, OpenSUSE, and more).

Another major of Jenkins is its extensibility with plugins. Like other open-source projects, Jenkins maintains two release lines – weekly and LTS (Long Term Support). At the time of this article, the latest version of Jenkins (LTS) was 2.235.1.

Salient features of Jenkins

  • Open source and free for use.
  • Extensive plugin ecosystem.
  • Vibrant community.
  • Supports parallel execution.
  • Ease to set up.
  • Offers REST API.
  • Can be configured using Jenkinsfile.

#devops #continous delivery #jenkins ci #ci cd #travis ci #continous deployment #jenkins architecture