From 8013cc6349ce55f0237816996f28639dc6519ebb Mon Sep 17 00:00:00 2001 From: Francesco Gringl-Novy Date: Wed, 15 Apr 2026 14:46:30 +0200 Subject: [PATCH 1/3] ci: Remove Docker container for publishing packages to Verdaccio The Dockerfile.publish-packages container only provided a pinned Node.js version for running `npm publish` of pre-built tarballs. The host already has the correct Node.js version via Volta, so the Docker build+run overhead is unnecessary. Run the publish script directly on the host instead. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/build.yml | 14 ----- .github/workflows/canary.yml | 7 --- .../e2e-tests/Dockerfile.publish-packages | 6 -- dev-packages/e2e-tests/lib/constants.ts | 1 - dev-packages/e2e-tests/registrySetup.ts | 62 +++---------------- 5 files changed, 9 insertions(+), 81 deletions(-) delete mode 100644 dev-packages/e2e-tests/Dockerfile.publish-packages diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63c44de0d68f..5f0c71d71432 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -959,11 +959,6 @@ jobs: if: steps.restore-tarball-cache.outputs.cache-hit != 'true' run: yarn build:tarball - - name: Get node version - id: versions - run: | - echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT - - name: Validate Verdaccio run: yarn test:validate working-directory: dev-packages/e2e-tests @@ -971,8 +966,6 @@ jobs: - name: Prepare Verdaccio run: yarn test:prepare working-directory: dev-packages/e2e-tests - env: - E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }} - name: Copy to temp run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application @@ -1076,11 +1069,6 @@ jobs: if: steps.restore-tarball-cache.outputs.cache-hit != 'true' run: yarn build:tarball - - name: Get node version - id: versions - run: | - echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT - - name: Validate Verdaccio run: yarn test:validate working-directory: dev-packages/e2e-tests @@ -1088,8 +1076,6 @@ jobs: - name: Prepare Verdaccio run: yarn test:prepare working-directory: dev-packages/e2e-tests - env: - E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }} - name: Copy to temp run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index f9c74b5f344f..ac4e1df08841 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -140,11 +140,6 @@ jobs: path: ${{ env.CACHED_BUILD_PATHS }} key: canary-${{ env.HEAD_COMMIT }} - - name: Get node version - id: versions - run: | - echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT - - name: Validate Verdaccio run: yarn test:validate working-directory: dev-packages/e2e-tests @@ -152,8 +147,6 @@ jobs: - name: Prepare Verdaccio run: yarn test:prepare working-directory: dev-packages/e2e-tests - env: - E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }} - name: Copy to temp run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application diff --git a/dev-packages/e2e-tests/Dockerfile.publish-packages b/dev-packages/e2e-tests/Dockerfile.publish-packages deleted file mode 100644 index 88fd7f116728..000000000000 --- a/dev-packages/e2e-tests/Dockerfile.publish-packages +++ /dev/null @@ -1,6 +0,0 @@ -# This Dockerfile exists for the purpose of using a specific node/npm version (ie. the same we use in CI) to run npm publish with -ARG NODE_VERSION=18.18.0 -FROM node:${NODE_VERSION} - -WORKDIR /sentry-javascript/dev-packages/e2e-tests -CMD [ "yarn", "ts-node", "publish-packages.ts", "--transpile-only" ] diff --git a/dev-packages/e2e-tests/lib/constants.ts b/dev-packages/e2e-tests/lib/constants.ts index bdc550009148..b5476ba4614d 100644 --- a/dev-packages/e2e-tests/lib/constants.ts +++ b/dev-packages/e2e-tests/lib/constants.ts @@ -2,4 +2,3 @@ export const TEST_REGISTRY_CONTAINER_NAME = 'verdaccio-e2e-test-registry'; export const DEFAULT_BUILD_TIMEOUT_SECONDS = 60 * 5; export const DEFAULT_TEST_TIMEOUT_SECONDS = 60 * 2; export const VERDACCIO_VERSION = '5.22.1'; -export const PUBLISH_PACKAGES_DOCKER_IMAGE_NAME = 'publish-packages'; diff --git a/dev-packages/e2e-tests/registrySetup.ts b/dev-packages/e2e-tests/registrySetup.ts index 80cbcd10d384..b51d8e34a6ed 100644 --- a/dev-packages/e2e-tests/registrySetup.ts +++ b/dev-packages/e2e-tests/registrySetup.ts @@ -1,10 +1,6 @@ /* eslint-disable no-console */ import * as childProcess from 'child_process'; -import * as path from 'path'; -import { PUBLISH_PACKAGES_DOCKER_IMAGE_NAME, TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants'; - -const publishScriptNodeVersion = process.env.E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION; -const repositoryRoot = path.resolve(__dirname, '../..'); +import { TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants'; // https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines function groupCIOutput(groupTitle: string, fn: () => void): void { @@ -45,55 +41,15 @@ export function registrySetup(): void { throw new Error('Start Registry Process failed.'); } - // Build container image that is uploading our packages to fake registry with specific Node.js/npm version - const buildPublishImageProcessResult = childProcess.spawnSync( - 'docker', - [ - 'build', - '--tag', - PUBLISH_PACKAGES_DOCKER_IMAGE_NAME, - '--file', - './Dockerfile.publish-packages', - ...(publishScriptNodeVersion ? ['--build-arg', `NODE_VERSION=${publishScriptNodeVersion}`] : []), - '.', - ], - { - encoding: 'utf8', - stdio: 'inherit', - }, - ); - - if (buildPublishImageProcessResult.status !== 0) { - throw new Error('Build Publish Image failed.'); - } - - // Run container that uploads our packages to fake registry - const publishImageContainerRunProcess = childProcess.spawnSync( - 'docker', - [ - 'run', - '--rm', - '-v', - `${repositoryRoot}:/sentry-javascript`, - '--network', - 'host', - PUBLISH_PACKAGES_DOCKER_IMAGE_NAME, - ], - { - encoding: 'utf8', - stdio: 'inherit', - }, - ); - - const statusCode = publishImageContainerRunProcess.status; + // Publish packages to fake registry + const publishResult = childProcess.spawnSync('yarn', ['ts-node', 'publish-packages.ts', '--transpile-only'], { + cwd: __dirname, + encoding: 'utf8', + stdio: 'inherit', + }); - if (statusCode !== 0) { - if (statusCode === 137) { - throw new Error( - `Publish Image Container failed with exit code ${statusCode}, possibly due to memory issues. Consider increasing the memory limit for the container.`, - ); - } - throw new Error(`Publish Image Container failed with exit code ${statusCode}`); + if (publishResult.status !== 0) { + throw new Error(`Publishing packages to test registry failed with exit code ${publishResult.status}`); } }); From a51a2aa147f629a3e2adfa202ac82f51b7c55957 Mon Sep 17 00:00:00 2001 From: Francesco Gringl-Novy Date: Wed, 15 Apr 2026 14:49:27 +0200 Subject: [PATCH 2/3] refactor: Move publish logic to lib/publishPackages.ts and call directly Extract the tarball publishing logic into an importable function in lib/publishPackages.ts and call it directly from registrySetup instead of spawning a subprocess. Remove the old publish-packages.ts script. Co-Authored-By: Claude Opus 4.6 (1M context) --- dev-packages/e2e-tests/lib/publishPackages.ts | 42 ++++++++++++++++++ dev-packages/e2e-tests/publish-packages.ts | 43 ------------------- dev-packages/e2e-tests/registrySetup.ts | 12 +----- 3 files changed, 44 insertions(+), 53 deletions(-) create mode 100644 dev-packages/e2e-tests/lib/publishPackages.ts delete mode 100644 dev-packages/e2e-tests/publish-packages.ts diff --git a/dev-packages/e2e-tests/lib/publishPackages.ts b/dev-packages/e2e-tests/lib/publishPackages.ts new file mode 100644 index 000000000000..032d6b29a736 --- /dev/null +++ b/dev-packages/e2e-tests/lib/publishPackages.ts @@ -0,0 +1,42 @@ +/* eslint-disable no-console */ +import * as childProcess from 'child_process'; +import { readFileSync } from 'fs'; +import { globSync } from 'glob'; +import * as path from 'path'; + +const repositoryRoot = path.resolve(__dirname, '../../..'); + +/** + * Publishes all built Sentry package tarballs to the local Verdaccio test registry. + */ +export function publishPackages(): void { + const version = ( + JSON.parse(readFileSync(path.join(__dirname, '../package.json'), 'utf8')) as { version: string } + ).version; + + // Get absolute paths of all the packages we want to publish to the fake registry + // Only include the current versions, to avoid getting old tarballs published as well + const packageTarballPaths = globSync(`packages/*/sentry-*-${version}.tgz`, { + cwd: repositoryRoot, + absolute: true, + }); + + if (packageTarballPaths.length === 0) { + throw new Error(`No packages to publish for version ${version}, did you run "yarn build:tarballs"?`); + } + + const npmrc = path.join(__dirname, '../test-registry.npmrc'); + + for (const tarballPath of packageTarballPaths) { + console.log(`Publishing tarball ${tarballPath} ...`); + const result = childProcess.spawnSync('npm', ['--userconfig', npmrc, 'publish', tarballPath], { + cwd: repositoryRoot, + encoding: 'utf8', + stdio: 'inherit', + }); + + if (result.status !== 0) { + throw new Error(`Error publishing tarball ${tarballPath}`); + } + } +} diff --git a/dev-packages/e2e-tests/publish-packages.ts b/dev-packages/e2e-tests/publish-packages.ts deleted file mode 100644 index cbe9a37de0a7..000000000000 --- a/dev-packages/e2e-tests/publish-packages.ts +++ /dev/null @@ -1,43 +0,0 @@ -import * as childProcess from 'child_process'; -import { readFileSync } from 'fs'; -import { globSync } from 'glob'; -import * as path from 'path'; - -const repositoryRoot = path.resolve(__dirname, '../..'); - -const version = (JSON.parse(readFileSync(path.join(__dirname, './package.json'), 'utf8')) as { version: string }) - .version; - -// Get absolute paths of all the packages we want to publish to the fake registry -// Only include the current versions, to avoid getting old tarballs published as well -const packageTarballPaths = globSync(`packages/*/sentry-*-${version}.tgz`, { - cwd: repositoryRoot, - absolute: true, -}); - -if (packageTarballPaths.length === 0) { - // eslint-disable-next-line no-console - console.log(`No packages to publish for version ${version}, did you run "yarn build:tarballs"?`); - process.exit(1); -} - -// Publish built packages to the fake registry -packageTarballPaths.forEach(tarballPath => { - // eslint-disable-next-line no-console - console.log(`Publishing tarball ${tarballPath} ...`); - // `--userconfig` flag needs to be before `publish` - childProcess.exec( - `npm --userconfig ${__dirname}/test-registry.npmrc publish ${tarballPath}`, - { - cwd: repositoryRoot, // Can't use __dirname here because npm would try to publish `@sentry-internal/e2e-tests` - encoding: 'utf8', - }, - err => { - if (err) { - // eslint-disable-next-line no-console - console.error(`Error publishing tarball ${tarballPath}`, err); - process.exit(1); - } - }, - ); -}); diff --git a/dev-packages/e2e-tests/registrySetup.ts b/dev-packages/e2e-tests/registrySetup.ts index b51d8e34a6ed..6c521e619f76 100644 --- a/dev-packages/e2e-tests/registrySetup.ts +++ b/dev-packages/e2e-tests/registrySetup.ts @@ -1,6 +1,7 @@ /* eslint-disable no-console */ import * as childProcess from 'child_process'; import { TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants'; +import { publishPackages } from './lib/publishPackages'; // https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines function groupCIOutput(groupTitle: string, fn: () => void): void { @@ -41,16 +42,7 @@ export function registrySetup(): void { throw new Error('Start Registry Process failed.'); } - // Publish packages to fake registry - const publishResult = childProcess.spawnSync('yarn', ['ts-node', 'publish-packages.ts', '--transpile-only'], { - cwd: __dirname, - encoding: 'utf8', - stdio: 'inherit', - }); - - if (publishResult.status !== 0) { - throw new Error(`Publishing packages to test registry failed with exit code ${publishResult.status}`); - } + publishPackages(); }); console.log(''); From 98bffbdef9ed89c040a4fee615f55a85c6f63f3c Mon Sep 17 00:00:00 2001 From: Francesco Gringl-Novy Date: Wed, 15 Apr 2026 14:52:28 +0200 Subject: [PATCH 3/3] fix linting --- dev-packages/e2e-tests/lib/publishPackages.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dev-packages/e2e-tests/lib/publishPackages.ts b/dev-packages/e2e-tests/lib/publishPackages.ts index 032d6b29a736..5aed3a76e77a 100644 --- a/dev-packages/e2e-tests/lib/publishPackages.ts +++ b/dev-packages/e2e-tests/lib/publishPackages.ts @@ -10,9 +10,8 @@ const repositoryRoot = path.resolve(__dirname, '../../..'); * Publishes all built Sentry package tarballs to the local Verdaccio test registry. */ export function publishPackages(): void { - const version = ( - JSON.parse(readFileSync(path.join(__dirname, '../package.json'), 'utf8')) as { version: string } - ).version; + const version = (JSON.parse(readFileSync(path.join(__dirname, '../package.json'), 'utf8')) as { version: string }) + .version; // Get absolute paths of all the packages we want to publish to the fake registry // Only include the current versions, to avoid getting old tarballs published as well