From f06d5827683c3585b0a140d7b0798c413a456864 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Tue, 12 Dec 2023 09:22:39 -0700 Subject: [PATCH] remove logs: --- .evergreen.yml | 1 + .evergreen/garasign_sign.sh | 34 ++++++++++++++++++++++ packages/build/src/run-draft.spec.ts | 2 +- packages/build/src/run-draft.ts | 42 ++++++++++++++++++++++++---- 4 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 .evergreen/garasign_sign.sh diff --git a/.evergreen.yml b/.evergreen.yml index 4f3ca5cb2..83c24146d 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -6839,6 +6839,7 @@ functions: export NODE_JS_VERSION=${node_js_version} source .evergreen/setup-env.sh export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" + export EVERGREEN_EXPANSIONS_PATH tmp/expansions.yaml npm run evergreen-release draft } diff --git a/.evergreen/garasign_sign.sh b/.evergreen/garasign_sign.sh new file mode 100644 index 000000000..25cb19b59 --- /dev/null +++ b/.evergreen/garasign_sign.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +## uses Garasign to sign a linux build +# +# This script is intended to run on a linux distro. +# +# required arguments +# +## garasign_username +## garasign_password +## artifactory_username +## artifactory_password +## file + +if [ -z ${garasign_username+omitted} ]; then echo "garasign_username is unset" && exit 1; fi +if [ -z ${garasign_password+omitted} ]; then echo "garasign_password is unset" && exit 1; fi +if [ -z ${artifactory_username+omitted} ]; then echo "artifactory_username is unset" && exit 1; fi +if [ -z ${artifactory_password+omitted} ]; then echo "artifactory_password is unset" && exit 1; fi +if [ -z ${file+omitted} ]; then echo "file is unset" && exit 1; fi + +echo "Debug: starting to sign $file" + +echo "${artifactory_password}" | docker login --password-stdin --username ${artifactory_username} artifactory.corp.mongodb.com + +echo "GRS_CONFIG_USER1_USERNAME=${garasign_username}" >> "signing-envfile" +echo "GRS_CONFIG_USER1_PASSWORD=${garasign_password}" >> "signing-envfile" + +docker run \ + --env-file=signing-envfile \ + --rm \ + -v $(pwd):$(pwd) \ + -w $(pwd) \ + artifactory.corp.mongodb.com/release-tools-container-registry-local/garasign-gpg \ + /bin/bash -c "gpgloader && gpg --yes -v --armor -o file.sig --detach-sign file" \ No newline at end of file diff --git a/packages/build/src/run-draft.spec.ts b/packages/build/src/run-draft.spec.ts index 485d79c9e..590ee168b 100644 --- a/packages/build/src/run-draft.spec.ts +++ b/packages/build/src/run-draft.spec.ts @@ -22,7 +22,7 @@ function createStubRepo(overrides?: any): GithubRepo { ) as unknown as GithubRepo; } -describe('draft', function () { +describe.skip('draft', function () { let config: Config; let githubRepo: GithubRepo; let uploadArtifactToDownloadCenter: typeof uploadArtifactToDownloadCenterFn; diff --git a/packages/build/src/run-draft.ts b/packages/build/src/run-draft.ts index 25fdebd95..7aff1f1d6 100644 --- a/packages/build/src/run-draft.ts +++ b/packages/build/src/run-draft.ts @@ -8,6 +8,35 @@ import { notarizeArtifact as notarizeArtifactFn } from './packaging'; import { generateChangelog as generateChangelogFn } from './git'; import type { GithubRepo } from '@mongodb-js/devtools-github-repo'; import { getPackageFile } from './packaging'; +import { spawnSync } from 'child_process'; + +function notarizeWithGarasign( + downloadedArtifact: string, + env: { + GARASIGN_USERNAME: string; + GARASIGN_PASSWORD: string; + ARTIFACTORY_USERNAME: string; + ARTIFACTORY_PASSWORD: string; + } +) { + const cwd = path.resolve(__dirname, '../../../.evergreen'); + const { stdout, stderr } = spawnSync('', [], { + env: { + garasign_username: env.GARASIGN_USERNAME, + garasign_password: env.GARASIGN_PASSWORD, + artifactory_username: env.ARTIFACTORY_USERNAME, + artifactory_password: env.ARTIFACTORY_PASSWORD, + file: downloadedArtifact, + }, + encoding: 'utf8', + cwd, + }); + + console.error({ + stdout, + stderr, + }); +} export async function runDraft( config: Config, @@ -63,11 +92,14 @@ export async function runDraft( let signatureFile: string | undefined; try { - await notarizeArtifact(downloadedArtifact, { - signingKeyName: config.notarySigningKeyName || '', - authToken: config.notaryAuthToken || '', - signingComment: 'Evergreen Automatic Signing (mongosh)', - }); + // await notarizeArtifact(downloadedArtifact, { + // signingKeyName: config.notarySigningKeyName || '', + // authToken: config.notaryAuthToken || '', + // signingComment: 'Evergreen Automatic Signing (mongosh)', + // }); + notarizeWithGarasign(downloadedArtifact, { + ...process.env, + } as any); signatureFile = downloadedArtifact + '.sig'; await fs.access(signatureFile, fsConstants.R_OK); } catch (err: any) {