Using the Latest Version of a Gradle Dependency

If you configure a dependency in Gradle without specifying a version, the build fails with an error saying the dependency cannot be found. But when you have a lot of dependencies, you also have to trawl the repository one by one to see what the latest version of each library is.

So does Gradle support using the latest version of a dependency directly?

The answer is yes, though gradle’s documentation doesn’t flag it in any prominent place.

The trick is to put a plus sign + in the version field, and gradle will work out the latest version automatically and download it.

Once everything is pointed at the latest version, you can then work through the few remaining dependency-conflict errors from the log, which saves a great deal of effort.

Read more
Distinguishing the three different levels of dependencies in Gradle

Gradle is a very flexible and powerful build system, but its concepts are relatively complex. As long as you grasp the core and keep the distinctions straight, it will not feel confusing.

Does the build script below look hard to understand?

buildscript {
    repository for build script dependencies
    repositories {
        mavenCentral()
    }
    // build script dependencies
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
    }
}
repositories {
    mavenCentral()
    jcenter()
    google()
}
dependencies {
    implementation 'com.google.guava:guava:30.1-jre'
    testImplementation 'junit:junit:4.13.2'
}  
plugins {
      id 'com.android.application'
      id 'org.jetbrains.kotlin.jvm' version '1.5.10'
}

Read more
Should Creating a Pipeline Be Called Setting Up, Configuring, or Developing?

In the field of software development and continuous integration/delivery, Jenkins is a very popular tool for automating build, test and deployment processes. A Jenkins pipeline is a powerful mechanism that can automate the entire software delivery process by defining a series of stages, steps and conditions. However, when describing the process of creating a pipeline, which word should we use to describe it: setting up, configuring, or developing?

Read more
Jenkins Release Types and How to Choose One

Introduction to Jenkins

Jenkins is a popular open-source continuous integration and delivery tool. It provides an extensible plugin ecosystem and can be used to automate the building, testing and deployment of software projects.

Jenkins releases

Jenkins releases fall into the following types:

  1. LTS release: a Long-Term Support (LTS) release, published once every 12 weeks. These releases are extensively tested and validated and come with long-term support, and they are usually used in production environments. The LTS release cycle is relatively long, so LTS releases are comparatively stable and reliable.

Read more
Jenkinsclient Tutorial Series: Viewing Basic Information (Part 2)

Once Jenkinsclient is configured, you can operate Jenkins through commands.

The command format of jenkinsclient is:

jenkins GROUP | COMMAND

GROUP refers to a group of commands. For example, job is a group command, and it provides the following commands:

jenkins job build   //build a job
jenkins job copy    //copy a job
jenkins job create  //create a job
jenkins job delete  //delete a job
jenkins job disable //disable a job
jenkins job enable  //enable a job
jenkins job has     //check whether a job already exists
jenkins job info    //show job information
jenkins job ls      //show the job list
jenkins job rename  //rename a job
jenkins job xml     //show the contents of a job's config.xml

Today we’ll skip group commands for now and start with the top-level COMMANDs. These commands are mostly used to view various kinds of information.

1. Easter Egg — APP Mode

APP mode lets you operate Jenkins in a standalone window. It feels just like using an app.

Command:

jenkins app

Video demo:

Read more
Jenkinsclient Tutorial Series: Introduction and Installation (Part 1)

Introduction to jenkinsclient

Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client. It provides a Docker-style command line for users to operate Jenkins.

Jenkinsclient is written in Python, and the project source code is open-sourced under China’s Mulan Open Source License. You can view it on Gitee and Github.

Gitee: https://gitee.com/hummerstudio/jenkinsclient

Github: https://github.com/hummerstudio/jenkinsclient

Project homepage: https://pypi.org/project/jenkinsclient

Read more
The Automation Revolution and DevOps

Automation is a revolutionary concept and technology.

First-Generation Automation

The first generation of automation is the automation of the heaven-and-earth system: the growth of all things.

Heaven supplies energy as yang, earth takes form as yin; the ancient sages observed this and put it to use. Following the four seasons and adapting to local conditions is what is called wu wei (non-action). Wu wei is not inaction — it is acting in accordance with nature.

The automation of this generation has three elements: heaven, earth and man.

Weather reflects the intensity and total amount of the solar energy supplied. The changes of weather divide broadly into the four seasons and finely into the twenty-four solar terms. Terrain differs from place to place, so one adapts to local conditions; and people must sow, water, fertilize and feed at the right time and in the right place, as if playing in concert with heaven and earth — hence human harmony.

Although heaven and earth are already automated, from the human point of view it still takes the right action at the right moment for all things to grow as humans intend.

Read more
Jenkinsclient 1.0 Released: A Powerful Open-Source, Cross-Platform Jenkins CLI Client Under the Mulan Open Source License

Introducing Jenkinsclient

Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client that supports multiple instances. The project is open-sourced under the Mulan open source license.

Version 1.0 was officially released a few days ago.

PyPI project page: https://pypi.org/project/jenkinsclient/

Read more
Jenkins Plugin Update Center address changer — switch to a domestic mirror with one click

The Jenkins Plugin Center domestic mirror

The 1500+ plugins Jenkins offers are its most valuable resource and its defining feature; they give Jenkins powerful functionality, flexibility, and the ability to connect and interact with other platforms.

Recently, however, users in China have clearly felt that Jenkins downloads plugins very slowly, and that downloads often time out and fail. This problem has caused a great deal of trouble for users in China.

This is mainly because the network infrastructure servers of the Jenkins open source community are all located abroad.

In November 2019, the Jenkins Chinese community released a domestic mirror address.

This mirror solved the problem that other mirrors had always had — that they could not really be used — so that users in China can now download plugins at the full speed their bandwidth allows.

Read more
Jenkins Containerized Deployment: How to Persist JENKINS_HOME

Symptom

In the Docker Preferences options, “Enabel Kubernetes” is selected to enable Kubernetes, but it stays in the starting state and cannot be used normally.

Cause

To enable the Kubernetes feature, Docker needs to pull the Kubernetes-related images from an image registry.

Because access to Docker Hub is too slow from within China, the images cannot be pulled successfully, which leaves Kubernetes stuck in the starting state.

Read more
How to Use the Jenkins Declarative Pipeline

Jenkins gives you two ways to develop your pipeline code: scripted and declarative.

The scripted pipeline (also known as the “traditional” pipeline) is based on Groovy as its domain-specific language. The declarative pipeline, on the other hand, offers a simplified and friendlier syntax, with dedicated statements for defining it and no need to learn Groovy.

Version 2.5 of the Jenkins Pipeline plugin introduced support for the declarative pipeline.

In this article, we will go over all the available directives for developing declarative pipeline scripts, which will make its capabilities clear.

Read more
Jenkins FAQ Collection (Part 7)

Question 31: I have several nodes with the same environment and want jobs to be automatically assigned to idle nodes. Is that possible?

Reference: You only need to configure the same label on these nodes that share the same environment, and have the job specify that label as its run node; Jenkins will then automatically pick an idle node to execute the job. A label in Jenkins carries the sense of a category or group, just like the label feature in WeChat’s contacts. It is simply not designed very conspicuously, so if you don’t know about it, it’s easy to mistake it for a unique ID.

Question 32: How does Jenkins work with the various static analysis tools?

Read more
Jenkins FAQ Collection (Part 4)

Question 16: Can a timeout be set with Pipeline code?

Reference: Yes. The following code sets a timeout of 1 hour, and it can be set either globally for the pipeline or at the stage level:

options {
  timeout(time: 1, unit: 'HOURS')
}

Question 17: Is there a plugin that can monitor changes to the Jenkins configuration?

Read more
Jenkins FAQ Roundup (Part 3)

Question 11: How do I trigger other Jenkins jobs from a Pipeline script?

Answer: There is a build step you can look into; it supports both synchronous and asynchronous triggering.

Question 12: Is there a convenient way to see the list of currently installed plugins and their versions on Jenkins? You can see them under Manage Plugins - Installed, but copying them out brings extra information that is hard to handle. For example, the extra plugin descriptions mean that after pasting into a spreadsheet you still have to delete them one by one manually.

Read more
Jenkins FAQ Roundup (Part 2)

Question 6: What is the relationship between Blue Ocean and Jenkins?

Answer: Put simply, Blue Ocean can be seen as a new UI that Jenkins introduced, with a more modern look and better interaction.

Of course, the most important thing is its support for the new pipeline job type introduced in Jenkins 2.x, which can clearly show the serial/parallel relationships and statuses of the various stages in the whole Pipeline.

Read more
Jenkins FAQ Collection (Part 1)

Question 1: How do Jenkins and Docker work together?

Reference: You can combine Jenkins with Docker by using containers as Jenkins agent nodes, which has many advantages. For example, it unifies the execution environment, creates and destroys agents automatically, and removes the cost of maintaining environments by hand.

Question 2: When writing a pipeline with two stages, the first of which is assigned to a random machine to run on, and the second of which has to run on the same machine as the first, is there any way to do that?

Read more
Should Creating a Pipeline Be Called Setting Up, Configuring, or Developing?

In the field of software development and continuous integration/delivery, Jenkins is a very popular tool for automating build, test and deployment processes. A Jenkins pipeline is a powerful mechanism that can automate the entire software delivery process by defining a series of stages, steps and conditions. However, when describing the process of creating a pipeline, which word should we use to describe it: setting up, configuring, or developing?

Read more
Jenkins Release Types and How to Choose One

Introduction to Jenkins

Jenkins is a popular open-source continuous integration and delivery tool. It provides an extensible plugin ecosystem and can be used to automate the building, testing and deployment of software projects.

Jenkins releases

Jenkins releases fall into the following types:

  1. LTS release: a Long-Term Support (LTS) release, published once every 12 weeks. These releases are extensively tested and validated and come with long-term support, and they are usually used in production environments. The LTS release cycle is relatively long, so LTS releases are comparatively stable and reliable.

Read more
Jenkinsclient 1.0 Released: A Powerful Open-Source, Cross-Platform Jenkins CLI Client Under the Mulan Open Source License

Introducing Jenkinsclient

Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client that supports multiple instances. The project is open-sourced under the Mulan open source license.

Version 1.0 was officially released a few days ago.

PyPI project page: https://pypi.org/project/jenkinsclient/

Read more
Jenkins Plugin Update Center address changer — switch to a domestic mirror with one click

The Jenkins Plugin Center domestic mirror

The 1500+ plugins Jenkins offers are its most valuable resource and its defining feature; they give Jenkins powerful functionality, flexibility, and the ability to connect and interact with other platforms.

Recently, however, users in China have clearly felt that Jenkins downloads plugins very slowly, and that downloads often time out and fail. This problem has caused a great deal of trouble for users in China.

This is mainly because the network infrastructure servers of the Jenkins open source community are all located abroad.

In November 2019, the Jenkins Chinese community released a domestic mirror address.

This mirror solved the problem that other mirrors had always had — that they could not really be used — so that users in China can now download plugins at the full speed their bandwidth allows.

Read more
Jenkins Containerized Deployment: How to Persist JENKINS_HOME

Symptom

In the Docker Preferences options, “Enabel Kubernetes” is selected to enable Kubernetes, but it stays in the starting state and cannot be used normally.

Cause

To enable the Kubernetes feature, Docker needs to pull the Kubernetes-related images from an image registry.

Because access to Docker Hub is too slow from within China, the images cannot be pulled successfully, which leaves Kubernetes stuck in the starting state.

Read more
Jenkins FAQ Collection (Part 7)

Question 31: I have several nodes with the same environment and want jobs to be automatically assigned to idle nodes. Is that possible?

Reference: You only need to configure the same label on these nodes that share the same environment, and have the job specify that label as its run node; Jenkins will then automatically pick an idle node to execute the job. A label in Jenkins carries the sense of a category or group, just like the label feature in WeChat’s contacts. It is simply not designed very conspicuously, so if you don’t know about it, it’s easy to mistake it for a unique ID.

Question 32: How does Jenkins work with the various static analysis tools?

Read more
Jenkins FAQ Collection (Part 4)

Question 16: Can a timeout be set with Pipeline code?

Reference: Yes. The following code sets a timeout of 1 hour, and it can be set either globally for the pipeline or at the stage level:

options {
  timeout(time: 1, unit: 'HOURS')
}

Question 17: Is there a plugin that can monitor changes to the Jenkins configuration?

Read more
Jenkins FAQ Roundup (Part 3)

Question 11: How do I trigger other Jenkins jobs from a Pipeline script?

Answer: There is a build step you can look into; it supports both synchronous and asynchronous triggering.

Question 12: Is there a convenient way to see the list of currently installed plugins and their versions on Jenkins? You can see them under Manage Plugins - Installed, but copying them out brings extra information that is hard to handle. For example, the extra plugin descriptions mean that after pasting into a spreadsheet you still have to delete them one by one manually.

Read more
Jenkins FAQ Roundup (Part 2)

Question 6: What is the relationship between Blue Ocean and Jenkins?

Answer: Put simply, Blue Ocean can be seen as a new UI that Jenkins introduced, with a more modern look and better interaction.

Of course, the most important thing is its support for the new pipeline job type introduced in Jenkins 2.x, which can clearly show the serial/parallel relationships and statuses of the various stages in the whole Pipeline.

Read more
Jenkins FAQ Collection (Part 1)

Question 1: How do Jenkins and Docker work together?

Reference: You can combine Jenkins with Docker by using containers as Jenkins agent nodes, which has many advantages. For example, it unifies the execution environment, creates and destroys agents automatically, and removes the cost of maintaining environments by hand.

Question 2: When writing a pipeline with two stages, the first of which is assigned to a random machine to run on, and the second of which has to run on the same machine as the first, is there any way to do that?

Read more
Using the Latest Version of a Gradle Dependency

If you configure a dependency in Gradle without specifying a version, the build fails with an error saying the dependency cannot be found. But when you have a lot of dependencies, you also have to trawl the repository one by one to see what the latest version of each library is.

So does Gradle support using the latest version of a dependency directly?

The answer is yes, though gradle’s documentation doesn’t flag it in any prominent place.

The trick is to put a plus sign + in the version field, and gradle will work out the latest version automatically and download it.

Once everything is pointed at the latest version, you can then work through the few remaining dependency-conflict errors from the log, which saves a great deal of effort.

Read more
Distinguishing the three different levels of dependencies in Gradle

Gradle is a very flexible and powerful build system, but its concepts are relatively complex. As long as you grasp the core and keep the distinctions straight, it will not feel confusing.

Does the build script below look hard to understand?

buildscript {
    repository for build script dependencies
    repositories {
        mavenCentral()
    }
    // build script dependencies
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
    }
}
repositories {
    mavenCentral()
    jcenter()
    google()
}
dependencies {
    implementation 'com.google.guava:guava:30.1-jre'
    testImplementation 'junit:junit:4.13.2'
}  
plugins {
      id 'com.android.application'
      id 'org.jetbrains.kotlin.jvm' version '1.5.10'
}

Read more
Jenkinsclient Tutorial Series: Viewing Basic Information (Part 2)

Once Jenkinsclient is configured, you can operate Jenkins through commands.

The command format of jenkinsclient is:

jenkins GROUP | COMMAND

GROUP refers to a group of commands. For example, job is a group command, and it provides the following commands:

jenkins job build   //build a job
jenkins job copy    //copy a job
jenkins job create  //create a job
jenkins job delete  //delete a job
jenkins job disable //disable a job
jenkins job enable  //enable a job
jenkins job has     //check whether a job already exists
jenkins job info    //show job information
jenkins job ls      //show the job list
jenkins job rename  //rename a job
jenkins job xml     //show the contents of a job's config.xml

Today we’ll skip group commands for now and start with the top-level COMMANDs. These commands are mostly used to view various kinds of information.

1. Easter Egg — APP Mode

APP mode lets you operate Jenkins in a standalone window. It feels just like using an app.

Command:

jenkins app

Video demo:

Read more
Jenkinsclient Tutorial Series: Introduction and Installation (Part 1)

Introduction to jenkinsclient

Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client. It provides a Docker-style command line for users to operate Jenkins.

Jenkinsclient is written in Python, and the project source code is open-sourced under China’s Mulan Open Source License. You can view it on Gitee and Github.

Gitee: https://gitee.com/hummerstudio/jenkinsclient

Github: https://github.com/hummerstudio/jenkinsclient

Project homepage: https://pypi.org/project/jenkinsclient

Read more
Jenkinsclient 1.0 Released: A Powerful Open-Source, Cross-Platform Jenkins CLI Client Under the Mulan Open Source License

Introducing Jenkinsclient

Jenkinsclient is a powerful, open-source, cross-platform Jenkins command-line client that supports multiple instances. The project is open-sourced under the Mulan open source license.

Version 1.0 was officially released a few days ago.

PyPI project page: https://pypi.org/project/jenkinsclient/

Read more
The Automation Revolution and DevOps

Automation is a revolutionary concept and technology.

First-Generation Automation

The first generation of automation is the automation of the heaven-and-earth system: the growth of all things.

Heaven supplies energy as yang, earth takes form as yin; the ancient sages observed this and put it to use. Following the four seasons and adapting to local conditions is what is called wu wei (non-action). Wu wei is not inaction — it is acting in accordance with nature.

The automation of this generation has three elements: heaven, earth and man.

Weather reflects the intensity and total amount of the solar energy supplied. The changes of weather divide broadly into the four seasons and finely into the twenty-four solar terms. Terrain differs from place to place, so one adapts to local conditions; and people must sow, water, fertilize and feed at the right time and in the right place, as if playing in concert with heaven and earth — hence human harmony.

Although heaven and earth are already automated, from the human point of view it still takes the right action at the right moment for all things to grow as humans intend.

Read more
The Automation Revolution and DevOps

Automation is a revolutionary concept and technology.

First-Generation Automation

The first generation of automation is the automation of the heaven-and-earth system: the growth of all things.

Heaven supplies energy as yang, earth takes form as yin; the ancient sages observed this and put it to use. Following the four seasons and adapting to local conditions is what is called wu wei (non-action). Wu wei is not inaction — it is acting in accordance with nature.

The automation of this generation has three elements: heaven, earth and man.

Weather reflects the intensity and total amount of the solar energy supplied. The changes of weather divide broadly into the four seasons and finely into the twenty-four solar terms. Terrain differs from place to place, so one adapts to local conditions; and people must sow, water, fertilize and feed at the right time and in the right place, as if playing in concert with heaven and earth — hence human harmony.

Although heaven and earth are already automated, from the human point of view it still takes the right action at the right moment for all things to grow as humans intend.

Read more
Jenkins Plugin Update Center address changer — switch to a domestic mirror with one click

The Jenkins Plugin Center domestic mirror

The 1500+ plugins Jenkins offers are its most valuable resource and its defining feature; they give Jenkins powerful functionality, flexibility, and the ability to connect and interact with other platforms.

Recently, however, users in China have clearly felt that Jenkins downloads plugins very slowly, and that downloads often time out and fail. This problem has caused a great deal of trouble for users in China.

This is mainly because the network infrastructure servers of the Jenkins open source community are all located abroad.

In November 2019, the Jenkins Chinese community released a domestic mirror address.

This mirror solved the problem that other mirrors had always had — that they could not really be used — so that users in China can now download plugins at the full speed their bandwidth allows.

Read more
Jenkins Containerized Deployment: How to Persist JENKINS_HOME

Symptom

In the Docker Preferences options, “Enabel Kubernetes” is selected to enable Kubernetes, but it stays in the starting state and cannot be used normally.

Cause

To enable the Kubernetes feature, Docker needs to pull the Kubernetes-related images from an image registry.

Because access to Docker Hub is too slow from within China, the images cannot be pulled successfully, which leaves Kubernetes stuck in the starting state.

Read more
 English edition of the Jenkins China community site.