Skip to content

Commit

Permalink
Merge pull request #21 from sonatype/main
Browse files Browse the repository at this point in the history
[pull] main from sonatype:main
  • Loading branch information
madpah authored Sep 5, 2024
2 parents 0d4a374 + d65fb8b commit d62b15e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 54 deletions.
8 changes: 4 additions & 4 deletions Dockerfile.alpine.java17
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ FROM alpine
LABEL name="Nexus Repository Manager" \
maintainer="Sonatype <support@sonatype.com>" \
vendor=Sonatype \
version="3.71.0-06" \
release="3.71.0" \
version="3.72.0-04" \
release="3.72.0" \
url="https://sonatype.com" \
summary="The Nexus Repository Manager server \
with universal support for popular component formats." \
Expand All @@ -36,9 +36,9 @@ LABEL name="Nexus Repository Manager" \
io.openshift.expose-services="8081:8081" \
io.openshift.tags="Sonatype,Nexus,Repository Manager"

ARG NEXUS_VERSION=3.71.0-06
ARG NEXUS_VERSION=3.72.0-04
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
ARG NEXUS_DOWNLOAD_SHA256_HASH=b025287558184677fc231035c9f5e5e6cc4bc1cafd76d13a06233a4ed09d08f6
ARG NEXUS_DOWNLOAD_SHA256_HASH=45148c0645ab0611f6881b782b83e9dab0dbfb1b848e9b95ebaeb274c708a1c0

# configure nexus runtime
ENV SONATYPE_DIR=/opt/sonatype
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.java17
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal
LABEL name="Nexus Repository Manager" \
maintainer="Sonatype <support@sonatype.com>" \
vendor=Sonatype \
version="3.71.0-06" \
release="3.71.0" \
version="3.72.0-04" \
release="3.72.0" \
url="https://sonatype.com" \
summary="The Nexus Repository Manager server \
with universal support for popular component formats." \
Expand All @@ -36,9 +36,9 @@ LABEL name="Nexus Repository Manager" \
io.openshift.expose-services="8081:8081" \
io.openshift.tags="Sonatype,Nexus,Repository Manager"

ARG NEXUS_VERSION=3.71.0-06
ARG NEXUS_VERSION=3.72.0-04
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
ARG NEXUS_DOWNLOAD_SHA256_HASH=b025287558184677fc231035c9f5e5e6cc4bc1cafd76d13a06233a4ed09d08f6
ARG NEXUS_DOWNLOAD_SHA256_HASH=45148c0645ab0611f6881b782b83e9dab0dbfb1b848e9b95ebaeb274c708a1c0

# configure nexus runtime
ENV SONATYPE_DIR=/opt/sonatype
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.rh.ubi.java17
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal
LABEL name="Nexus Repository Manager" \
vendor=Sonatype \
maintainer="Sonatype <support@sonatype.com>" \
version="3.71.0-06" \
release="3.71.0" \
version="3.72.0-04" \
release="3.72.0" \
url="https://sonatype.com" \
summary="The Nexus Repository Manager server \
with universal support for popular component formats." \
Expand All @@ -36,9 +36,9 @@ LABEL name="Nexus Repository Manager" \
io.openshift.expose-services="8081:8081" \
io.openshift.tags="Sonatype,Nexus,Repository Manager"

ARG NEXUS_VERSION=3.71.0-06
ARG NEXUS_VERSION=3.72.0-04
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
ARG NEXUS_DOWNLOAD_SHA256_HASH=b025287558184677fc231035c9f5e5e6cc4bc1cafd76d13a06233a4ed09d08f6
ARG NEXUS_DOWNLOAD_SHA256_HASH=45148c0645ab0611f6881b782b83e9dab0dbfb1b848e9b95ebaeb274c708a1c0

# configure nexus runtime
ENV SONATYPE_DIR=/opt/sonatype
Expand Down
44 changes: 2 additions & 42 deletions Jenkinsfile-Release
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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: 'Only update the latest tag', name: 'update_latest_only')
])
Expand Down Expand Up @@ -67,12 +66,6 @@ node('ubuntu-zion') {
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 Images') {
Expand All @@ -98,22 +91,6 @@ node('ubuntu-zion') {
}
}

stage('Test') {
gitHub.statusUpdate commitId, 'pending', 'test', 'Tests are running'
validateExpectations([
new Expectation('Has user nexus in group nexus present',
'id', '-ng nexus', 'nexus'),
new Expectation('Has nexus user java process present',
'ps', '-e -o command,user | grep -q ^/usr/lib/jvm/java.*nexus$ | echo $?', '0')
])
if (currentBuild.result == 'FAILURE') {
gitHub.statusUpdate commitId, 'failure', 'test', 'Tests failed'
return
} else {
gitHub.statusUpdate commitId, 'success', 'test', 'Tests succeeded'
}
}

stage('Evaluate Policies') {
def imagesToScan = [
[name: 'docker-nexus3', image: imageName],
Expand All @@ -138,17 +115,11 @@ node('ubuntu-zion') {
return
}

if (params.nexus_repository_manager_version && params.nexus_repository_manager_version_sha
|| params.nexus_repository_manager_cookbook_version) {
if (params.nexus_repository_manager_version && params.nexus_repository_manager_version_sha) {
stage('Commit Automated Code Update') {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'jenkins-github',
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(' ')
def commitMessage = "Update Repository Manager to ${params.nexus_repository_manager_version}."

if (!params.update_latest_only) {
OsTools.runSafe(this, """
Expand All @@ -167,7 +138,6 @@ node('ubuntu-zion') {
}
}
if (branch == 'main' && !params.skip_push && !params.update_latest_only) {
input 'Push image and tags?'
stage('Push image') {
def dockerhubApiToken

Expand Down Expand Up @@ -293,16 +263,6 @@ def updateRepositoryManagerVersion(dockerFileLocation) {
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)
}

def extractBaseImage (dockerFileLocation) {
def dockerFile = readFile(file: dockerFileLocation)
def baseImageRegex = "FROM\\s+([^\\s]+)"
Expand Down

0 comments on commit d62b15e

Please sign in to comment.