Skip to content

Commit 97bbc68

Browse files
authored
fix(build): allow some signature files to be missing (#1187)
1 parent b46e8bc commit 97bbc68

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

packages/build/src/run-draft.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ describe('draft', () => {
7272
});
7373

7474
it('uploads artifacts to download center', () => {
75-
expect(uploadArtifactToDownloadCenter).to.have.been.callCount(ALL_BUILD_VARIANTS.length * 2);
75+
expect(uploadArtifactToDownloadCenter).to.have.been.callCount(ALL_BUILD_VARIANTS.length);
7676
});
7777

7878
it('uploads the artifacts to the github release', () => {
79-
expect(uploadReleaseAsset).to.have.been.callCount(ALL_BUILD_VARIANTS.length * 2);
79+
expect(uploadReleaseAsset).to.have.been.callCount(ALL_BUILD_VARIANTS.length);
8080
});
8181
});
8282

packages/build/src/run-draft.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { promises as fs } from 'fs';
1+
import { promises as fs, constants as fsConstants } from 'fs';
22
import path from 'path';
33
import { ALL_BUILD_VARIANTS, Config, getReleaseVersionFromTag } from './config';
44
import { uploadArtifactToDownloadCenter as uploadArtifactToDownloadCenterFn } from './download-center';
@@ -52,12 +52,18 @@ export async function runDraft(
5252
signingComment: 'Evergreen Automatic Signing (mongosh)'
5353
}
5454
);
55-
const signatureFile = downloadedArtifact + '.sig';
55+
let signatureFile: string | undefined = downloadedArtifact + '.sig';
56+
try {
57+
await fs.access(signatureFile, fsConstants.R_OK);
58+
} catch (err: any) {
59+
signatureFile = undefined;
60+
console.info(`Skipping expected signature file ${signatureFile}: ${err.message}`);
61+
}
5662

5763
await Promise.all([
5864
[ downloadedArtifact, tarballFile.contentType ],
5965
[ signatureFile, 'application/pgp-signature' ]
60-
].flatMap(([ path, contentType ]) => [
66+
].flatMap(([ path, contentType ]) => path ? [
6167
uploadToDownloadCenter(
6268
path,
6369
config.downloadCenterAwsKey as string,
@@ -68,7 +74,7 @@ export async function runDraft(
6874
githubReleaseTag,
6975
{ path, contentType }
7076
)
71-
]));
77+
] : []));
7278
}
7379
}
7480

0 commit comments

Comments
 (0)