Skip to content

Commit 8b2a9dc

Browse files
mydeaclaude
andauthored
ci: Remove Docker container for Verdaccio package publishing (#20329)
This PR removes some custom stuff we still had around for our E2E tests that, as far as I can tell, weren't even needed anymore. We used to spin up a minimal docker image just to publish packages to NPM, which AFAIk should not really be necessary. ## Summary - Removes `Dockerfile.publish-packages` and the Docker build+run steps for publishing packages to the local Verdaccio registry during E2E tests - Extracts the tarball publishing logic into `lib/publishPackages.ts` as an importable function and calls it directly from `registrySetup()` — no subprocess needed - Removes the old `publish-packages.ts` standalone script - Removes the `E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION` env var and `Get node version` steps from `build.yml` and `canary.yml` - Removes the `PUBLISH_PACKAGES_DOCKER_IMAGE_NAME` constant The Docker container only existed to pin a Node.js version for `npm publish` of pre-built tarballs. Since the host already has the correct Node.js version via Volta, the container adds overhead (image build + volume mounts + `--network host`) without meaningful benefit. ## Test plan - [ ] E2E tests pass in CI (the Verdaccio publish step needs to work without Docker) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0007c7b commit 8b2a9dc

File tree

7 files changed

+44
-126
lines changed

7 files changed

+44
-126
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -959,20 +959,13 @@ jobs:
959959
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
960960
run: yarn build:tarball
961961

962-
- name: Get node version
963-
id: versions
964-
run: |
965-
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
966-
967962
- name: Validate Verdaccio
968963
run: yarn test:validate
969964
working-directory: dev-packages/e2e-tests
970965

971966
- name: Prepare Verdaccio
972967
run: yarn test:prepare
973968
working-directory: dev-packages/e2e-tests
974-
env:
975-
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
976969

977970
- name: Copy to temp
978971
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
@@ -1076,20 +1069,13 @@ jobs:
10761069
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
10771070
run: yarn build:tarball
10781071

1079-
- name: Get node version
1080-
id: versions
1081-
run: |
1082-
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
1083-
10841072
- name: Validate Verdaccio
10851073
run: yarn test:validate
10861074
working-directory: dev-packages/e2e-tests
10871075

10881076
- name: Prepare Verdaccio
10891077
run: yarn test:prepare
10901078
working-directory: dev-packages/e2e-tests
1091-
env:
1092-
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
10931079

10941080
- name: Copy to temp
10951081
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application

.github/workflows/canary.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,13 @@ jobs:
140140
path: ${{ env.CACHED_BUILD_PATHS }}
141141
key: canary-${{ env.HEAD_COMMIT }}
142142

143-
- name: Get node version
144-
id: versions
145-
run: |
146-
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
147-
148143
- name: Validate Verdaccio
149144
run: yarn test:validate
150145
working-directory: dev-packages/e2e-tests
151146

152147
- name: Prepare Verdaccio
153148
run: yarn test:prepare
154149
working-directory: dev-packages/e2e-tests
155-
env:
156-
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
157150

158151
- name: Copy to temp
159152
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application

dev-packages/e2e-tests/Dockerfile.publish-packages

Lines changed: 0 additions & 6 deletions
This file was deleted.

dev-packages/e2e-tests/lib/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ export const TEST_REGISTRY_CONTAINER_NAME = 'verdaccio-e2e-test-registry';
22
export const DEFAULT_BUILD_TIMEOUT_SECONDS = 60 * 5;
33
export const DEFAULT_TEST_TIMEOUT_SECONDS = 60 * 2;
44
export const VERDACCIO_VERSION = '5.22.1';
5-
export const PUBLISH_PACKAGES_DOCKER_IMAGE_NAME = 'publish-packages';
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* eslint-disable no-console */
2+
import * as childProcess from 'child_process';
3+
import { readFileSync } from 'fs';
4+
import { globSync } from 'glob';
5+
import * as path from 'path';
6+
7+
const repositoryRoot = path.resolve(__dirname, '../../..');
8+
9+
/**
10+
* Publishes all built Sentry package tarballs to the local Verdaccio test registry.
11+
*/
12+
export function publishPackages(): void {
13+
const version = (JSON.parse(readFileSync(path.join(__dirname, '../package.json'), 'utf8')) as { version: string })
14+
.version;
15+
16+
// Get absolute paths of all the packages we want to publish to the fake registry
17+
// Only include the current versions, to avoid getting old tarballs published as well
18+
const packageTarballPaths = globSync(`packages/*/sentry-*-${version}.tgz`, {
19+
cwd: repositoryRoot,
20+
absolute: true,
21+
});
22+
23+
if (packageTarballPaths.length === 0) {
24+
throw new Error(`No packages to publish for version ${version}, did you run "yarn build:tarballs"?`);
25+
}
26+
27+
const npmrc = path.join(__dirname, '../test-registry.npmrc');
28+
29+
for (const tarballPath of packageTarballPaths) {
30+
console.log(`Publishing tarball ${tarballPath} ...`);
31+
const result = childProcess.spawnSync('npm', ['--userconfig', npmrc, 'publish', tarballPath], {
32+
cwd: repositoryRoot,
33+
encoding: 'utf8',
34+
stdio: 'inherit',
35+
});
36+
37+
if (result.status !== 0) {
38+
throw new Error(`Error publishing tarball ${tarballPath}`);
39+
}
40+
}
41+
}

dev-packages/e2e-tests/publish-packages.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

dev-packages/e2e-tests/registrySetup.ts

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
/* eslint-disable no-console */
22
import * as childProcess from 'child_process';
3-
import * as path from 'path';
4-
import { PUBLISH_PACKAGES_DOCKER_IMAGE_NAME, TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants';
5-
6-
const publishScriptNodeVersion = process.env.E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION;
7-
const repositoryRoot = path.resolve(__dirname, '../..');
3+
import { TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants';
4+
import { publishPackages } from './lib/publishPackages';
85

96
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines
107
function groupCIOutput(groupTitle: string, fn: () => void): void {
@@ -45,56 +42,7 @@ export function registrySetup(): void {
4542
throw new Error('Start Registry Process failed.');
4643
}
4744

48-
// Build container image that is uploading our packages to fake registry with specific Node.js/npm version
49-
const buildPublishImageProcessResult = childProcess.spawnSync(
50-
'docker',
51-
[
52-
'build',
53-
'--tag',
54-
PUBLISH_PACKAGES_DOCKER_IMAGE_NAME,
55-
'--file',
56-
'./Dockerfile.publish-packages',
57-
...(publishScriptNodeVersion ? ['--build-arg', `NODE_VERSION=${publishScriptNodeVersion}`] : []),
58-
'.',
59-
],
60-
{
61-
encoding: 'utf8',
62-
stdio: 'inherit',
63-
},
64-
);
65-
66-
if (buildPublishImageProcessResult.status !== 0) {
67-
throw new Error('Build Publish Image failed.');
68-
}
69-
70-
// Run container that uploads our packages to fake registry
71-
const publishImageContainerRunProcess = childProcess.spawnSync(
72-
'docker',
73-
[
74-
'run',
75-
'--rm',
76-
'-v',
77-
`${repositoryRoot}:/sentry-javascript`,
78-
'--network',
79-
'host',
80-
PUBLISH_PACKAGES_DOCKER_IMAGE_NAME,
81-
],
82-
{
83-
encoding: 'utf8',
84-
stdio: 'inherit',
85-
},
86-
);
87-
88-
const statusCode = publishImageContainerRunProcess.status;
89-
90-
if (statusCode !== 0) {
91-
if (statusCode === 137) {
92-
throw new Error(
93-
`Publish Image Container failed with exit code ${statusCode}, possibly due to memory issues. Consider increasing the memory limit for the container.`,
94-
);
95-
}
96-
throw new Error(`Publish Image Container failed with exit code ${statusCode}`);
97-
}
45+
publishPackages();
9846
});
9947

10048
console.log('');

0 commit comments

Comments
 (0)