Skip to content

Commit 2ed99f2

Browse files
committed
Merge remote-tracking branch 'origin/fn/remove-publish-docker' into fn/playwright-docker-images
2 parents ee74923 + 98bffbd commit 2ed99f2

7 files changed

Lines changed: 44 additions & 126 deletions

File tree

.github/workflows/build.yml

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

983-
- name: Get node version
984-
id: versions
985-
run: |
986-
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
987-
988983
- name: Validate Verdaccio
989984
run: yarn test:validate
990985
working-directory: dev-packages/e2e-tests
991986

992987
- name: Prepare Verdaccio
993988
run: yarn test:prepare
994989
working-directory: dev-packages/e2e-tests
995-
env:
996-
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
997990

998991
- name: Copy to temp
999992
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
@@ -1092,20 +1085,13 @@ jobs:
10921085
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
10931086
run: yarn build:tarball
10941087

1095-
- name: Get node version
1096-
id: versions
1097-
run: |
1098-
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
1099-
11001088
- name: Validate Verdaccio
11011089
run: yarn test:validate
11021090
working-directory: dev-packages/e2e-tests
11031091

11041092
- name: Prepare Verdaccio
11051093
run: yarn test:prepare
11061094
working-directory: dev-packages/e2e-tests
1107-
env:
1108-
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
11091095

11101096
- name: Copy to temp
11111097
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
@@ -164,20 +164,13 @@ jobs:
164164
key: canary-${{ env.HEAD_COMMIT }}
165165
enableCrossOsArchive: true
166166

167-
- name: Get node version
168-
id: versions
169-
run: |
170-
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
171-
172167
- name: Validate Verdaccio
173168
run: yarn test:validate
174169
working-directory: dev-packages/e2e-tests
175170

176171
- name: Prepare Verdaccio
177172
run: yarn test:prepare
178173
working-directory: dev-packages/e2e-tests
179-
env:
180-
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}
181174

182175
- name: Copy to temp
183176
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)