OpenShift Nexus: Difference between revisions
Line 22: | Line 22: | ||
oc process -f nexus.yaml | oc create -f - | oc process -f nexus.yaml | oc create -f - | ||
==Verification== | ==Verification== |
Revision as of 01:10, 20 January 2018
External
Internal
Overview
Nexus is a repository and artifact manager used by OpenShift to cache locally build dependencies, and those used by Maven in particular, close to builds. It is recommended to set up one per OpenShift cluster, to speed up Maven builds.
Installation
Image built-in credentials: deployment/deployment123. TODO - configure this during installation.
Method 1
Use the following template: https://github.com/NovaOrdis/playground/blob/master/openshift/templates/nexus-template.yaml
Copy it locally and then:
oc process -f nexus.yaml | oc create -f -
Verification
Nexus should be available at: https://nexus3-cicd.apps.openshift.novaordis.io
The new proxies installed into Browse -> Components: jboss, redhat-ga, maven-all-public, releases.
Troubleshooting
- OpenShift Nexus Kept Getting Restarted
- OpenShift Nexus Pod failed to Start During the CI/CD Pipeline Deployment
Interaction with OpenShift
MAVEN_MIRROR_URL
'MAVEN_MIRROR_URL' is an environment variable interpreted by the OpenShift s2i builders, which use the Maven repository whose URL is specified as a source of artifacts.
OpenShift image builders check for the environment variable MAVEN_MIRROR_URL, which should point to:
- Nexus 2: https://nexus-cicd.apps.openshift.novaordis.io/content/groups/public
- Nexus 3: https://nexus3-cicd.apps.openshift.novaordis.io/repository/maven-all-public
Configure Maven from Maven Build Pods to Use Nexus as Mirror
In all Maven build pods, invoke maven with an alternate settings file that specifies Nexus as a Maven mirror.
mvn -s ./openshift/nexus-settings.xml
Maven command can also be defined as:
def mavenCommand="mvn -s openshift/nexus-settings.xml"
where nexus-settings.xml should be similar to:
<settings>
<servers>
<server>
<id>nexus</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>https://nexus-cicd.apps.openshift.novaordis.io/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>https://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>