From 5af27071db211de4d44474763b94faf2ea2935f7 Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Fri, 2 Jun 2017 21:10:12 +0100 Subject: [PATCH] upgrade to nexus 3.3.1-01 --- provision/nexus-groovy.sh | 2 +- provision/provision-nexus/README.md | 2 +- provision/provision-nexus/pom.xml | 2 +- provision/provision-nexus/provision-nexus.iml | 131 +++++++++--------- .../src/main/groovy/provision.groovy | 12 +- provision/provision.sh | 18 +-- provision/summary.sh | 2 +- provision/test.sh | 6 +- 8 files changed, 86 insertions(+), 89 deletions(-) diff --git a/provision/nexus-groovy.sh b/provision/nexus-groovy.sh index f124e83..3832f3b 100644 --- a/provision/nexus-groovy.sh +++ b/provision/nexus-groovy.sh @@ -4,7 +4,7 @@ set -eux admin_username=${admin_username:-admin} admin_password=${admin_password:-admin123} -# see https://books.sonatype.com/nexus-book/3.0/reference/scripting.html +# see https://books.sonatype.com/nexus-book/3.3/reference/scripting.html function nexus-groovy { local source_filename="/vagrant/provision/provision-nexus/src/main/groovy/$1.groovy" diff --git a/provision/provision-nexus/README.md b/provision/provision-nexus/README.md index 7736997..fc13b43 100644 --- a/provision/provision-nexus/README.md +++ b/provision/provision-nexus/README.md @@ -5,7 +5,7 @@ Inside IDEA you can browse the sources with `control+left-click` to see which me To execute the `src/main/groovy/provision.groovy` file inside the Vagrant environment run `bash /vagrant/execute-provision.groovy-script.sh`. -For more information see the Nexus [scripting documentation](https://books.sonatype.com/nexus-book/3.0/reference/scripting.html) and [examples](https://github.com/sonatype/nexus-book-examples/tree/nexus-3.0.x/scripting). +For more information see the Nexus [scripting documentation](https://books.sonatype.com/nexus-book/3.3/reference/scripting.html) and [examples](https://github.com/sonatype/nexus-book-examples/tree/nexus-3.x/scripting). # Source Code diff --git a/provision/provision-nexus/pom.xml b/provision/provision-nexus/pom.xml index 76ed475..ea9e512 100644 --- a/provision/provision-nexus/pom.xml +++ b/provision/provision-nexus/pom.xml @@ -8,7 +8,7 @@ 1.0-SNAPSHOT - 3.1.0-04 + 3.3.1-01 diff --git a/provision/provision-nexus/provision-nexus.iml b/provision/provision-nexus/provision-nexus.iml index 868636e..d5e69d3 100644 --- a/provision/provision-nexus/provision-nexus.iml +++ b/provision/provision-nexus/provision-nexus.iml @@ -1,6 +1,6 @@ - + @@ -8,43 +8,42 @@ - - + + - - - - + + + + - + - - - + + + - - + - - + + - + - - - - + + + + @@ -53,16 +52,15 @@ - - - - - - + + + + + + - - - + + @@ -72,54 +70,53 @@ - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - + + - - - - - - - - - - + + + + + + + - - - - + + + + + - + - + - + - + - + + @@ -128,7 +125,7 @@ - - + + \ No newline at end of file diff --git a/provision/provision-nexus/src/main/groovy/provision.groovy b/provision/provision-nexus/src/main/groovy/provision.groovy index 8f6a0cc..33bfc15 100644 --- a/provision/provision-nexus/src/main/groovy/provision.groovy +++ b/provision/provision-nexus/src/main/groovy/provision.groovy @@ -1,6 +1,6 @@ // run this file inside the Vagrant environment with bash /vagrant/execute-provision.groovy-script.sh -// see https://books.sonatype.com/nexus-book/3.0/reference/scripting.html -// see https://github.com/sonatype/nexus-book-examples/tree/nexus-3.0.x/scripting/nexus-script-example +// see https://books.sonatype.com/nexus-book/3.3/reference/scripting.html +// see https://github.com/sonatype/nexus-book-examples/tree/nexus-3.x/scripting/nexus-script-example import groovy.json.JsonOutput import org.sonatype.nexus.security.user.UserSearchCriteria @@ -11,8 +11,8 @@ import org.sonatype.nexus.scheduling.TaskScheduler import org.sonatype.nexus.scheduling.schedule.Daily // create a raw repository backed by the default blob store. -// see https://github.com/sonatype/nexus-book-examples/blob/nexus-3.0.x/scripting/complex-script/rawRepositories.groovy -// see https://books.sonatype.com/nexus-book/3.0/reference/raw.html#_uploading_files_to_hosted_raw_repositories +// see https://github.com/sonatype/nexus-book-examples/blob/nexus-3.x/scripting/complex-script/rawRepositories.groovy +// see https://books.sonatype.com/nexus-book/3.3/reference/raw.html#_uploading_files_to_hosted_raw_repositories repository.createRawHosted("adhoc-package", "default") @@ -39,7 +39,7 @@ jenkinsPassword = random((('A'..'Z')+('a'..'z')+('0'..'9')).join(), 16) // set the base url. this is used when sending emails. -// see https://books.sonatype.com/nexus-book/3.0/reference/admin.html#admin-base-url +// see https://books.sonatype.com/nexus-book/3.3/reference/admin.html#admin-base-url core.baseUrl("https://" + java.net.InetAddress.getLocalHost().getCanonicalHostName()) @@ -81,7 +81,7 @@ def getOrCreateNuGetApiKey(String userName) { // create users in the deployer role. -// see https://github.com/sonatype/nexus-book-examples/blob/nexus-3.0.x/scripting/complex-script/security.groovy#L38 +// see https://github.com/sonatype/nexus-book-examples/blob/nexus-3.x/scripting/complex-script/security.groovy#L38 def addDeployerUser(firstName, lastName, email, userName, password) { if (!security.securitySystem.listRoles().any { it.getRoleId() == "deployer" }) { privileges = [ diff --git a/provision/provision.sh b/provision/provision.sh index 7ffce07..7d313ea 100644 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -51,7 +51,7 @@ popd # install and configure nginx to proxy to nexus. -# see https://books.sonatype.com/nexus-book/3.0/reference/install.html#reverse-proxy +# see https://books.sonatype.com/nexus-book/3.3/reference/install.html#reverse-proxy apt-get install -y --no-install-recommends nginx rm -f /etc/nginx/sites-enabled/default cat >/etc/nginx/sites-available/$config_fqdn.conf <nexus3/etc/nexus.properties +sed -i -E 's,(application-host=).+,\1127.0.0.1,g' nexus3/etc/nexus.properties +sed -i -E 's,nexus-pro-,nexus-oss-,g' nexus3/etc/nexus.properties +diff -u etc/nexus-default.properties nexus3/etc/nexus.properties || true sed -i -E 's,\.\./sonatype-work/,,g' bin/nexus.vmoptions popd diff --git a/provision/summary.sh b/provision/summary.sh index 9831b37..203f76e 100644 --- a/provision/summary.sh +++ b/provision/summary.sh @@ -14,5 +14,5 @@ use the admin/admin123 credentials to login. the logs are at: - /opt/nexus/data/log/ + /opt/nexus/nexus3/log/ EOF diff --git a/provision/test.sh b/provision/test.sh index d65a21a..c87a22e 100644 --- a/provision/test.sh +++ b/provision/test.sh @@ -7,7 +7,7 @@ mkdir -p tmp && cd tmp # # test the NuGet repository. -# see https://books.sonatype.com/nexus-book/3.0/reference/nuget.html +# see https://books.sonatype.com/nexus-book/3.3/reference/nuget.html if ! which mono; then sudo apt-get install -y mono-complete @@ -75,7 +75,7 @@ sudo apt-get install -y xmlstarlet # setup the user maven configuration to use nexus as a mirror the # official maven repository. -# see https://books.sonatype.com/nexus-book/3.0/reference/maven.html +# see https://books.sonatype.com/nexus-book/3.3/reference/maven.html # see https://maven.apache.org/guides/mini/guide-mirror-settings.html mkdir -p ~/.m2 cat >~/.m2/settings.xml <<'EOF' @@ -167,7 +167,7 @@ popd apt-get install -y curl # upload. -# see https://books.sonatype.com/nexus-book/3.0/reference/raw.html#_uploading_files_to_hosted_raw_repositories +# see https://books.sonatype.com/nexus-book/3.3/reference/raw.html#_uploading_files_to_hosted_raw_repositories expected='this is an adhoc package' echo "$expected" >package-1.0.0.txt curl --silent --user 'alice.doe:password' --upload-file package-1.0.0.txt http://localhost:8081/repository/adhoc-package/package-1.0.0.txt