Skip to content

Commit 99e5d77

Browse files
authored
fix: Archive Craft documentation in GCS (#899)
## Summary - Upload `gh-pages.zip` to the same versioned GCS path already advertised by Craft’s release registry. - Keep the existing Craft binary and npm tarball selection, and exclude unrelated files. - Add a regression using the repository’s actual `.craft.yml` and artifact filtering path. This applies to future releases only; 2.34.0 and older archives are not backfilled. ## Validation - The regression failed against the old filter and passed after the change (81/81 focused tests). - `pnpm test --printConsoleTrace`: 63 files, 1,289 passed, 1 skipped. - `pnpm typecheck`, `pnpm lint`, `pnpm format:check`, and `pnpm build` passed. - Build skipped source-map upload because `SENTRY_AUTH_TOKEN` was absent; Vitest emitted existing `symbolCollector.test.ts` import-assignment warnings.
1 parent 106a1ed commit 99e5d77

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

‎.craft.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ requireNames:
2424
targets:
2525
- name: npm
2626
- name: gcs
27-
includeNames: /^.*craft.*$/
27+
includeNames: /^(?:.*craft.*|gh-pages\.zip)$/
2828
bucket: sentry-sdk-assets
2929
paths:
3030
- path: /craft/{{version}}/

‎src/__tests__/config.test.ts‎

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { describe, test, expect, vi, afterEach, beforeEach } from 'vitest';
2-
import { mkdtempSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from 'fs';
2+
import {
3+
mkdtempSync,
4+
mkdirSync,
5+
readFileSync,
6+
rmSync,
7+
symlinkSync,
8+
writeFileSync,
9+
} from 'fs';
310
import { globSync } from 'glob';
11+
import { load } from 'js-yaml';
412
import { tmpdir } from 'os';
513
import { join } from 'path';
614
/**
@@ -24,8 +32,46 @@ import { CraftProjectConfigSchema } from '../schemas/project_config';
2432
import { logger } from '../logger';
2533
import { GitHubTarget } from '../targets/github';
2634
import { NoneArtifactProvider } from '../artifact_providers/none';
35+
import { BaseTarget } from '../targets/base';
2736

2837
describe('validateConfiguration', () => {
38+
test('Craft archives its release files and documentation at versioned GCS paths', async () => {
39+
const rawConfig = load(
40+
readFileSync(join(__dirname, '../../.craft.yml'), 'utf8'),
41+
) as Record<string, unknown>;
42+
const config = validateConfiguration(rawConfig);
43+
const gcsConfig = config.targets?.find(target => target.name === 'gcs');
44+
if (!gcsConfig) {
45+
throw new Error('Craft GCS target is missing');
46+
}
47+
48+
expect(gcsConfig.paths).toContainEqual(
49+
expect.objectContaining({ path: '/craft/{{version}}/' }),
50+
);
51+
52+
const filenames = [
53+
'craft',
54+
'sentry-craft-2.35.0.tgz',
55+
'gh-pages.zip',
56+
'other.zip',
57+
'gh-pages.zip.bak',
58+
];
59+
const provider = new NoneArtifactProvider();
60+
vi.spyOn(provider, 'listArtifactsForRevision').mockResolvedValue(
61+
filenames.map(filename => ({
62+
filename,
63+
storedFile: { filename, downloadFilepath: filename, size: 1 },
64+
})),
65+
);
66+
67+
const gcs = new BaseTarget(gcsConfig, provider);
68+
expect(
69+
(await gcs.getArtifactsForRevision('release-commit')).map(
70+
artifact => artifact.filename,
71+
),
72+
).toEqual(filenames.slice(0, 3));
73+
});
74+
2975
test('parses minimal configuration', () => {
3076
const data = { github: { owner: 'getsentry', repo: 'craft' } };
3177

0 commit comments

Comments
 (0)