Nort Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
=Overview=
=Overview=


nort (Nova Ordis Release Tools) is a tool implementing logic that enforces a specific way of performing software releases. In this respect, it is opinionated. It enforces its opinions by driving various resources and tools (Maven, GitHub, artifact repositories, target systems upon the publicly-consumable artifacts are deployed, etc.) to interact in specific ways. nort is driven by a very simple set of top-level commands: "release", "build", "install" and "deploy", which trigger [[#Sequences|sequence of operations]] described below. Those sequences of operations involve relatively complex - and distributed - interactions. In most cases, you will only need to use "release". This article describes concepts that are useful if you want to understand how nort works.
nort (Nova Ordis Release Tools) is a tool implementing logic that enforces a specific way of performing software releases. In this respect, it is opinionated. It enforces its opinions by driving various resources and tools (Maven, GitHub, artifact repositories, target systems upon the publicly-consumable artifacts are deployed, etc.) to interact in specific ways. nort is driven by a very simple set of top-level commands: "release", "build", "publish" and "install", which trigger [[#Sequences|sequence of operations]] described below. Those sequences of operations involve relatively complex - and distributed - interactions. In most cases, you will only need to use "release". This article describes concepts that are useful if you want to understand how nort works.


=Dot Version=
=Dot Version=
Line 33: Line 33:
</blockquote>
</blockquote>


A version becomes a [[#Dot_Version|dot version]] during the [[#Release|release process]]. However, a dot version never lasts in a work area for more than a brief time interval. The dot version is used to build the corresponding artifacts (sources and binaries), which are then installed in their corresponding repositories, as part of the release process, and possibly even deployed "in production" - in places where they are used. If all goes well, the current version is  immediately upgraded to the next logical SNAPSHOT. If something goes wrong, the current version remains set to the SNAPSHOT that failed to become a dot version, until the developer fixes the problem and repeats, successfully, the release process.
A version becomes a [[#Dot_Version|dot version]] during the [[#Release|release process]]. However, a dot version never lasts in a work area for more than a brief time interval. The dot version is used to build the corresponding artifacts (sources and binaries), which are then published in their corresponding repositories, as part of the release process, and possibly even deployed "in production" - in places where they are used. If all goes well, the current version is  immediately upgraded to the next logical SNAPSHOT. If something goes wrong, the current version remains set to the SNAPSHOT that failed to become a dot version, until the developer fixes the problem and repeats, successfully, the release process.


=Release=
=Release=
Line 57: Line 57:
==The Release Sequence==
==The Release Sequence==


The "release" sequence is potentially the most complex. The full release sequence involves release [[#The_Qualification_Sequence|qualification]] (testing), project metadata updates, a [[#The_Build_Sequence|build sequence]], an [[#The_Install_Sequence|install sequence]] and a [[#The_Deploy_Sequence|deploy sequence]]. The user can instruct nort to end the process at a certain intermediate point, or start it from an intermediate point. For example, an already installed artifact can be deployed in production by triggering a deploy sequence.
The "release" sequence is the most complex, and all-encompassing. The full release sequence involves release [[#The_Qualification_Sequence|qualification]] (testing), project metadata updates, a [[#The_Build_Sequence|build sequence]], an [[#The_Publish_Sequence|publish sequence]] and a [[#The_Installation_Sequence|installation sequence]]. The user can instruct nort to end the process at a certain intermediate point, or start it from an intermediate point. For example, an already published artifact can be installed (or deployed) in production by triggering an install sequence.


==The Qualification Sequence==
==The Qualification Sequence==
Line 80: Line 80:
# If the build fails, report and fail. The work area is guaranteed to be left in the exact state it was found before the release sequence was initiated.  
# If the build fails, report and fail. The work area is guaranteed to be left in the exact state it was found before the release sequence was initiated.  
# Place the artifacts in a staging directory in the work area (usually the target directory).
# Place the artifacts in a staging directory in the work area (usually the target directory).
# Pass the control to the next sequence, which is usually the [[#The_Install_Sequence|install sequence]] or exit if there is no follow up sequence.
# Pass the control to the next sequence, which is usually the [[#The_Publish_Sequence|publish sequence]] or exit if there is no follow up sequence.


==The Install Sequence==
==The Publish Sequence==


The install sequence takes the artifacts built by the [[#The_Build_Sequence|build sequence]] and installs them in their appropriate repositories. The terminology comes from Maven "install" and means installing artifacts into the local repository. In most cases, nort will indeed install the artifacts into the local Maven repository, but other options are also available.
The publish sequence takes the artifacts built by the [[#The_Build_Sequence|build sequence]] and publishes them in their appropriate repositories. The operation is similar to Maven's "install" phase, and in most cases, nort will indeed copy the artifacts into the local Maven repository. However, other options are also available.


The install sequence is usually triggered as part of the [[#The_Release_Sequence|release sequence]], following the [[#The_Build_Sequence|build sequence]]. It can also be initiated on its own. <font color=red>TODO: more details here</font>.
The publish sequence is usually triggered as part of the [[#The_Release_Sequence|release sequence]], following the [[#The_Build_Sequence|build sequence]]. It can also be initiated on its own. <font color=red>TODO: more details here</font>.


The install sequence consists in the following steps:
The publish sequence consists in the following steps:
# Move the artifacts from the work staging area to the corresponding artifact repositories. Usually, JARs are installed under their corresponding artifact directories and binary releases are installed under their corresponding "release" modules, both in the local Maven repository. For more details about artifacts and what repositories are they installed into, see "[[#Release_Artifacts|Release Artifacts]]" section.
# Move the artifacts from the work staging area to the corresponding artifact repositories. Usually, JARs are installed under their corresponding artifact directories and binary releases are installed under their corresponding "release" modules, both in the local Maven repository. For more details about artifacts and what repositories are they installed into, see "[[#Release_Artifacts|Release Artifacts]]" section.


==The Deploy Sequence==
==The Installation Sequence==


The deploy sequence takes the corresponding artifacts from the artifact repository and deploys them wherever they are supposed to be used. As an example, a command line utility can be deployed on a local system under the /usr/local directory, or in an Amazon EC2 environment. A web application packaged as an EAR can be deployed on the production web site, and so on.
The installation sequence takes the corresponding artifacts from the artifact repository and installs (or deploys) them wherever they are supposed to be used. As an example, a command line utility can be installed on a local system under the /usr/local directory, or in an Amazon EC2 environment. A web application packaged as an EAR can be deployed on the production web site, and so on.


==The Completion Sequence==
==The Completion Sequence==
Line 113: Line 113:
If a project has a binary distribution that is built as Maven assembly, nort will install it in the local Maven repository, under the "release" project module.
If a project has a binary distribution that is built as Maven assembly, nort will install it in the local Maven repository, under the "release" project module.


Binary distributions may be built using a mechanism other than Maven - simply zipping files is perfectly valid - but irrespective to how the artifact is built, the [[#The_Install_Sequence|install sequence]] ends with "installing" them them in some form of binary repository.
Binary distributions may be built using a mechanism other than Maven - simply zipping files is a perfectly valid way of doing it - but irrespective to how the artifact is built, the [[#The_Publish_Sequence|publish sequence]] ends with "publishing" them them in some form of binary repository.


=New Project Initialization=
=New Project Initialization=

Revision as of 18:52, 18 November 2016

Internal

Overview

nort (Nova Ordis Release Tools) is a tool implementing logic that enforces a specific way of performing software releases. In this respect, it is opinionated. It enforces its opinions by driving various resources and tools (Maven, GitHub, artifact repositories, target systems upon the publicly-consumable artifacts are deployed, etc.) to interact in specific ways. nort is driven by a very simple set of top-level commands: "release", "build", "publish" and "install", which trigger sequence of operations described below. Those sequences of operations involve relatively complex - and distributed - interactions. In most cases, you will only need to use "release". This article describes concepts that are useful if you want to understand how nort works.

Dot Version

A dot version is a label that marks a specific point in time in the evolution of a software project. It contains major, minor and patch components: "1.2.3". It does not contain a "SNAPSHOT" fragment. A dot version associated with an artifact indicates that the artifact was built based on source code that passed all the tests and it is ready for public consumption. The copy of the source tree of a project under active development in a work area is never associated with a dot version, as the project is "open for changes". For more details about this convention, see "Current Version" section.

The Major Component of a Version Label

The Minor Component of a Version Label

The Patch Component of a Version Label

Snapshot Version

A snapshot version is a label that marks a specific point in time in the evolution of a software project, and it primarily indicates that, at that time, the functionality provided by the project is not ready for public consumption. In other words, it says that source code tree used to build the artifact from was under development at the time the build was performed. The "SNAPSHOT" level designates a snapshot version. Example: "1.2.3-SNAPSHOT-5".

A snapshot-versioned artifact should never be used outside the development process. Snapshot-versioned artifacts may be routinely released, but they must only be used when dependent projects under development, themselves labeled with a snapshot version, require new functionality or defect fixes from their dependencies. In that situation, the dependency releases a snapshot release, the dependent updates its metadata to point to the newly released dependency snapshot release, and its development continues. When the dependent is ready for a dot release, first the dependencies are "dot released" and then the dependent is "dot released". nort provides logic to do the underlying bookkeeping and automate these workflows.

The Snapshot Component of a Version Label

Current Version

The current version is the version designating the code base in the work area of a project. For Maven-built projects, it is the <version> information written into the POM file present in the work area.


Under the conventions enforced by nort, the current version is always a snapshot version, as projects are continuously evolving and they are in principle open for new functionality and defect fixes.

A version becomes a dot version during the release process. However, a dot version never lasts in a work area for more than a brief time interval. The dot version is used to build the corresponding artifacts (sources and binaries), which are then published in their corresponding repositories, as part of the release process, and possibly even deployed "in production" - in places where they are used. If all goes well, the current version is immediately upgraded to the next logical SNAPSHOT. If something goes wrong, the current version remains set to the SNAPSHOT that failed to become a dot version, until the developer fixes the problem and repeats, successfully, the release process.

Release

A release consists in a sequence of operations - interactions with the local project work area, the build system metadata, and various external source code and binary repositories - which end with the generation of a set of release artifacts. Depending of the release type and the options used when the release was triggered, the set of released artifacts are different, and end up in different places. For more details, see the "sequences" section.

Release Types

Major

Minor

Patch

Snapshot

Custom

For syntax details see the release command.

Sequences

The Release Sequence

The "release" sequence is the most complex, and all-encompassing. The full release sequence involves release qualification (testing), project metadata updates, a build sequence, an publish sequence and a installation sequence. The user can instruct nort to end the process at a certain intermediate point, or start it from an intermediate point. For example, an already published artifact can be installed (or deployed) in production by triggering an install sequence.

The Qualification Sequence

During the qualification sequence, nort performs any metadata changes required by the version being released and insures the code base is ready for release.

The qualification sequence consists in the following steps:

  1. Make sure the current version is a snapshot version. The release fails if it encounters a dot version in the work area.
  2. If the release we're building corresponds to a dot version (release type is major, minor or patch), increment the project version metadata, so we can perform the qualification with the correct version. If we're performing a snapshot release, the correct version is already in place.
  3. Execute all tests.
  4. If at least one test fails, report and fail. The work area is guaranteed to be left in the exact state it was found before the release sequence was initiated.
  5. If the tests pass, pass the control to the next sequence, which is usually the build sequence, or exit if there are no follow up sequence. This would be unusual.

The Build Sequence

The build sequence insures that the project artifacts corresponding to the version being released are built, and placed in a conventional staging section of the work area. For Maven-built projects, that is the ./target directory.

The build sequence is usually triggered as part of the release sequence. It can also be initiated on its own. TODO: more details here.

The build sequence consists in the following steps:

  1. Build the artifacts (with or without running the tests, depending on whether the sequence before already ran them).
  2. If the build fails, report and fail. The work area is guaranteed to be left in the exact state it was found before the release sequence was initiated.
  3. Place the artifacts in a staging directory in the work area (usually the target directory).
  4. Pass the control to the next sequence, which is usually the publish sequence or exit if there is no follow up sequence.

The Publish Sequence

The publish sequence takes the artifacts built by the build sequence and publishes them in their appropriate repositories. The operation is similar to Maven's "install" phase, and in most cases, nort will indeed copy the artifacts into the local Maven repository. However, other options are also available.

The publish sequence is usually triggered as part of the release sequence, following the build sequence. It can also be initiated on its own. TODO: more details here.

The publish sequence consists in the following steps:

  1. Move the artifacts from the work staging area to the corresponding artifact repositories. Usually, JARs are installed under their corresponding artifact directories and binary releases are installed under their corresponding "release" modules, both in the local Maven repository. For more details about artifacts and what repositories are they installed into, see "Release Artifacts" section.

The Installation Sequence

The installation sequence takes the corresponding artifacts from the artifact repository and installs (or deploys) them wherever they are supposed to be used. As an example, a command line utility can be installed on a local system under the /usr/local directory, or in an Amazon EC2 environment. A web application packaged as an EAR can be deployed on the production web site, and so on.

The Completion Sequence

The local workarea version metadata is tentatively incremented according to the rules described in the "Release Types" section.

Release Artifacts

A release may produce several kinds of artifacts.

JAR Libraries

Binary Distributions

Binary distributions are usually ZIP file containing everything an application needs in order to be installed on a new system. The binary distribution include libraries, wrapper scripts, release notes, documentation and possibly other files.

The recommended technique to build complex binary distributions is to add a dedicated "release" module to the project and let the Maven assembly plug-in to handle the process. The details are described in the "Building a Maven Complex Release Artifact" article.

If a project has a binary distribution that is built as Maven assembly, nort will install it in the local Maven repository, under the "release" project module.

Binary distributions may be built using a mechanism other than Maven - simply zipping files is a perfectly valid way of doing it - but irrespective to how the artifact is built, the publish sequence ends with "publishing" them them in some form of binary repository.

New Project Initialization

The command that carries out a new project initialization is nort initialize.

TODO: