Skip to content

Commit bcc1bb9

Browse files
committed
OSSRH and Sonatype Nexus have been sunset
- Add script for interacting with the compatibility service API. - Update BUILD_INFO with new process.
1 parent a2c85e5 commit bcc1bb9

File tree

2 files changed

+85
-15
lines changed

2 files changed

+85
-15
lines changed

BUILD_INFO.md

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ part.
150150

151151
*Note:* deploying a release requires to have GPG keys: create them if necessary before producing a release
152152
and publish your public key on one GPG key server (they are all synchronised, see
153-
http://central.sonatype.org/pages/working-with-pgp-signatures.html#distributing-your-public-key) and wait for
153+
https://central.sonatype.org/publish/requirements/gpg/#distributing-your-public-key) and wait for
154154
your key to be present on http://pgp.mit.edu:11371. Also, as for any `gpg` command,
155155
you need to have a running `gpg-agent`. It also requires that you have the appropriate Maven configuration
156156
in `~/.m2/settings.xml` (see below).
@@ -164,7 +164,7 @@ it is a good practice to deploy a snapshot. This is done with the `deploy` phase
164164
as specified at the beginning of this document).
165165
To deploy a snapshot rather than a release, check that the artifact version in the pom file ends with -SNAPSHOT,
166166
before running the deploy phase. This allows the
167-
basic configuration to be checked for correctness (in particular the parameters used to upload to Sonatype Nexus).
167+
basic configuration to be checked for correctness (in particular the parameters used to upload to the central repository).
168168

169169
### Build release and push to nexus
170170

@@ -192,24 +192,49 @@ an up-to-date version of `template-library-core` repository (required by tests).
192192

193193
### Promoting from staging to release
194194

195-
1. After successfully executing `release:perform`, the new release will be in a staging area on Sonatype nexus server
196-
(https://oss.sonatype.org). Before the release can be used, you must log in to the nexus server, close the staging
197-
area and ask for the staging area being released.
195+
1. After successfully executing `release:perform`, the new release will be held in the Portal OSSRH Staging API compatibility service.
196+
Before the release can be used, you must make an API call to transfer the deployment from the compatibility service to the main Central Publisher Portal area.
197+
198+
1. Call `./ossrh-staging-api search` to verify that the new release exists, you should see something similar to the following:
199+
```json
200+
{
201+
"repositories": [
202+
{
203+
"key": "ABCdef/198.51.100.119/org.quattor--default-repository",
204+
"state": "open",
205+
"description": null,
206+
"portal_deployment_id": null
207+
}
208+
]
209+
}
198210

199-
1. Select `Staging Repositories` in the left side menu (appearing
200-
after you logged in) and search for [org.quattor.maven](https://oss.sonatype.org/#nexus-search;quick~org.quattor.maven).
211+
```
212+
213+
1. Call `./ossrh-staging-api upload` to request transfer of all open repositories to the Central Publisher Portal.
214+
215+
1. Call `./ossrh-staging-api search` again to verify that the new release has been closed:
216+
```json
217+
{
218+
"repositories": [
219+
{
220+
"key": "ABCdef/198.51.100.119/org.quattor--default-repository",
221+
"state": "closed",
222+
"description": null,
223+
"portal_deployment_id": "6d9f74b9-ac49-487d-9bc3-7b8e448eb4fa"
224+
}
225+
]
226+
}
227+
```
201228

202-
1. Select the appropriate repository (you may have several if you did several attempts from different machines) and close it.
229+
1. If successful go to https://central.sonatype.com/publishing/deployments and wait for the release to appear and pass validation. Once it does, press the "Publish" button to release it to Maven Central.
203230

204-
1. When the operation is successful (click on `Refresh`), click on the `Release` button. Once successfully released, you may have to wait a couple of hours before the release appears on the [Maven Central Repository](http://search.maven.org/#search%7Cga%7C1%7Corg.quattor.maven).
205231

206232
### Additional notes
207233

208234
* If something went wrong during `release:perform` (which pushes the release to the staging area), it is sometimes necessary to drop the staging directory after closing it to be able to run `release:perform` again (particularly if it complains that the packages are already present in the repository).
209-
* A good documentation of the staging process can be found at http://books.sonatype.com/nexus-book/reference/staging-repositories.html
210-
* Detailed information on using Maven to deploy releases at Sonatype is available at http://central.sonatype.org/pages/apache-maven.html.
235+
* Documentation of the staging process can be found at https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/
211236

212-
* If when the release becomes available on http://search.maven.org Maven complains that it cannot find the new release, add the `-U` option to the Maven command line. The execution of Maven may still result in an error but the local repository should be updated allowing the next execution of Maven to work.
237+
* If when the release becomes available on https://central.sonatype.com/ Maven complains that it cannot find the new release, add the `-U` option to the Maven command line. The execution of Maven may still result in an error but the local repository should be updated allowing the next execution of Maven to work.
213238

214239
* If you really want to cancel the release process after doing `release:prepare` but before doing `release:perform` (it is preferable to fix the problem and rerun `release:prepare`), you need to issue the appropriate commands depending on whether `release:prepare` added some commits to the upstream branch whose commit message starts with `[maven-release-plugin]`:
215240

@@ -231,7 +256,7 @@ after you logged in) and search for [org.quattor.maven](https://oss.sonatype.org
231256
Connect to GitHub and delete the new tag if it has been created
232257
```
233258
234-
* **Note: after a first execution of `release:perform` which pushed things to Sonatype Central Repository, it is not recommended that you attempt to revert a failed release. If the problems with the release in progress cannot be fixed, simply start a new release.**
259+
* **Note: after a first execution of `release:perform` which pushed things to the Central Repository, it is not recommended that you attempt to revert a failed release. If the problems with the release in progress cannot be fixed, simply start a new release.**
235260
236261
Recommended Maven configuration
237262
-------------------------------
@@ -269,5 +294,5 @@ Below is a typical Maven configuration file (`~/.m2/settings.xml`) to be able to
269294
</settings>
270295
```
271296
272-
In the above example `your_userid` and the password refer to your account at http://sonatype.org.
273-
To get an account at Sonatype, follow the instructions at http://central.sonatype.org/pages/ossrh-guide.html.
297+
In the above example `your_userid` and the password refer to your account at https://identity.sonatype.com.
298+
To get an account, follow the instructions at https://central.sonatype.org/register/central-portal/#create-an-account

ossrh-staging-api

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
# vim: noai:et:ts=4:sw=4
3+
4+
SETTINGS="$HOME/.m2/settings.xml"
5+
SERVPATH="/settings/servers/server[id='sonatype-nexus-staging']"
6+
7+
if [[ $# -ne 1 || ! "$1" =~ ^(search|upload)$ ]]; then
8+
echo "Usage: ossrh-staging-api [search | upload]"
9+
exit 2
10+
fi
11+
12+
action="$1"
13+
14+
if [[ ! -s "$SETTINGS" ]]; then
15+
echo "Couldn't find $SETTINGS, cannot continue."
16+
exit 1
17+
fi
18+
19+
for util in curl jq xmllint; do
20+
if ! which $util > /dev/null 2>&1; then
21+
echo "Required utility $util not found"
22+
exit 1
23+
fi
24+
done
25+
26+
user="$(xmllint --xpath "string($SERVPATH/username)" "$SETTINGS")"
27+
pass="$(xmllint --xpath "string($SERVPATH/password)" "$SETTINGS")"
28+
auth="Bearer $(base64 <(printf "%s:%s" "$user" "$pass"))"
29+
30+
function api {
31+
curl \
32+
--silent \
33+
--request "$1" \
34+
--header @<( echo "Authorization: $auth") \
35+
https://ossrh-staging-api.central.sonatype.com/$2
36+
}
37+
38+
case "$action" in
39+
"search")
40+
api 'GET' 'manual/search/repositories?ip=any&profile_id=org.quattor' | jq .
41+
;;
42+
"upload")
43+
api 'POST' 'manual/upload/defaultRepository/org.quattor' | jq .
44+
;;
45+
esac

0 commit comments

Comments
 (0)