Публикация NPM в направлении Nexus (Sonartype) прерывается с 500 с перерывами, иногда повторные попытки работают
Я пытаюсь опубликовать встроенный пакет NPM для Nexus, используя npm publish
Недавно он начал терпеть неудачу и повторить с 500 ошибками много!
Я запускаю Nexus в док-контейнере и пытался снять и снова, пару раз безрезультатно...
========== Deploying to Nexus at http://10.224.199.245:8081 ==========
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.5.0
25hnpm info lifecycle my-client@0.1.0-RELEASE~prepublish: my-client@0.1.0-RELEASE
npm info lifecycle my-client@0.1.0-RELEASE~prepare: my-client@0.1.0-RELEASE
npm info lifecycle my-client@0.1.0-RELEASE~prepublishOnly: my-client@0.1.0-RELEASE
npm info lifecycle my-client@0.1.0-RELEASE~prepack: my-client@0.1.0-RELEASE
25hnpm info lifecycle my-client@0.1.0-RELEASE~postpack: my-client@0.1.0-RELEASE
25hnpm info attempt registry request try #1 at 14:38:53
npm http request PUT http://10.224.199.245:8081/repository/npm-releases/my-client
25hnpm http 500 http://10.224.199.245:8081/repository/npm-releases/my-client
npm info retry will retry, error on last attempt: Error: 500 Internal Server Error
25hnpm info attempt registry request try #2 at 14:39:12
npm http request PUT http://10.224.199.245:8081/repository/npm-releases/my-client
25hnpm http 500 http://10.224.199.245:8081/repository/npm-releases/my-client
npm info retry will retry, error on last attempt: Error: 500 Internal Server Error
25hnpm info attempt registry request try #3 at 14:40:21
npm http request PUT http://10.224.199.245:8081/repository/npm-releases/my-client
25hnpm http 500 http://10.224.199.245:8081/repository/npm-releases/my-client
npm ERR! publish Failed PUT 500
npm ERR! code E500
npm ERR! 500 Internal Server Error
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-09-18T14_40_28_951Z-debug.log
Скрипт полной версии выглядит так:
#!/bin/bash
#************************************************#
# #
# Written by David Karlsson #
# February 23, 2017 #
# #
# Upload Built JS Dist #
# to #
# NPM-Repository/Nexus #
# #
# 1. version #
# 2. Nexus URL #
# 3. repository name #
# Repo is created if it does not exist. #
# #
#************************************************#
if [-z "${NEXUS_USER}"] or [-z "${NEXUS_PASS}"]
then
echo "⚠️ NEXUS_USER and NEXUS_PASS required as env variables! ⚠️"
exit 1
fi
printf "\n========== %s ==========\n\n" "Nexus Deploy"
PACKAGE_PATH=$1
VERSION=$2
NEXUS_URL=$3
NEXUS_HASH=$(echo -n "${NEXUS_USER}:${NEXUS_PASS}" | openssl base64)
REPO_NAME="npm-releases"
npm_release_config()
{
printf "\n========== %s ==========\n\n" "Setting up ${PACKAGE_PATH}/.npmrc for nexus deployments"
cat <<EOF > ${PACKAGE_PATH}/.npmrc
init.author.name = myCard
init.author.email = digital@mycard.com
init.author.url = ci.mycard.com
email=digital@mycard.com
always-auth=true
EOF
cat ${PACKAGE_PATH}/.npmrc
echo " Setting up authentication..."
echo "_auth=${NEXUS_HASH}" >> ${PACKAGE_PATH}/.npmrc
}
npm_release()
{
if [[ "$VERSION" =~ "RELEASE" ]]; then
printf "\n\n========== %s ==========\n\n" " Deploying ${FILE} to Nexus at ${NEXUS_URL} "
npm publish --registry ${NEXUS_URL}/repository/${REPO_NAME}
else
printf "⛔️ Found no RELEASE version in package.json, found %s... Not deploying to nexus" ${VERSION}
fi
}
npm_repo_json()
{
cat <<EOF
{
"name": "${REPO_NAME}",
"type": "groovy",
"content": "repository.createNpmHosted('npm-releases')"
}
EOF
}
printf "\n========== %s ==========\n\n" "Verify NPM Repository in Nexus"
#List repos
list=$(curl -sb -X GET -u admin:admin123 "${NEXUS_URL}/service/siesta/rest/v1/script")
if [[ $list == *"${REPO_NAME}"* ]]; then
printf "\n⛔️ Skipping nexus add ${REPO_NAME}, the repository already exists: \n\n %s" "$list"
else
#Create repo
curl -v -X POST -u admin:admin123 --header "Content-Type: application/json" "${NEXUS_URL}/service/siesta/rest/v1/script" --data "$(npm_repo_json)"
#Activate repo
curl -v -X POST -u admin:admin123 --header "Content-Type: text/plain" "${NEXUS_URL}/service/siesta/rest/v1/script/${REPO_NAME}/run"
printf "\n✅ ${REPO_NAME} has been added to nexus... \n\n"
fi
cd $PACKAGE_PATH
npm_release_config
npm_release
Репо создается успешно, но доставка пакета, по-видимому, не удалась... предоставленный хэш - это просто хешированный admin:admin123 deal...
Кто-нибудь имеет опыт работы с этими 500 ошибками от Nexus?
Кажется, я не могу найти что-либо связанное в журналах Nexus, он, кажется, вообще ничего не регистрирует, даже когда все регистраторы настроены на отладку.
У меня нет (обратные прокси и т. Д.) Между сервером сборки и нексусом, Nexus работает в VirtualBox с использованием Docker (OSX), работник сервера сборки, выполняющий задачу, находится на машине с Linux.
Полный журнал от NPM:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'publish',
1 verbose cli '--registry',
1 verbose cli 'http://10.224.199.245:8081/repository/npm-releases' ]
2 info using npm@5.3.0
3 info using node@v8.5.0
4 verbose npm-session 434c83163fc406c7
5 verbose publish [ '.' ]
6 info lifecycle my-client@0.1.0-RELEASE~prepublish: my-client@0.1.0-RELEASE
7 info lifecycle my-client@0.1.0-RELEASE~prepare: my-client@0.1.0-RELEASE
8 info lifecycle my-client@0.1.0-RELEASE~prepublishOnly: my-client@0.1.0-RELEASE
9 info lifecycle my-client@0.1.0-RELEASE~prepack: my-client@0.1.0-RELEASE
10 verbose tar pack [ '/tmp/npm-1414-8068d70f/tmp/packing-162c6221/package.tgz',
10 verbose tar pack '.' ]
11 verbose tarball /tmp/npm-1414-8068d70f/tmp/packing-162c6221/package.tgz
12 verbose folder .
13 info lifecycle my-client@0.1.0-RELEASE~postpack: my-client@0.1.0-RELEASE
14 verbose getPublishConfig undefined
15 silly mapToRegistry name my-client
16 silly mapToRegistry using default registry
17 silly mapToRegistry registry http://10.224.199.245:8081/repository/npm-releases
18 silly mapToRegistry data { type: 'tag',
18 silly mapToRegistry registry: true,
18 silly mapToRegistry where: undefined,
18 silly mapToRegistry raw: 'my-client',
18 silly mapToRegistry name: 'my-client',
18 silly mapToRegistry escapedName: 'my-client',
18 silly mapToRegistry scope: undefined,
18 silly mapToRegistry rawSpec: '',
18 silly mapToRegistry saveSpec: null,
18 silly mapToRegistry fetchSpec: 'latest',
18 silly mapToRegistry gitRange: undefined,
18 silly mapToRegistry gitCommittish: undefined,
18 silly mapToRegistry hosted: undefined }
19 silly mapToRegistry uri http://10.224.199.245:8081/repository/npm-releases/my-client
20 verbose publish registryBase http://10.224.199.245:8081/repository/npm-releases/
21 silly publish uploading /tmp/npm-1414-8068d70f/tmp/fromDir-3c2c7d43/package.tgz
22 verbose request uri http://10.224.199.245:8081/repository/npm-releases/my-client
23 verbose request always-auth set; sending authorization
24 info attempt registry request try #1 at 07:54:10
25 verbose request id 66b01d48fe79df18
26 http request PUT http://10.224.199.245:8081/repository/npm-releases/my-client
27 http 500 http://10.224.199.245:8081/repository/npm-releases/my-client
28 verbose headers { date: 'Tue, 19 Sep 2017 07:54:12 GMT',
28 verbose headers server: 'Nexus/3.1.0-04 (OSS)',
28 verbose headers 'x-frame-options': 'SAMEORIGIN',
28 verbose headers 'x-content-type-options': 'nosniff',
28 verbose headers 'content-length': '0' }
29 info retry will retry, error on last attempt: Error: 500 Internal Server Error
30 info attempt registry request try #2 at 07:54:28
31 http request PUT http://10.224.199.245:8081/repository/npm-releases/my-client
32 http 500 http://10.224.199.245:8081/repository/npm-releases/my-client
33 verbose headers { date: 'Tue, 19 Sep 2017 07:54:30 GMT',
33 verbose headers server: 'Nexus/3.1.0-04 (OSS)',
33 verbose headers 'x-frame-options': 'SAMEORIGIN',
33 verbose headers 'x-content-type-options': 'nosniff',
33 verbose headers 'content-length': '0' }
34 info retry will retry, error on last attempt: Error: 500 Internal Server Error