Compare commits
183 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9aee590470 | |||
| 831dd53ffd | |||
| 17f90824aa | |||
| 28735645d2 | |||
| fe705c790a | |||
| 53a7c27b2a | |||
| d161f2ecab | |||
| 9667680421 | |||
| 8092a53b72 | |||
| 44074ee10d | |||
| ca76aaab44 | |||
| d60cc5a1ea | |||
| 68c19f3ddd | |||
| 13cd58d892 | |||
| 0f56dcf3dc | |||
| b5bc42cc35 | |||
| be062b3420 | |||
| 6177fcb57f | |||
| bef313ce05 | |||
| f7f7d41d02 | |||
| 256becffb0 | |||
| e0704ddc09 | |||
| b2a9af6d44 | |||
| 7448eb6b94 | |||
| 6db0c0fef9 | |||
| c76a16fe38 | |||
| 771ffca733 | |||
| 2a11a942ea | |||
| 4c07c9c7cb | |||
| 1f2c2c1c71 | |||
| 073ebe2abb | |||
| 038814766e | |||
| 2b5432909c | |||
| b78891de50 | |||
| 031802f651 | |||
| 5d77b34f8e | |||
| e8207fcb25 | |||
| bfd3d1b270 | |||
| 72534f2dd7 | |||
| f23c8b9311 | |||
| dc4cf29b54 | |||
| 180cb4562a | |||
| d6b508c796 | |||
| 1ba2e9f3dc | |||
| 0692cbc886 | |||
| 65d6bc6ffc | |||
| c40eba2ce2 | |||
| f864f4af39 | |||
| 98de4deeba | |||
| f52d0fc751 | |||
| 6dee786433 | |||
| c05daa83c5 | |||
| cd52f63332 | |||
| cbe4eb9930 | |||
| 5645de78c5 | |||
| 1a455fcb14 | |||
| a37ff8be28 | |||
| 584d0c15ee | |||
| 7ba375367b | |||
| 019192a2cd | |||
| 48a8fb6edd | |||
| 50050c2f18 | |||
| 585e06eebc | |||
| d40910f2dc | |||
| 0c660de07d | |||
| fece22c414 | |||
| 3845c0ef59 | |||
| a90e1c8214 | |||
| 8f40d76fea | |||
| 16792220a2 | |||
| 7cd4c3638e | |||
| fc2884a7ec | |||
| f128f2f55e | |||
| 450f668946 | |||
| 705193f62d | |||
| 277031316b | |||
| 3e44657f5e | |||
| 37a9fcd2b9 | |||
| 0f4ff59f0b | |||
| a1f0ab750d | |||
| 907d39d806 | |||
| bd57ceec2a | |||
| a318fa893c | |||
| 706e45b5b0 | |||
| 54894fcec3 | |||
| 451c0c1c36 | |||
| d180fb611d | |||
| c770722970 | |||
| c75f2c4c2a | |||
| 318f53548b | |||
| 7f8dca3509 | |||
| cad92467b0 | |||
| f52169d41c | |||
| 11cff03638 | |||
| 13a8d3d22f | |||
| 78867e3c6c | |||
| 0e272c92e1 | |||
| ce488a2cbd | |||
| 6a1cc21a6e | |||
| 850d5a247e | |||
| a614458159 | |||
| 3a68297242 | |||
| 5f926027a5 | |||
| af1f6b460c | |||
| 7083c277f3 | |||
| a6d18f36fc | |||
| 4c730ede7e | |||
| 005381cc14 | |||
| eee4bcdbf6 | |||
| 26c8c44a72 | |||
| 042408ae64 | |||
| fe501881ed | |||
| af463afcd8 | |||
| c5a275d3e6 | |||
| 7411a0c123 | |||
| d9a13bd2e6 | |||
| 78fed87f0b | |||
| 4f2383143f | |||
| 7c3aa6d946 | |||
| 1fdaf18624 | |||
| 7611c5315f | |||
| 4e49c4d571 | |||
| faf5d8ea40 | |||
| 93bd692a0c | |||
| 9f68c51782 | |||
| db75705007 | |||
| 0d817a0d7b | |||
| ef72848b96 | |||
| a57dc35a62 | |||
| ac637548bf | |||
| 0c3cb14393 | |||
| 03adc13ef8 | |||
| cb564dbfd9 | |||
| e780ba3300 | |||
| cff6c5c21c | |||
| b06afeab86 | |||
| dbc580e6ab | |||
| ed60dbf8a9 | |||
| b4c2ff8142 | |||
| 3250ddce03 | |||
| 135a1c6493 | |||
| 1f5f927d71 | |||
| 97d3daf7fe | |||
| 222b63f15d | |||
| 7a91327b7f | |||
| 65915646ed | |||
| b7e9f09126 | |||
| 04c718287b | |||
| 2d1f4aaa59 | |||
| 6de8a22e19 | |||
| 9ee35fedf9 | |||
| 1d3a2851a9 | |||
| a9fe8de83e | |||
| 338e9dfcff | |||
| 14a5413d9e | |||
| cd24b0ade1 | |||
| e893e36611 | |||
| abac465289 | |||
| 3c7173fb66 | |||
| 222feb87e9 | |||
| acfe030b2c | |||
| be84bce298 | |||
| f9971ab0c0 | |||
| 469ac29f7d | |||
| 381241b6ae | |||
| 3be88b6f4f | |||
| f4b78f48b1 | |||
| b8cddf1c63 | |||
| 4beac47b22 | |||
| 88aaa11b5d | |||
| 06998bb28f | |||
| cd97ed93ac | |||
| 17da9bc447 | |||
| b4835eee02 | |||
| 68f8d092db | |||
| b8061cd565 | |||
| 3139f9340a | |||
| 255a50947d | |||
| 861ceb376d | |||
| 3566cd9ab0 | |||
| eef5f067e2 | |||
| e651dd9cf8 | |||
| 33fbccb149 |
@@ -0,0 +1,40 @@
|
||||
<!--
|
||||
|
||||
Copyright (c) 2016-present Sonatype, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
## How to be a contributor to this project
|
||||
|
||||
### Are you submitting a pull request?
|
||||
|
||||
* Use [our codestyle](https://github.com/sonatype/codestyle). If we get a PR that doesn't match it, there will be
|
||||
much shaming throughout the land. If you use an editor besides Eclipse or IntelliJ, adapt the codestyle and submit a PR
|
||||
there :)
|
||||
* Fill out a CLA for us, so we can sort out all the legal parts of contributing. You can get all the information for
|
||||
this [here](https://help.sonatype.com/display/NXRM3/Bundle+Development#BundleDevelopment-ContributingBundles). You may go, this is for your book, is it
|
||||
applicable for this repo? Yes, absolutely. Follow the CLA process and email in your form. We are working on a way to
|
||||
make this simpler, as well.
|
||||
* Make sure to fill out an issue for your PR, so that we have traceability as to what you are trying to fix,
|
||||
versus how you fixed it.
|
||||
* Try to fix one thing per pull request! Many people work on this code, so the more focused your changes are, the less
|
||||
of a headache other people will have when they merge their work in.
|
||||
* Make sure to add yourself or your organization to CONTRIBUTORS.md as a part of your PR, if you are new to the project!
|
||||
* If you're stuck, ask our [gitter channel](https://gitter.im/sonatype/nexus-developers)! There are a number of
|
||||
experienced programmers who are happy to help with learning and troubleshooting.
|
||||
|
||||
### Are you new and looking to dive in?
|
||||
|
||||
* Check our issues to see if there is something you can dive in to.
|
||||
* Come hang out with us at our [gitter channel](https://gitter.im/sonatype/nexus-developers).
|
||||
@@ -0,0 +1,10 @@
|
||||
Thanks for creating an issue! Please fill out this form so we can be
|
||||
sure to have all the information we need, and to minimize back and forth.
|
||||
|
||||
* **What are you trying to do?**
|
||||
|
||||
* **What feature or behavior is this required for?**
|
||||
|
||||
* **How could we solve this issue? (Not knowing is okay!)**
|
||||
|
||||
* **Anything else?**
|
||||
@@ -0,0 +1,12 @@
|
||||
(brief, plain english overview of your changes here)
|
||||
|
||||
This pull request makes the following changes:
|
||||
* (your change here)
|
||||
* (another change here)
|
||||
* (etc)
|
||||
|
||||
(If there are changes to user behavior in general, please make sure to
|
||||
update the README, as well)
|
||||
|
||||
It relates to the following issue #s:
|
||||
* Fixes #X
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
# Eclipse
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
|
||||
# Maven
|
||||
target/
|
||||
*.ser
|
||||
*.ec
|
||||
.mvn/timing.properties
|
||||
|
||||
# Intellij
|
||||
*.ipr
|
||||
*.iml
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Other
|
||||
.DS_Store
|
||||
.clover
|
||||
*.log
|
||||
/*.rc
|
||||
atlassian-ide-plugin.xml
|
||||
dependency-reduced-pom.xml
|
||||
out
|
||||
@@ -0,0 +1,38 @@
|
||||
<!--
|
||||
|
||||
Copyright (c) 2016-present Sonatype, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
A lot of awesome people have contributed to this project! Here they are:
|
||||
|
||||
Sonatype internal people:
|
||||
|
||||
* [@bradbeck](https://github.com/bradbeck/) (Brad Beck)
|
||||
* [@kellyrob99](https://github.com/kellyrob99/) (Kelly Robinson)
|
||||
* [@joedragons](https://github.com/joedragons/) (Joe Tom)
|
||||
* [@dbradicich](https://github.com/dbradicich/) (Damian Bradicich)
|
||||
* [@nblair](https://github.com/nblair/) (Nicholas Blair)
|
||||
* [@mrprescott](https://github.com/mrprescott/) (Michael Prescott)
|
||||
* [@jeviolle](https://github.com/jeviolle/) (Rick Briganti/The Money)
|
||||
* [@jswank](https://github.com/jswank/) (Jason Swank)
|
||||
* [@DarthHater](https://github.com/darthhater/) (Jeffry Hesse)
|
||||
* [@dawidsawa](https://github.com/dawidsawa/) (Dawid Sawa)
|
||||
|
||||
External contributors:
|
||||
|
||||
* [@bestlong](https://github.com/bestlong/) (Yu-Lung Shao (Allen))
|
||||
* [@jperville](https://github.com/jperville/) (Julien Pervillé)
|
||||
|
||||

|
||||
+69
-42
@@ -1,56 +1,83 @@
|
||||
FROM centos:centos7
|
||||
MAINTAINER Sonatype <cloud-ops@sonatype.com>
|
||||
# Copyright (c) 2016-present Sonatype, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
ENV NEXUS_DATA /nexus-data
|
||||
FROM registry.access.redhat.com/ubi8/ubi
|
||||
|
||||
ENV NEXUS_VERSION 3.0.2-02
|
||||
LABEL name="Nexus Repository Manager" \
|
||||
maintainer="Sonatype <support@sonatype.com>" \
|
||||
vendor=Sonatype \
|
||||
version="3.34.1-01" \
|
||||
release="3.34.1" \
|
||||
url="https://sonatype.com" \
|
||||
summary="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
description="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
run="docker run -d --name NAME \
|
||||
-p 8081:8081 \
|
||||
IMAGE" \
|
||||
stop="docker stop NAME" \
|
||||
com.sonatype.license="Apache License, Version 2.0" \
|
||||
com.sonatype.name="Nexus Repository Manager base image" \
|
||||
io.k8s.description="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
io.k8s.display-name="Nexus Repository Manager" \
|
||||
io.openshift.expose-services="8081:8081" \
|
||||
io.openshift.tags="Sonatype,Nexus,Repository Manager"
|
||||
|
||||
ENV JAVA_HOME /opt/java
|
||||
ENV JAVA_VERSION_MAJOR 8
|
||||
ENV JAVA_VERSION_MINOR 102
|
||||
ENV JAVA_VERSION_BUILD 14
|
||||
ARG NEXUS_VERSION=3.34.1-01
|
||||
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
|
||||
ARG NEXUS_DOWNLOAD_SHA256_HASH=58d69f6fc28a9ed1616ad99c3ef390c7484e88cf729efc450c6e21273e8571e3
|
||||
|
||||
RUN yum install -y \
|
||||
curl tar \
|
||||
&& yum clean all
|
||||
# configure nexus runtime
|
||||
ENV SONATYPE_DIR=/opt/sonatype
|
||||
ENV NEXUS_HOME=${SONATYPE_DIR}/nexus \
|
||||
NEXUS_DATA=/nexus-data \
|
||||
NEXUS_CONTEXT='' \
|
||||
SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work \
|
||||
DOCKER_TYPE='3x-docker'
|
||||
|
||||
# install Oracle JRE
|
||||
RUN mkdir -p /opt \
|
||||
&& curl --fail --silent --location --retry 3 \
|
||||
--header "Cookie: oraclelicense=accept-securebackup-cookie; " \
|
||||
http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-b${JAVA_VERSION_BUILD}/server-jre-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz \
|
||||
| gunzip \
|
||||
| tar -x -C /opt \
|
||||
&& ln -s /opt/jdk1.${JAVA_VERSION_MAJOR}.0_${JAVA_VERSION_MINOR} ${JAVA_HOME}
|
||||
ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION="release-0.5.20210628-162332.70a6cb6"
|
||||
ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL="https://github.com/sonatype/chef-nexus-repository-manager/releases/download/${NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION}/chef-nexus-repository-manager.tar.gz"
|
||||
|
||||
# install nexus
|
||||
RUN mkdir -p /opt/sonatype/nexus \
|
||||
&& curl --fail --silent --location --retry 3 \
|
||||
https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz \
|
||||
| gunzip \
|
||||
| tar x -C /opt/sonatype/nexus --strip-components=1 nexus-${NEXUS_VERSION} \
|
||||
&& chown -R root:root /opt/sonatype/nexus
|
||||
ADD solo.json.erb /var/chef/solo.json.erb
|
||||
|
||||
## configure nexus runtime env
|
||||
RUN sed \
|
||||
-e "s|karaf.home=.|karaf.home=/opt/sonatype/nexus|g" \
|
||||
-e "s|karaf.base=.|karaf.base=/opt/sonatype/nexus|g" \
|
||||
-e "s|karaf.etc=etc|karaf.etc=/opt/sonatype/nexus/etc|g" \
|
||||
-e "s|java.util.logging.config.file=etc|java.util.logging.config.file=/opt/sonatype/nexus/etc|g" \
|
||||
-e "s|karaf.data=data|karaf.data=${NEXUS_DATA}|g" \
|
||||
-e "s|java.io.tmpdir=data/tmp|java.io.tmpdir=${NEXUS_DATA}/tmp|g" \
|
||||
-i /opt/sonatype/nexus/bin/nexus.vmoptions
|
||||
|
||||
RUN useradd -r -u 200 -m -c "nexus role account" -d ${NEXUS_DATA} -s /bin/false nexus
|
||||
# Install using chef-solo
|
||||
# Chef version locked to avoid needing to accept the EULA on behalf of whomever builds the image
|
||||
RUN yum install -y --disableplugin=subscription-manager hostname procps \
|
||||
&& curl -L https://www.getchef.com/chef/install.sh | bash -s -- -v 14.12.9 \
|
||||
&& /opt/chef/embedded/bin/erb /var/chef/solo.json.erb > /var/chef/solo.json \
|
||||
&& chef-solo \
|
||||
--recipe-url ${NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL} \
|
||||
--json-attributes /var/chef/solo.json \
|
||||
&& rpm -qa *chef* | xargs rpm -e \
|
||||
&& rm -rf /etc/chef \
|
||||
&& rm -rf /opt/chefdk \
|
||||
&& rm -rf /var/cache/yum \
|
||||
&& rm -rf /var/chef \
|
||||
&& yum clean all
|
||||
|
||||
# download and install openjdk 8
|
||||
RUN curl -O https://vault.centos.org/8.3.2011/AppStream/x86_64/os/Packages/java-1.8.0-openjdk-headless-1.8.0.282.b08-2.el8_3.x86_64.rpm \
|
||||
&& yum localinstall -y --disableplugin=subscription-manager java-1.8.0-openjdk-headless-1.8.0.282.b08-2.el8_3.x86_64.rpm \
|
||||
&& rm -rf java-1.8.0-openjdk-headless-1.8.0.282.b08-2.el8_3.x86_64.rpm
|
||||
|
||||
VOLUME ${NEXUS_DATA}
|
||||
|
||||
EXPOSE 8081
|
||||
USER nexus
|
||||
WORKDIR /opt/sonatype/nexus
|
||||
|
||||
ENV JAVA_MAX_MEM 1200m
|
||||
ENV JAVA_MIN_MEM 1200m
|
||||
ENV EXTRA_JAVA_OPTS ""
|
||||
ENV INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"
|
||||
|
||||
CMD bin/nexus run
|
||||
CMD ["sh", "-c", "${SONATYPE_DIR}/start-nexus-repository-manager.sh"]
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
# Copyright (c) 2016-present Sonatype, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM centos:centos7
|
||||
|
||||
LABEL name="Nexus Repository Manager" \
|
||||
maintainer="Sonatype <support@sonatype.com>" \
|
||||
vendor=Sonatype \
|
||||
version="3.34.1-01" \
|
||||
release="3.34.1" \
|
||||
url="https://sonatype.com" \
|
||||
summary="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
description="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
run="docker run -d --name NAME \
|
||||
-p 8081:8081 \
|
||||
IMAGE" \
|
||||
stop="docker stop NAME" \
|
||||
com.sonatype.license="Apache License, Version 2.0" \
|
||||
com.sonatype.name="Nexus Repository Manager base image" \
|
||||
io.k8s.description="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
io.k8s.display-name="Nexus Repository Manager" \
|
||||
io.openshift.expose-services="8081:8081" \
|
||||
io.openshift.tags="Sonatype,Nexus,Repository Manager"
|
||||
|
||||
ARG NEXUS_VERSION=3.34.1-01
|
||||
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
|
||||
ARG NEXUS_DOWNLOAD_SHA256_HASH=58d69f6fc28a9ed1616ad99c3ef390c7484e88cf729efc450c6e21273e8571e3
|
||||
|
||||
# configure nexus runtime
|
||||
ENV SONATYPE_DIR=/opt/sonatype
|
||||
ENV NEXUS_HOME=${SONATYPE_DIR}/nexus \
|
||||
NEXUS_DATA=/nexus-data \
|
||||
NEXUS_CONTEXT='' \
|
||||
SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work \
|
||||
DOCKER_TYPE='rh-docker'
|
||||
|
||||
ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION="release-0.5.20190212-155606.d1afdfe"
|
||||
ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL="https://github.com/sonatype/chef-nexus-repository-manager/releases/download/${NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION}/chef-nexus-repository-manager.tar.gz"
|
||||
|
||||
ADD solo.json.erb /var/chef/solo.json.erb
|
||||
|
||||
# Install using chef-solo
|
||||
RUN curl -L https://www.getchef.com/chef/install.sh | bash \
|
||||
&& /opt/chef/embedded/bin/erb /var/chef/solo.json.erb > /var/chef/solo.json \
|
||||
&& chef-solo \
|
||||
--node_name nexus_repository_red_hat_docker_build \
|
||||
--recipe-url ${NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL} \
|
||||
--json-attributes /var/chef/solo.json \
|
||||
&& rpm -qa *chef* | xargs rpm -e \
|
||||
&& rpm --rebuilddb \
|
||||
&& rm -rf /etc/chef \
|
||||
&& rm -rf /opt/chefdk \
|
||||
&& rm -rf /var/cache/yum \
|
||||
&& rm -rf /var/chef
|
||||
|
||||
VOLUME ${NEXUS_DATA}
|
||||
|
||||
EXPOSE 8081
|
||||
USER nexus
|
||||
|
||||
ENV INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"
|
||||
|
||||
ENTRYPOINT ["/uid_entrypoint.sh"]
|
||||
CMD ["sh", "-c", "${SONATYPE_DIR}/start-nexus-repository-manager.sh"]
|
||||
@@ -0,0 +1,78 @@
|
||||
# Copyright (c) 2016-present Sonatype, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM registry.access.redhat.com/rhel7/rhel
|
||||
|
||||
LABEL name="Nexus Repository Manager" \
|
||||
maintainer="Sonatype <support@sonatype.com>" \
|
||||
vendor=Sonatype \
|
||||
version="3.34.1-01" \
|
||||
release="3.34.1" \
|
||||
url="https://sonatype.com" \
|
||||
summary="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
description="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
run="docker run -d --name NAME \
|
||||
-p 8081:8081 \
|
||||
IMAGE" \
|
||||
stop="docker stop NAME" \
|
||||
com.sonatype.license="Apache License, Version 2.0" \
|
||||
com.sonatype.name="Nexus Repository Manager base image" \
|
||||
io.k8s.description="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
io.k8s.display-name="Nexus Repository Manager" \
|
||||
io.openshift.expose-services="8081:8081" \
|
||||
io.openshift.tags="Sonatype,Nexus,Repository Manager"
|
||||
|
||||
ARG NEXUS_VERSION=3.34.1-01
|
||||
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
|
||||
ARG NEXUS_DOWNLOAD_SHA256_HASH=58d69f6fc28a9ed1616ad99c3ef390c7484e88cf729efc450c6e21273e8571e3
|
||||
|
||||
# configure nexus runtime
|
||||
ENV SONATYPE_DIR=/opt/sonatype
|
||||
ENV NEXUS_HOME=${SONATYPE_DIR}/nexus \
|
||||
NEXUS_DATA=/nexus-data \
|
||||
NEXUS_CONTEXT='' \
|
||||
SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work \
|
||||
DOCKER_TYPE='rh-docker'
|
||||
|
||||
ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION="release-0.5.20190212-155606.d1afdfe"
|
||||
ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL="https://github.com/sonatype/chef-nexus-repository-manager/releases/download/${NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION}/chef-nexus-repository-manager.tar.gz"
|
||||
|
||||
ADD solo.json.erb /var/chef/solo.json.erb
|
||||
|
||||
# Install using chef-solo
|
||||
RUN curl -L https://www.getchef.com/chef/install.sh | bash \
|
||||
&& /opt/chef/embedded/bin/erb /var/chef/solo.json.erb > /var/chef/solo.json \
|
||||
&& chef-solo \
|
||||
--node_name nexus_repository_red_hat_docker_build \
|
||||
--recipe-url ${NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL} \
|
||||
--json-attributes /var/chef/solo.json \
|
||||
&& rpm -qa *chef* | xargs rpm -e \
|
||||
&& rpm --rebuilddb \
|
||||
&& rm -rf /etc/chef \
|
||||
&& rm -rf /opt/chefdk \
|
||||
&& rm -rf /var/cache/yum \
|
||||
&& rm -rf /var/chef
|
||||
|
||||
VOLUME ${NEXUS_DATA}
|
||||
|
||||
EXPOSE 8081
|
||||
USER nexus
|
||||
|
||||
ENV INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"
|
||||
|
||||
ENTRYPOINT ["/uid_entrypoint.sh"]
|
||||
CMD ["sh", "-c", "${SONATYPE_DIR}/start-nexus-repository-manager.sh"]
|
||||
@@ -0,0 +1,79 @@
|
||||
# Copyright (c) 2016-present Sonatype, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM registry.access.redhat.com/ubi8/ubi
|
||||
|
||||
LABEL name="Nexus Repository Manager" \
|
||||
vendor=Sonatype \
|
||||
maintainer="Sonatype <support@sonatype.com>" \
|
||||
version="3.34.1-01" \
|
||||
release="3.34.1" \
|
||||
url="https://sonatype.com" \
|
||||
summary="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
description="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
run="docker run -d --name NAME \
|
||||
-p 8081:8081 \
|
||||
IMAGE" \
|
||||
stop="docker stop NAME" \
|
||||
com.sonatype.license="Apache License, Version 2.0" \
|
||||
com.sonatype.name="Nexus Repository Manager base image" \
|
||||
io.k8s.description="The Nexus Repository Manager server \
|
||||
with universal support for popular component formats." \
|
||||
io.k8s.display-name="Nexus Repository Manager" \
|
||||
io.openshift.expose-services="8081:8081" \
|
||||
io.openshift.tags="Sonatype,Nexus,Repository Manager"
|
||||
|
||||
ARG NEXUS_VERSION=3.34.1-01
|
||||
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
|
||||
ARG NEXUS_DOWNLOAD_SHA256_HASH=58d69f6fc28a9ed1616ad99c3ef390c7484e88cf729efc450c6e21273e8571e3
|
||||
|
||||
# configure nexus runtime
|
||||
ENV SONATYPE_DIR=/opt/sonatype
|
||||
ENV NEXUS_HOME=${SONATYPE_DIR}/nexus \
|
||||
NEXUS_DATA=/nexus-data \
|
||||
NEXUS_CONTEXT='' \
|
||||
SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work \
|
||||
DOCKER_TYPE='rh-docker'
|
||||
|
||||
ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION="release-0.5.20190212-155606.d1afdfe"
|
||||
ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL="https://github.com/sonatype/chef-nexus-repository-manager/releases/download/${NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION}/chef-nexus-repository-manager.tar.gz"
|
||||
|
||||
ADD solo.json.erb /var/chef/solo.json.erb
|
||||
|
||||
# Install using chef-solo
|
||||
# Chef version locked to avoid needing to accept the EULA on behalf of whomever builds the image
|
||||
RUN curl -L https://www.getchef.com/chef/install.sh | bash -s -- -v 14.12.9 \
|
||||
&& /opt/chef/embedded/bin/erb /var/chef/solo.json.erb > /var/chef/solo.json \
|
||||
&& chef-solo \
|
||||
--node_name nexus_repository_red_hat_docker_build \
|
||||
--recipe-url ${NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL} \
|
||||
--json-attributes /var/chef/solo.json \
|
||||
&& rpm -qa *chef* | xargs rpm -e \
|
||||
&& rm -rf /etc/chef \
|
||||
&& rm -rf /opt/chefdk \
|
||||
&& rm -rf /var/cache/yum \
|
||||
&& rm -rf /var/chef \
|
||||
&& yum clean all
|
||||
|
||||
VOLUME ${NEXUS_DATA}
|
||||
|
||||
EXPOSE 8081
|
||||
USER nexus
|
||||
|
||||
ENV INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"
|
||||
|
||||
ENTRYPOINT ["/uid_entrypoint.sh"]
|
||||
CMD ["sh", "-c", "${SONATYPE_DIR}/start-nexus-repository-manager.sh"]
|
||||
Vendored
+247
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Copyright (c) 2016-present Sonatype, Inc. All rights reserved.
|
||||
* Includes the third-party code listed at http://links.sonatype.com/products/nexus/attributions.
|
||||
* "Sonatype" is a trademark of Sonatype, Inc.
|
||||
*/
|
||||
@Library(['private-pipeline-library', 'jenkins-shared']) _
|
||||
import com.sonatype.jenkins.pipeline.GitHub
|
||||
import com.sonatype.jenkins.pipeline.OsTools
|
||||
|
||||
properties([
|
||||
parameters([
|
||||
string(defaultValue: '', description: 'New Nexus Repository Manager Version', name: 'nexus_repository_manager_version'),
|
||||
string(defaultValue: '', description: 'New Nexus Repository Manager Version Sha256', name: 'nexus_repository_manager_version_sha'),
|
||||
string(defaultValue: '', description: 'New Nexus Repository Manager Cookbook Version', name: 'nexus_repository_manager_cookbook_version'),
|
||||
booleanParam(defaultValue: false, description: 'Skip Pushing of Docker Image and Tags', name: 'skip_push'),
|
||||
booleanParam(defaultValue: false, description: 'Force Red Hat Certified Build for a non-master branch', name: 'force_red_hat_build'),
|
||||
booleanParam(defaultValue: false, description: 'Skip Red Hat Certified Build', name: 'skip_red_hat_build'),
|
||||
])
|
||||
])
|
||||
|
||||
node('ubuntu-zion') {
|
||||
def commitId, commitDate, version, imageId, branch, dockerFileLocations
|
||||
def organization = 'sonatype',
|
||||
gitHubRepository = 'docker-nexus3',
|
||||
credentialsId = 'integrations-github-api',
|
||||
imageName = 'sonatype/nexus3',
|
||||
archiveName = 'docker-nexus3',
|
||||
dockerHubRepository = 'nexus3'
|
||||
GitHub gitHub
|
||||
|
||||
try {
|
||||
stage('Preparation') {
|
||||
deleteDir()
|
||||
OsTools.runSafe(this, "docker system prune -a -f")
|
||||
|
||||
def checkoutDetails = checkout scm
|
||||
|
||||
dockerFileLocations = [
|
||||
"${pwd()}/Dockerfile",
|
||||
"${pwd()}/Dockerfile.rh.centos",
|
||||
"${pwd()}/Dockerfile.rh.el",
|
||||
"${pwd()}/Dockerfile.rh.ubi"
|
||||
]
|
||||
|
||||
branch = checkoutDetails.GIT_BRANCH == 'origin/master' ? 'master' : checkoutDetails.GIT_BRANCH
|
||||
commitId = checkoutDetails.GIT_COMMIT
|
||||
commitDate = OsTools.runSafe(this, "git show -s --format=%cd --date=format:%Y%m%d-%H%M%S ${commitId}")
|
||||
|
||||
OsTools.runSafe(this, 'git config --global user.email sonatype-ci@sonatype.com')
|
||||
OsTools.runSafe(this, 'git config --global user.name Sonatype CI')
|
||||
|
||||
version = readVersion()
|
||||
|
||||
def apiToken
|
||||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: credentialsId,
|
||||
usernameVariable: 'GITHUB_API_USERNAME', passwordVariable: 'GITHUB_API_PASSWORD']]) {
|
||||
apiToken = env.GITHUB_API_PASSWORD
|
||||
}
|
||||
gitHub = new GitHub(this, "${organization}/${gitHubRepository}", apiToken)
|
||||
|
||||
if (params.nexus_repository_manager_version && params.nexus_repository_manager_version_sha) {
|
||||
stage('Update Repository Manager Version') {
|
||||
OsTools.runSafe(this, "git checkout ${branch}")
|
||||
dockerFileLocations.each { updateRepositoryManagerVersion(it) }
|
||||
version = getShortVersion(params.nexus_repository_manager_version)
|
||||
}
|
||||
}
|
||||
if (params.nexus_repository_manager_cookbook_version) {
|
||||
stage('Update Repository Manager Cookbook Version') {
|
||||
OsTools.runSafe(this, "git checkout ${branch}")
|
||||
dockerFileLocations.each { updateRepositoryCookbookVersion(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
gitHub.statusUpdate commitId, 'pending', 'build', 'Build is running'
|
||||
|
||||
def hash = OsTools.runSafe(this, "docker build --quiet --no-cache --tag ${imageName} .")
|
||||
imageId = hash.split(':')[1]
|
||||
|
||||
if (currentBuild.result == 'FAILURE') {
|
||||
gitHub.statusUpdate commitId, 'failure', 'build', 'Build failed'
|
||||
return
|
||||
} else {
|
||||
gitHub.statusUpdate commitId, 'success', 'build', 'Build succeeded'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
gitHub.statusUpdate commitId, 'pending', 'test', 'Tests are running'
|
||||
|
||||
def gemInstallDirectory = getGemInstallDirectory()
|
||||
withEnv(["PATH+GEMS=${gemInstallDirectory}/bin"]) {
|
||||
OsTools.runSafe(this, "gem install --user-install rspec")
|
||||
OsTools.runSafe(this, "gem install --user-install serverspec")
|
||||
OsTools.runSafe(this, "gem install --user-install docker-api")
|
||||
OsTools.runSafe(this, "IMAGE_ID=${imageId} rspec --backtrace spec/Dockerfile_spec.rb")
|
||||
}
|
||||
|
||||
if (currentBuild.result == 'FAILURE') {
|
||||
gitHub.statusUpdate commitId, 'failure', 'test', 'Tests failed'
|
||||
return
|
||||
} else {
|
||||
gitHub.statusUpdate commitId, 'success', 'test', 'Tests succeeded'
|
||||
}
|
||||
}
|
||||
if (currentBuild.result == 'FAILURE') {
|
||||
return
|
||||
}
|
||||
if (params.nexus_repository_manager_version && params.nexus_repository_manager_version_sha
|
||||
|| params.nexus_repository_manager_cookbook_version) {
|
||||
stage('Commit Automated Code Update') {
|
||||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'integrations-github-api',
|
||||
usernameVariable: 'GITHUB_API_USERNAME', passwordVariable: 'GITHUB_API_PASSWORD']]) {
|
||||
def commitMessage = [
|
||||
params.nexus_repository_manager_version && params.nexus_repository_manager_version_sha ?
|
||||
"Update Repository Manager to ${params.nexus_repository_manager_version}." : "",
|
||||
params.nexus_repository_manager_cookbook_version ?
|
||||
"Update Repository Manager Cookbook to ${params.nexus_repository_manager_cookbook_version}." : ""
|
||||
].findAll({ it }).join(' ')
|
||||
OsTools.runSafe(this, """
|
||||
git add .
|
||||
git commit -m '${commitMessage}'
|
||||
git push https://${env.GITHUB_API_USERNAME}:${env.GITHUB_API_PASSWORD}@github.com/${organization}/${gitHubRepository}.git ${branch}
|
||||
""")
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archive') {
|
||||
dir('build/target') {
|
||||
OsTools.runSafe(this, "docker save ${imageName} | gzip > ${archiveName}.tar.gz")
|
||||
archiveArtifacts artifacts: "${archiveName}.tar.gz", onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
if (branch == 'master' && ! params.skip_push) {
|
||||
input 'Push image and tags?'
|
||||
stage('Push image') {
|
||||
def dockerhubApiToken
|
||||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'docker-hub-credentials',
|
||||
usernameVariable: 'DOCKERHUB_API_USERNAME', passwordVariable: 'DOCKERHUB_API_PASSWORD']]) {
|
||||
OsTools.runSafe(this, "docker tag ${imageId} ${organization}/${dockerHubRepository}:${version}")
|
||||
OsTools.runSafe(this, "docker tag ${imageId} ${organization}/${dockerHubRepository}:latest")
|
||||
OsTools.runSafe(this, """
|
||||
docker login --username ${env.DOCKERHUB_API_USERNAME} --password ${env.DOCKERHUB_API_PASSWORD}
|
||||
""")
|
||||
OsTools.runSafe(this, "docker push --all-tags ${organization}/${dockerHubRepository}")
|
||||
|
||||
response = OsTools.runSafe(this, """
|
||||
curl -X POST https://hub.docker.com/v2/users/login/ \
|
||||
-H 'cache-control: no-cache' -H 'content-type: application/json' \
|
||||
-d '{ "username": "${env.DOCKERHUB_API_USERNAME}", "password": "${env.DOCKERHUB_API_PASSWORD}" }'
|
||||
""")
|
||||
token = readJSON text: response
|
||||
dockerhubApiToken = token.token
|
||||
|
||||
def readme = readFile file: 'README.md', encoding: 'UTF-8'
|
||||
readme = readme.replaceAll("(?s)<!--.*?-->", "")
|
||||
readme = readme.replace("\"", "\\\"")
|
||||
readme = readme.replace("\n", "\\n")
|
||||
response = httpRequest customHeaders: [[name: 'authorization', value: "JWT ${dockerhubApiToken}"]],
|
||||
acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', httpMode: 'PATCH',
|
||||
requestBody: "{ \"full_description\": \"${readme}\" }",
|
||||
url: "https://hub.docker.com/v2/repositories/${organization}/${dockerHubRepository}/"
|
||||
}
|
||||
}
|
||||
stage('Push tags') {
|
||||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: credentialsId,
|
||||
usernameVariable: 'GITHUB_API_USERNAME', passwordVariable: 'GITHUB_API_PASSWORD']]) {
|
||||
OsTools.runSafe(this, "git tag ${version}")
|
||||
OsTools.runSafe(this, """
|
||||
git push \
|
||||
https://${env.GITHUB_API_USERNAME}:${env.GITHUB_API_PASSWORD}@github.com/${organization}/${gitHubRepository}.git \
|
||||
${version}
|
||||
""")
|
||||
}
|
||||
OsTools.runSafe(this, "git tag -d ${version}")
|
||||
}
|
||||
}
|
||||
/*
|
||||
if ((! params.skip_red_hat_build) && (branch == 'master' || params.force_red_hat_build)) {
|
||||
stage('Trigger Red Hat Certified Image Build') {
|
||||
withCredentials([
|
||||
string(credentialsId: 'docker-nexus3-rh-build-project-id', variable: 'PROJECT_ID'),
|
||||
string(credentialsId: 'rh-build-service-api-key', variable: 'API_KEY')]) {
|
||||
final redHatVersion = "${version}-ubi"
|
||||
runGroovy('ci/TriggerRedHatBuild.groovy', [redHatVersion, PROJECT_ID, API_KEY].join(' '))
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
} finally {
|
||||
OsTools.runSafe(this, "docker logout")
|
||||
OsTools.runSafe(this, "docker system prune -a -f")
|
||||
OsTools.runSafe(this, 'git clean -f && git reset --hard origin/master')
|
||||
}
|
||||
}
|
||||
|
||||
def readVersion() {
|
||||
def content = readFile 'Dockerfile'
|
||||
for (line in content.split('\n')) {
|
||||
if (line.startsWith('ARG NEXUS_VERSION=')) {
|
||||
return getShortVersion(line.substring(18))
|
||||
}
|
||||
}
|
||||
error 'Could not determine version.'
|
||||
}
|
||||
|
||||
def getShortVersion(version) {
|
||||
return version.split('-')[0]
|
||||
}
|
||||
|
||||
def getGemInstallDirectory() {
|
||||
def content = OsTools.runSafe(this, "gem env")
|
||||
for (line in content.split('\n')) {
|
||||
if (line.startsWith(' - USER INSTALLATION DIRECTORY: ')) {
|
||||
return line.substring(33)
|
||||
}
|
||||
}
|
||||
error 'Could not determine user gem install directory.'
|
||||
}
|
||||
|
||||
def updateRepositoryManagerVersion(dockerFileLocation) {
|
||||
def dockerFile = readFile(file: dockerFileLocation)
|
||||
|
||||
def metaVersionRegex = /(version=")(\d\.\d{1,3}\.\d\-\d{2})(" \\)/
|
||||
def metaShortVersionRegex = /(release=")(\d\.\d{1,3}\.\d)(" \\)/
|
||||
|
||||
def versionRegex = /(ARG NEXUS_VERSION=)(\d\.\d{1,3}\.\d\-\d{2})/
|
||||
def shaRegex = /(ARG NEXUS_DOWNLOAD_SHA256_HASH=)([A-Fa-f0-9]{64})/
|
||||
|
||||
dockerFile = dockerFile.replaceAll(metaVersionRegex, "\$1${params.nexus_repository_manager_version}\$3")
|
||||
dockerFile = dockerFile.replaceAll(metaShortVersionRegex,
|
||||
"\$1${params.nexus_repository_manager_version.substring(0, params.nexus_repository_manager_version.indexOf('-'))}\$3")
|
||||
dockerFile = dockerFile.replaceAll(versionRegex, "\$1${params.nexus_repository_manager_version}")
|
||||
dockerFile = dockerFile.replaceAll(shaRegex, "\$1${params.nexus_repository_manager_version_sha}")
|
||||
|
||||
writeFile(file: dockerFileLocation, text: dockerFile)
|
||||
}
|
||||
|
||||
def updateRepositoryCookbookVersion(dockerFileLocation) {
|
||||
def dockerFile = readFile(file: dockerFileLocation)
|
||||
|
||||
def cookbookVersionRegex = /(ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION=")(release-\d\.\d\.\d{8}\-\d{6}\.[a-z0-9]{7})(")/
|
||||
|
||||
dockerFile = dockerFile.replaceAll(cookbookVersionRegex, "\$1${params.nexus_repository_manager_cookbook_version}\$3")
|
||||
|
||||
writeFile(file: dockerFileLocation, text: dockerFile)
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -1,32 +1,112 @@
|
||||
# sonatype/nexus3
|
||||
<!--
|
||||
|
||||
Copyright (c) 2016-present Sonatype, Inc.
|
||||
|
||||
A Dockerfile for Sonatype Nexus Repository Manager 3, based on CentOS.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
To run, binding the exposed port 8081 to the host.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
|
||||
# Sonatype Nexus3 Docker: sonatype/nexus3
|
||||
|
||||
[](https://gitter.im/sonatype/nexus-developers?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
A Dockerfile for Sonatype Nexus Repository Manager 3, starting with 3.18 the image is based on the [Red Hat Universal Base Image](https://www.redhat.com/en/blog/introducing-red-hat-universal-base-image) while earlier versions used CentOS.
|
||||
|
||||
* [Contribution Guidlines](#contribution-guidelines)
|
||||
* [Running](#running)
|
||||
* [Building the Nexus Repository Manager image](#building-the-nexus-repository-manager-image)
|
||||
* [Chef Solo for Runtime and Application](#chef-solo-for-runtime-and-application)
|
||||
* [Testing the Dockerfile](#testing-the-dockerfile)
|
||||
* [Red Hat Certified Image](#red-hat-certified-image)
|
||||
* [Notes](#notes)
|
||||
* [Persistent Data](#persistent-data)
|
||||
* [Getting Help](#getting-help)
|
||||
|
||||
## Contribution Guidelines
|
||||
|
||||
Go read [our contribution guidelines](https://github.com/sonatype/docker-nexus3/blob/master/.github/CONTRIBUTING.md) to get a bit more familiar with how
|
||||
we would like things to flow.
|
||||
|
||||
## Running
|
||||
|
||||
To run, binding the exposed port 8081 to the host, use:
|
||||
|
||||
```
|
||||
$ docker run -d -p 8081:8081 --name nexus sonatype/nexus3
|
||||
```
|
||||
|
||||
When stopping, be sure to allow sufficient time for the databases to fully shut down.
|
||||
|
||||
```
|
||||
docker stop --time=120 <CONTAINER_NAME>
|
||||
```
|
||||
|
||||
|
||||
To test:
|
||||
|
||||
```
|
||||
$ curl -u admin:admin123 http://localhost:8081/service/metrics/ping
|
||||
$ curl http://localhost:8081/
|
||||
```
|
||||
|
||||
To (re)build the image:
|
||||
## Building the Nexus Repository Manager image
|
||||
|
||||
Copy the Dockerfile and do the build-
|
||||
To build a docker image from the Docker file you can use this command:
|
||||
|
||||
```
|
||||
$ docker build --rm=true --tag=sonatype/nexus3 .
|
||||
```
|
||||
|
||||
The following optional variables can be used when building the image:
|
||||
|
||||
- NEXUS_VERSION: Version of the Nexus Repository Manager
|
||||
- NEXUS_DOWNLOAD_URL: Download URL for Nexus Repository, alternative to using `NEXUS_VERSION` to download from Sonatype
|
||||
- NEXUS_DOWNLOAD_SHA256_HASH: Sha256 checksum for the downloaded Nexus Repository Manager archive. Required if `NEXUS_VERSION`
|
||||
or `NEXUS_DOWNLOAD_URL` is provided
|
||||
|
||||
## Chef Solo for Runtime and Application
|
||||
|
||||
Chef Solo is used to build out the runtime and application layers of the Docker image. The Chef cookbook being used is available
|
||||
on GitHub at [sonatype/chef-nexus-repository-manager](https://github.com/sonatype/chef-nexus-repository-manager).
|
||||
|
||||
## Testing the Dockerfile
|
||||
|
||||
We are using `rspec` as the test framework. `serverspec` provides a docker backend (see the method `set` in the test code)
|
||||
to run the tests inside the docker container, and abstracts away the difference between distributions in the tests
|
||||
(e.g. yum, apt,...).
|
||||
|
||||
rspec [--backtrace] spec/Dockerfile_spec.rb
|
||||
|
||||
## Red Hat Certified Image
|
||||
|
||||
A Red Hat certified container image can be created using `Dockerfile.rh.ubi` which is built to be compliant with Red Hat certification.
|
||||
The image includes additional meta data to comform with Kubernetes and OpenShift standards, a directory with the
|
||||
licenses applicable to the software and a man file for help on how to use the software. It also uses an ENTRYPOINT
|
||||
script the ensure the running user has access to the appropriate permissions for OpenShift 'restricted' SCC.
|
||||
|
||||
The Red Hat certified container image is available from the
|
||||
[Red Hat Container Catalog](https://access.redhat.com/containers/#/registry.connect.redhat.com/sonatype/nexus-repository-manager)
|
||||
and qualified accounts can pull it from registry.connect.redhat.com.
|
||||
|
||||
## Other Red Hat Images
|
||||
|
||||
In addition to the Universal Base Image, we can build images based on:
|
||||
* Red Hat Enterprise Linux: `Dockerfile.rh.el`
|
||||
* CentOS: `Dockerfile.rh.centos`
|
||||
|
||||
## Notes
|
||||
|
||||
* Default credentials are: `admin` / `admin123`
|
||||
* Our [system requirements](https://help.sonatype.com/display/NXRM3/System+Requirements) should be taken into account when provisioning the Docker container.
|
||||
* Default user is `admin` and the uniquely generated password can be found in the `admin.password` file inside the volume. See [Persistent Data](#user-content-persistent-data) for information about the volume.
|
||||
|
||||
* It can take some time (2-3 minutes) for the service to launch in a
|
||||
new container. You can tail the log to determine once Nexus is ready:
|
||||
@@ -41,35 +121,43 @@ $ docker logs -f nexus
|
||||
logs, and storage. This directory needs to be writable by the Nexus
|
||||
process, which runs as UID 200.
|
||||
|
||||
* Three environment variables can be used to control the JVM arguments
|
||||
* There is an environment variable that is being used to pass JVM arguments to the startup script
|
||||
|
||||
* `JAVA_MAX_MEM`, passed as -Xmx. Defaults to `1200m`.
|
||||
* `INSTALL4J_ADD_VM_PARAMS`, passed to the Install4J startup script. Defaults to `-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs`.
|
||||
|
||||
* `JAVA_MIN_MEM`, passed as -Xms. Defaults to `1200m`.
|
||||
|
||||
* `EXTRA_JAVA_OPTS`. Additional options can be passed to the JVM via
|
||||
this variable.
|
||||
|
||||
These can be used supplied at runtime to control the JVM:
|
||||
This can be adjusted at runtime:
|
||||
|
||||
```
|
||||
$ docker run -d -p 8081:8081 --name nexus -e JAVA_MAX_HEAP=768m sonatype/nexus3
|
||||
$ docker run -d -p 8081:8081 --name nexus -e INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=/some-other-dir" sonatype/nexus3
|
||||
```
|
||||
|
||||
Of particular note, `-Djava.util.prefs.userRoot=/some-other-dir` can be set to a persistent path, which will maintain
|
||||
the installed Nexus Repository License if the container is restarted.
|
||||
|
||||
Be sure to check the [memory requirements](https://help.sonatype.com/display/NXRM3/System+Requirements#SystemRequirements-MemoryRequirements) when deciding how much heap and direct memory to allocate.
|
||||
|
||||
* Another environment variable can be used to control the Nexus Context Path
|
||||
|
||||
* `NEXUS_CONTEXT`, defaults to /
|
||||
|
||||
This can be supplied at runtime:
|
||||
|
||||
```
|
||||
$ docker run -d -p 8081:8081 --name nexus -e NEXUS_CONTEXT=nexus sonatype/nexus3
|
||||
```
|
||||
|
||||
### Persistent Data
|
||||
|
||||
There are two general approaches to handling persistent storage requirements
|
||||
with Docker. See [Managing Data in Containers](https://docs.docker.com/userguide/dockervolumes/)
|
||||
with Docker. See [Managing Data in Containers](https://docs.docker.com/engine/tutorials/dockervolumes/)
|
||||
for additional information.
|
||||
|
||||
1. *Use a data volume container*. Since data volumes are persistent
|
||||
until no containers use them, a container can created specifically for
|
||||
1. *Use a docker volume*. Since docker volumes are persistent, a volume can be created specifically for
|
||||
this purpose. This is the recommended approach.
|
||||
|
||||
```
|
||||
$ docker run -d --name nexus-data sonatype/nexus3 echo "data-only container for Nexus"
|
||||
$ docker run -d -p 8081:8081 --name nexus --volumes-from nexus-data sonatype/nexus3
|
||||
$ docker volume create --name nexus-data
|
||||
$ docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-data sonatype/nexus3
|
||||
```
|
||||
|
||||
2. *Mount a host directory as the volume*. This is not portable, as it
|
||||
@@ -81,3 +169,16 @@ for additional information.
|
||||
$ mkdir /some/dir/nexus-data && chown -R 200 /some/dir/nexus-data
|
||||
$ docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3
|
||||
```
|
||||
|
||||
## Getting Help
|
||||
|
||||
Looking to contribute to our Docker image but need some help? There's a few ways to get information or our attention:
|
||||
|
||||
* Chat with us on [Gitter](https://gitter.im/sonatype/nexus-developers)
|
||||
* File an issue [on our public JIRA](https://issues.sonatype.org/projects/NEXUS/)
|
||||
* Check out the [Nexus3](http://stackoverflow.com/questions/tagged/nexus3) tag on Stack Overflow
|
||||
* Check out the [Nexus Repository User List](https://groups.google.com/a/glists.sonatype.com/forum/?hl=en#!forum/nexus-users)
|
||||
|
||||
## License Disclaimer
|
||||
|
||||
_Nexus Repository OSS is distributed with Sencha Ext JS pursuant to a FLOSS Exception agreed upon between Sonatype, Inc. and Sencha Inc. Sencha Ext JS is licensed under GPL v3 and cannot be redistributed as part of a closed source work._
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<!--
|
||||
|
||||
Copyright (c) 2011-present Sonatype, Inc. All rights reserved.
|
||||
Includes the third-party code listed at http://links.sonatype.com/products/clm/attributions.
|
||||
"Sonatype" is a trademark of Sonatype, Inc.
|
||||
|
||||
-->
|
||||
|
||||
# Reporting Security Vulnerabilities
|
||||
|
||||
## When to report
|
||||
|
||||
First check
|
||||
[Important advisories of known security vulnerabilities in Sonatype products](https://support.sonatype.com/hc/en-us/sections/203012668-Security-Advisories)
|
||||
to see if this has been previously reported.
|
||||
|
||||
## How to report
|
||||
|
||||
Please email reports regarding security related issues you find to [mailto:security@sonatype.com](security@sonatype.com).
|
||||
|
||||
Use our public key below to keep your message safe.
|
||||
|
||||
## What to include
|
||||
|
||||
Please use a descriptive subject line in your email report.
|
||||
|
||||
Your name and/or affiliation.
|
||||
|
||||
A detailed technical description of the vulnerability, attack scenario and where
|
||||
possible, how we can reproduce your findings.
|
||||
|
||||
Provide us with a secure way to respond.
|
||||
|
||||
## What to expect
|
||||
|
||||
Your email will be acknowledged within 1 - 2 business days, and you'll receive a
|
||||
more detailed response to your email within 7 business days.
|
||||
|
||||
We ask that everyone please follow responsible disclosure practices and allow
|
||||
time for us to release a fix prior to public release.
|
||||
|
||||
Once an issue is reported, Sonatype uses the following disclosure process:
|
||||
|
||||
When a report is received, we confirm the issue and determine its severity.
|
||||
|
||||
If third-party services or software require mitigation before publication, those
|
||||
projects will be notified.
|
||||
|
||||
## Our public key
|
||||
|
||||
```console
|
||||
-----BEGIN PUBLIC KEY BLOCK-----
|
||||
mQENBFF+a9ABCADQWSAAU7w9i71Zn3TQ6k7lT9x57cRdtX7V709oeN/c/1it+gCw
|
||||
onmmCyf4ypor6XcPSOasp/x0s3hVuf6YfMbI0tSwJUWWihrmoPGIXtmiSOotQE0Q
|
||||
Sav41xs3YyI9LzQB4ngZR/nhp4YhioD1dVorD6LGXk08rvl2ikoqHwTagbEXZJY7
|
||||
3VYhW6JHbZTLwCsfyg6uaSYF1qXfUxHPOiHYKNbhK/tM3giX+9ld/7xi+9f4zEFQ
|
||||
eX9wcRTdgdDOAqDOK7MV30KXagSqvW0MgEYtKX6q4KjjRzBYjkiTdFW/yMXub/Bs
|
||||
5UckxHTCuAmvpr5J0HIUeLtXi1QCkijyn8HJABEBAAG0KVNvbmF0eXBlIFNlY3Vy
|
||||
aXR5IDxzZWN1cml0eUBzb25hdHlwZS5jb20+iQE4BBMBAgAiBQJRfmvQAhsDBgsJ
|
||||
CAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRAgkmxsNtgwfUzbCACLtCgieq1kJOqo
|
||||
2i136ND5ZOj31zIzNENLn8dhSg5zQwTHOcntWAtS8uCNq4fSlslwvlbPYWTLD7fE
|
||||
iJn1z7BCU8gBk+pkAJJFWEPweMVt+9bYQ4HfKceGbJeuwBBhS34SK9ZIp9gfxxfA
|
||||
oTm0aGYwKR5wH3sqL/mrhwKhPt9wXR4qwlE635STEX8wzJ5SBqf3ArJUtCp1rzgR
|
||||
Dx+DiZed5HE1pOI2Kyb6O80bm485WThPXxpvp3bfzTNYoGzeLi/F7WkmgggkXxsT
|
||||
Pyd0sSx0B/MO4lJtQvEBlIHDFno9mXa30fKl+rzp2geG5UxNHJUjaC5JhfWLEXEX
|
||||
wV0ErBsmuQENBFF+a9ABCADXj04+GLIz8VCaZH554nUHEhaKoiIXH3Tj7UiMZDqy
|
||||
o4WIw2RFaCQNA8T0R5Q0yxINU146JQMbA2SN59AGcGYZcajyEvTR7tLG0meMO6S0
|
||||
JWpkX7s3xaC0s+5SJ/ba00oHGzW0aotgzG9BWA5OniNHK7zZKMVu7M80M/wB1RvK
|
||||
x775hAeJ+8F9MDJ+ijydBtaOfDdkbg+0kU1xR6Io+vVLPk38ghlWU8QFP4/B0oWi
|
||||
jK4xiDqK6cG7kyH9kC9nau+ckH8MrJ/RzEpsc4GRwqS4IEnvHWe7XbgydWS1bCp6
|
||||
8uP5ma3d02elQmSEa+PABIPKnZcAf1YKLr9O/+IzEdOhABEBAAGJAR8EGAECAAkF
|
||||
AlF+a9ACGwwACgkQIJJsbDbYMH3WzAf/XOm4YQZFOgG2h9d03m8me8d1vrYico+0
|
||||
pBYU9iCozLgamM4er9Efb+XzfLvNVKuqyR0cgvGszukIPQYeX58DMrZ07C+E0wDZ
|
||||
bG+ZAYXT5GqsHkSVnMCVIfyJNLjR4sbVzykyVtnccBL6bP3jxbCP1jJdT7bwiKre
|
||||
1jQjvyoL0yIegdiN/oEdmx52Fqjt4NkQsp4sk625UBFTVISr22bnf60ZIGgrRbAP
|
||||
DU1XMdIrmqmhEEQcXMp4CeflDMksOmaIeAUkZY7eddnXMwQDJTnz5ziCal+1r0R3
|
||||
dh0XISRG0NkiLEXeGkrs7Sn7BAAsTsaH/1zU6YbvoWlMlHYT6EarFQ== =sFGt
|
||||
-----END PUBLIC KEY BLOCK-----
|
||||
```
|
||||
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* Copyright (c) 2020-present Sonatype, Inc. All rights reserved.
|
||||
* Includes the third-party code listed at http://links.sonatype.com/products/clm/attributions.
|
||||
* "Sonatype" is a trademark of Sonatype, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This script triggers the build service for a certified docker image at Red Hat.
|
||||
* It's meant to be used by Jenkins via the Jenkinsfile.
|
||||
*/
|
||||
@Grab('io.github.http-builder-ng:http-builder-ng-core:1.0.4')
|
||||
|
||||
import groovyx.net.http.HttpBuilder
|
||||
import groovyx.net.http.HttpException
|
||||
|
||||
if (args.size() < 3) {
|
||||
System.err.println('Usage: groovy TriggerRedhatBuild.groovy <version> <projectId> <apiKey>')
|
||||
System.exit(1)
|
||||
}
|
||||
|
||||
new BuildClient(*args).run()
|
||||
|
||||
class BuildClient {
|
||||
private static final Integer TIMEOUT_MINUTES = 20
|
||||
|
||||
private final String version
|
||||
private final String projectId
|
||||
|
||||
private final HttpBuilder builder
|
||||
|
||||
BuildClient(String version, String projectId, String apiKey) {
|
||||
this.version = version
|
||||
this.projectId = projectId
|
||||
|
||||
builder = HttpBuilder.configure {
|
||||
request.uri = 'https://connect.redhat.com'
|
||||
request.headers['Authorization'] = "Bearer ${apiKey}"
|
||||
request.contentType = 'application/json'
|
||||
request.body = [:]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* fire off a series of requests to build and publish
|
||||
* a container.
|
||||
*/
|
||||
void run() {
|
||||
final nextTag = getNextTag(version)
|
||||
println "Triggering build as ${nextTag}"
|
||||
|
||||
final buildStatus = build(nextTag)
|
||||
|
||||
if (buildStatus.status != 'Created') {
|
||||
fail(buildStatus)
|
||||
}
|
||||
|
||||
final completedBuild = getCompletedBuild(nextTag)
|
||||
|
||||
if (completedBuild.failure) {
|
||||
fail(completedBuild.failure)
|
||||
}
|
||||
|
||||
final published = publish(completedBuild.digest, completedBuild.name)
|
||||
|
||||
if (published.failure) {
|
||||
fail(published.failure)
|
||||
}
|
||||
|
||||
println published
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate the cutoff time in the future in miliseconds
|
||||
* for comparison to System.currentTimeMillis()
|
||||
* @param start start time in millis
|
||||
* @param minutes minutes into the future
|
||||
* @return future time in millis
|
||||
*/
|
||||
private Long calcCutoffTime(Long start, Integer minutes) {
|
||||
return minutes * 60 * 1000 + start
|
||||
}
|
||||
|
||||
/**
|
||||
* fail with message and exit with an error code for jenkins to see
|
||||
* @param message message to print
|
||||
*/
|
||||
private void fail(String message) {
|
||||
System.err.println(message)
|
||||
System.exit(1)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Request current version tags available at Red Hat.
|
||||
* @return the list of all tags
|
||||
*/
|
||||
private List getTags() {
|
||||
return builder.post {
|
||||
request.uri.path = "/api/v2/projects/${projectId}/tags"
|
||||
}.tags
|
||||
}
|
||||
|
||||
/**
|
||||
* Request current version tags available at Red Hat,
|
||||
* and calculate the next tag to use in this build.
|
||||
* @param version the base version we're currently building
|
||||
* @return the full new version string to submit for the next build
|
||||
*/
|
||||
private String getNextTag(String version) {
|
||||
final tags = getTags()*.name.collectMany {
|
||||
it.split(', ').collect()
|
||||
}
|
||||
|
||||
final currentIndex = tags.findAll {
|
||||
it.startsWith(version)
|
||||
}.collect {
|
||||
it.replaceAll(/${version}-(\d+)-?.*/, '$1') as Integer
|
||||
}.sort().reverse()[0]
|
||||
|
||||
final nextIndex =((currentIndex ?: 0) as Integer) + 1
|
||||
|
||||
return "${version}-${nextIndex}"
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger build of the certified image at Red Hat,
|
||||
* @param nextTag the full version tag to be assigned to the new build
|
||||
* @return the map from json with the status of the submitted build
|
||||
*/
|
||||
private Map build(String nextTag) {
|
||||
return builder.post {
|
||||
request.uri.path = "/api/v2/projects/${projectId}/build"
|
||||
request.body = [tag: nextTag]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll for the completed (built and scanned) build at Red Hat build service.
|
||||
* @param nextTag the full version tag assigned to the new build
|
||||
* @return the map from json with info about the completed build
|
||||
*/
|
||||
private Map getCompletedBuild(String nextTag) {
|
||||
final endTime = calcCutoffTime(System.currentTimeMillis(), TIMEOUT_MINUTES)
|
||||
|
||||
while (System.currentTimeMillis() < endTime) {
|
||||
println 'Waiting for build to finish.'
|
||||
sleep 60000
|
||||
|
||||
try {
|
||||
final completedBuild = getTags().find {
|
||||
it.name == nextTag && it.scan_status == 'passed'
|
||||
}
|
||||
|
||||
if (completedBuild) {
|
||||
return completedBuild
|
||||
}
|
||||
} catch (HttpException ex) {
|
||||
ex.printStackTrace()
|
||||
System.err.println "Failed retrieving completed builds, but still trying: ${ex.statusCode} [${ex.body}]"
|
||||
}
|
||||
}
|
||||
|
||||
return [failure: "TIMEOUT waiting for complete build: ${TIMEOUT_MINUTES} minutes"]
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger publishing of the new image at Red Hat build service.
|
||||
* @param digest hash string that identifies the container to publish
|
||||
* @param name tag name (version) of the container image to publish
|
||||
* @return the map from json with status of the published container image
|
||||
*/
|
||||
private Map publish(String digest, String name) {
|
||||
final publishPath = [
|
||||
'/api/v2/projects',
|
||||
projectId,
|
||||
'containers',
|
||||
digest,
|
||||
'tags',
|
||||
name,
|
||||
'publish'
|
||||
].join('/')
|
||||
|
||||
try {
|
||||
return builder.post {
|
||||
request.uri.path = publishPath
|
||||
}
|
||||
} catch (HttpException ex) {
|
||||
ex.printStackTrace()
|
||||
return [failure: "Failed to publish: ${ex.statusCode} [${ex.body}]"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
version: "2"
|
||||
|
||||
services:
|
||||
nexus:
|
||||
image: sonatype/nexus3
|
||||
volumes:
|
||||
- "nexus-data:/nexus-data"
|
||||
ports:
|
||||
- "8081:8081"
|
||||
|
||||
volumes:
|
||||
nexus-data: {}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2016-present Sonatype, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
<%=
|
||||
require 'json'
|
||||
|
||||
raise RuntimeError, 'environment variable DOCKER_TYPE is required' if ENV['DOCKER_TYPE'].nil? || ENV['DOCKER_TYPE'].empty?
|
||||
raise RuntimeError, 'environment variable SONATYPE_DIR is required' if ENV['SONATYPE_DIR'].nil? || ENV['SONATYPE_DIR'].empty?
|
||||
raise RuntimeError, 'environment variable NEXUS_HOME is required' if ENV['NEXUS_HOME'].nil? || ENV['NEXUS_HOME'].empty?
|
||||
raise RuntimeError, 'environment variable NEXUS_DATA is required' if ENV['NEXUS_DATA'].nil? || ENV['NEXUS_DATA'].empty?
|
||||
|
||||
{
|
||||
:run_list => [ "recipe[nexus_repository_manager::#{ENV['DOCKER_TYPE']}]" ],
|
||||
:java => {
|
||||
:install_flavor => 'openjdk',
|
||||
:accept_license_agreement => true
|
||||
},
|
||||
:nexus_repository_manager => {
|
||||
:version => ENV['NEXUS_VERSION'],
|
||||
:nexus_download_url => ENV['NEXUS_DOWNLOAD_URL'],
|
||||
:nexus_download_sha256 => ENV['NEXUS_DOWNLOAD_SHA256_HASH'],
|
||||
:sonatype => {
|
||||
:path => ENV['SONATYPE_DIR'],
|
||||
},
|
||||
:sonatype_work => {
|
||||
:path => ENV['SONATYPE_DIR'] + '/sonatype-work'
|
||||
},
|
||||
:nexus_home => {
|
||||
:path => ENV['SONATYPE_DIR'] + '/nexus'
|
||||
},
|
||||
:nexus_data => {
|
||||
:path => ENV['NEXUS_DATA']
|
||||
},
|
||||
:properties => {
|
||||
# Set the context_path to the NEXUS_CONTEXT environment variable
|
||||
# that may be passed into the docker run command.
|
||||
:context_path => "/${NEXUS_CONTEXT}"
|
||||
}
|
||||
}
|
||||
}.to_json
|
||||
%>
|
||||
@@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2016-present Sonatype, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
require "serverspec"
|
||||
require "docker"
|
||||
|
||||
describe 'Dockerfile' do
|
||||
before(:all) do
|
||||
Docker.options[:read_timeout] = 900
|
||||
@image = Docker::Image.get(ENV['IMAGE_ID'])
|
||||
|
||||
set :os, family: :redhat
|
||||
set :backend, :docker
|
||||
set :docker_image, @image.id
|
||||
end
|
||||
|
||||
it 'should remove solo.json during cleanup' do
|
||||
expect(File).not_to exist('/var/chef/solo.json')
|
||||
end
|
||||
|
||||
it 'should not have a chef package installed' do
|
||||
expect(package('chef')).not_to be_installed
|
||||
end
|
||||
|
||||
it 'should have a user named nexus' do
|
||||
expect(user('nexus')).to exist
|
||||
end
|
||||
|
||||
it 'should have a nexus process running' do
|
||||
expect(process('java')).to be_running
|
||||
expect(process('java')).to have_attributes(:user => 'nexus')
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user