pact-foundation / pact_broker-client

A Ruby and CLI client for the Pact Broker. Publish and retrieve pacts and verification results.
MIT License
69 stars 45 forks source link

npx pact-broker not found today 2024-07-19 when previously stable #167

Closed gigamac closed 2 months ago

gigamac commented 2 months ago

Hi,

I am seeing this in a pipeline job for unit tests today, when it has ben a stable job for a number of months: npm ERR! 404 Not Found - GET https://registry.npmjs.org/pact-broker - Not found

this is both running against an internal artifactory repo, and against the node registry (as above) I also tried this independently in my own gitlab.com pipeline tat i use for debugsings. package json:

devDependencies”: {
    “@pact-foundation/pact”: “^13.1.1”,

yml:

pact-broker:
  stage: test
  rules:
    - if: ‘$CI_PIPELINE_SOURCE != “merge_request_event”’
    - if: ‘$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH’
  script:
    - echo “npm try install pact-broker”
    - npx -y -p @pact-foundation/pact pact-broker publish $CI_PROJECT_DIR/pact/pacts/ --consumer-app-version $CI_COMMIT_SHA --branch --$CI_COMMIT_REF_NAME -broker-base-url https://irrelevant.com
Running with gitlab-runner 17.0.0~pre.88.g761ae5dd (761ae5dd)
  on green-5.saas-linux-small-amd64.runners-manager.gitlab.com/default xS6Vzpvo, system ID: s_6b1e4f06fcfd
Preparing the "docker+machine" executor 00:22
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:351ef002cf01a20241a0912095171487e430a4829f092ac24fb576d19ebe39d7 for node:latest with digest node@sha256:b44cbfafe84144217b7502cde5d21958500781fb9b13eed74a47486db2277cd5 ...
Preparing environment 00:06
Running on runner-xs6vzpvo-project-45309394-concurrent-0 via runner-xs6vzpvo-s-l-s-amd64-1721395303-edca0464...
Getting source from Git repository 00:01
Fetching changes...
Initialized empty Git repository in /builds/clickclickgo/project101/.git/
Created fresh repository.
Checking out 97920fbb as detached HEAD (ref is release-job)...
Skipping Git submodules setup
$ git remote set-url origin "${CI_REPOSITORY_URL}"
Restoring cache 00:02
Checking cache for release-job-non_protected...
Downloading cache from https://storage.googleapis.com/gitlab-com-runners-cache/project/45309394/release-job-non_protected 
Successfully extracted cache
Downloading artifacts 00:01
Downloading artifacts for build (7383587236)...
Downloading artifacts from coordinator... ok        host=storage.googleapis.com id=7383587236 responseStatus=200 OK token=glcbt-66
Executing "step_script" stage of the job script 00:09
Using docker image sha256:351ef002cf01a20241a0912095171487e430a4829f092ac24fb576d19ebe39d7 for node:latest with digest node@sha256:b44cbfafe84144217b7502cde5d21958500781fb9b13eed74a47486db2277cd5 ...
$ npm ci --cache .npm --prefer-offline
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated read-pkg-up@11.0.0: Renamed to read-package-up
npm warn deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error   <https://github.com/npm/cli/issues>
npm error A complete log of this run can be found in: /builds/clickclickgo/project101/.npm/_logs/2024-07-19T13_22_57_186Z-debug-0.log
$ { # collapsed multi-line command
@clickclickgo:registry=https://gitlab.com/api/v4/projects/45309394/packages/npm/
//gitlab.com/api/v4/projects/45309394/packages/npm/:_authToken=${CI_JOB_TOKEN}
$ echo "CI_COMMIT_BRANCH = ${CI_COMMIT_BRANCH}"
CI_COMMIT_BRANCH = release-job
$ echo "CI_PIPELINE_SOURCE = ${CI_PIPELINE_SOURCE}"
CI_PIPELINE_SOURCE = push
$ echo "CI_COMMIT_TAG = ${CI_COMMIT_TAG}"
CI_COMMIT_TAG = 
$ echo "TAG = ${TAG}"
TAG = 
$ echo "npm try install pact-broker"
npm try install pact-broker
$ npx pact-broker publish $CI_PROJECT_DIR/pact/pacts/ --consumer-app-version $CI_COMMIT_SUA --branch --CI_COMMIT_REF_NAME -broker-base-url https://docs.gitlab.com/ee/ci/yaml/
npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/pact-broker - Not found
npm error 404
npm error 404  'pact-broker@*' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: /root/.npm/_logs/2024-07-19T13_23_02_461Z-debug-0.log
Running after_script 00:01
Running after script...
$ echo "===== AFTER SCRIPT ====="
===== AFTER SCRIPT =====
$ echo "CI_COMMIT_BRANCH = ${CI_COMMIT_BRANCH}"
CI_COMMIT_BRANCH = release-job
$ echo "CI_DEFAULT_BRANCH = ${CI_DEFAULT_BRANCH}"
CI_DEFAULT_BRANCH = main
$ echo "CI_PIPELINE_SOURCE = ${CI_PIPELINE_SOURCE}"
CI_PIPELINE_SOURCE = push
$ echo "CI_COMMIT_TAG = ${CI_COMMIT_TAG}"
CI_COMMIT_TAG = 
$ echo "TAG = ${TAG}"
TAG = 
$ echo "CI_COMMIT_MESSAGE = ${CI_COMMIT_MESSAGE}"
CI_COMMIT_MESSAGE = test: does pact broker install
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit code 1
gigamac commented 2 months ago

Switch to pact-cli has resolved this, but what has actually happened,?

YOU54F commented 2 months ago

the cli tools were removed in pact-js 13.x and migrated into pact-cli. breaking changes noted in release notes

https://github.com/pact-foundation/pact-js/releases/tag/v13.0.0

gigamac commented 2 months ago

thanks - not sure why but the same command in gitlab using pact-foundation/pact is working today, but clearly we should be using pact-cli - much appreciated

YOU54F commented 1 month ago

Yeah that is a bit odd, maybe there was some caching involved., sorry it impacted you!

I noticed this error

$ npm ci --cache .npm --prefer-offline
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated read-pkg-up@11.0.0: Renamed to read-package-up
npm warn deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error   <https://github.com/npm/cli/issues>
npm error A complete log of this run can be found in: /builds/clickclickgo/project101/.npm/_logs/2024-07-19T13_22_57_186Z-debug-0.log

which actually prevents npm install from completing and was fixed in the latest 22.4.x of node. there was a bug in 22.4.0 or 1 from memory