10.3. Configuring Staging Profiles

The Nexus Staging Suite consists of two configurable parts: Staging Profiles and Staging Repositories. Staging Profiles define the rules by which artifact deployments are staged in Staging Repositories. Staging Repositories are created as they are needed and are the primary mechanism by which Nexus users can promote or discard the contents of a staging repository to a hosted repository.

10.3.1. Adding the Staging Deployer Role

To trigger a staged deployment, the deployment user needs to have the "Staging: Deployer (admin)" role or a "Staging: Deployer" role for a specific Staging Profile. When you create a Staging Profile, Nexus will create a new "Staging: Deployer" role for a specific Staging Profile. To configure the deployment user with this role, click on Users under the Security menu in the Nexus menu. Once you see the Users panel, click on the deployment user to edit this user's roles. If the Staging Suite is installed, you should see the "Staging: Deployer (admin)" role listed in Available Roles. Select the "Staging: Deployer (admin)" role and then click the left arrow to add this role to the deployment user's list of assigned roles.

Assigning the Staging Deployer Role to the deployment user

Figure 10.4. Assigning the Staging Deployer Role to the deployment user


Once the deployment user has the "Staging: Deployer (admin)" role, you can then use this user to deploy to the staging URL and trigger any Staging Profile. Without this permission, the deployment user would not be able to publish a staged artifact. If you need to add a specific permission to activate a single Staging Profile, you would select that specific role in the Available Roles list shown in Figure 10.4, “Assigning the Staging Deployer Role to the deployment user”. In this figure, note that there are two "Staging: Deployer" roles: one for general administrative permission to deploy to any staging profile, and another which targets a specific staging profile.

10.3.2. Configuring a Staging Target

The Staging Suite intercepts deployments to repository targets. For example, if you wanted to intercept all deployments to the com.sonatype.sample groupId, you would create a Repository Target call the "Sample Target" with a pattern expression of ".*/com/sonatype/sample/.*". Do this by clicking on "Repository Targets" in the left-hand navigation menu in Nexus and then clicking on the Add button.

Adding a Repository Target for com.sonatype.sample

Figure 10.5. Adding a Repository Target for com.sonatype.sample


10.3.3. Configuring Staging Profiles

Staging profiles control the process by which artifacts are selected for staging. When you define a Staging profile, you are defining a set of rules which will control the way in which Nexus intercepts an artifact deployment. When you click on Staging Profiles in the Nexus menu, you will see a list of configured staging profiles. Clicking on Add will create a new Staging Profile and display the form shown in Figure 10.6, “Editing a Staging Profile”.

Editing a Staging Profile

Figure 10.6. Editing a Staging Profile


This form allows you to configure a profile, the configuration element which is going to control which artifacts are intercepted and used to create Staging Repositories. Staging profiles contain the following fields:

Profile Name

The Name of the Staging Profile. This can be an arbitrary value, it is just a convenience for the Nexus Administrator

Profile Repository Target

This is a reference to the target which we defined in Section 10.3.2, “Configuring a Staging Target”. When a developer deploys an artifact to the Staging URL, the Staging Suite will check to see if artifact matches the patterns defined in the Repository Target. The Target defines the "trigger" for the creation of a Staging Repository.

Staging Repository Type

Nexus can create staging repositories for repositories of type maven1, maven2, and Eclipse P2 repositories. This chapter only deals with maven2 repository types.

Staging Repository Template

Defines a template for the temporary staging repository. The current version of Nexus Professional only allows for a single option in this dropdown "Default Release Hosted Repository Template"

Target Groups

When a Staging Repository is "Closed" and is made available to users and developers involved in the testing process, the temporary Staging Repository is added to a Repository Group. This field defines that group.

Close Repository Notification Roles

After a developer has deployed a set of related release artifacts, a staging repository is "closed". This means that no further artifacts can be deployed to the same staging repository. A repository would be closed when a developer is satisfied that a collection of staged artifacts is ready to be certified by a manager or a quality assurance resource. The Close Notification Role contains all Roles which should be notified of a staging repository being closed. All Nexus users in the specified Role will be notified via email that a staging repository has been closed.

Promotion Repository Notification Roles

Once a staging repository has been closed and certified by a whoever is responsible for testing and checking a staged release, it can then be promoted or discarded. This list of roles defines the roles that need to be notified that a repository has been promoted or discarded. All users with the roles specified in this list will be notified when a staged repository is either promoted or discarded.

Promote Repository Staging Rulesets

This defines the rulesets which will be applied to a staging repository on promotion. If the repository does not pass the rules defined in the promotion rulesets, the promotion will fail with an error message supplied by the failing rule. For more information about rulesets, see Section 10.6.1, “Managing Staging Rulesets”.

Once you've created a Staging Repository with the values shown in Figure 10.6, “Editing a Staging Profile”, you are ready to perform a test deployment to the Staging URL.