Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-12989] Create process for qa to build client with particular sdk version #11601

Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
657d2f2
feat: update sdk service abstraction with documentation and new `userโ€ฆ
coroiu Oct 7, 2024
e332670
feat: add uninitialized user client with cache
coroiu Oct 8, 2024
f7f79ba
feat: initialize user crypto
coroiu Oct 8, 2024
f4a589f
feat: initialize org keys
coroiu Oct 8, 2024
d7e82fc
fix: org crypto not initializing properly
coroiu Oct 9, 2024
cc8302a
feat: avoid creating clients unnecessarily
coroiu Oct 9, 2024
421f372
chore: remove dev print/subscription
coroiu Oct 9, 2024
f95cfe5
fix: clean up cache
coroiu Oct 9, 2024
8e0ef47
chore: update sdk version
coroiu Oct 14, 2024
7e7a10a
feat: implement clean-up logic (#11504)
coroiu Oct 14, 2024
1ed18e5
chore: bump sdk version to fix build issues
coroiu Oct 15, 2024
e8a1049
chore: bump sdk version to fix build issues
coroiu Oct 15, 2024
b9a729b
fix: missing constructor parameters
coroiu Oct 15, 2024
ac89518
refactor: simplify free() and delete() calls
coroiu Oct 16, 2024
3adc18e
refactor: use a named function for client creation
coroiu Oct 16, 2024
6b7b016
fix: client never freeing after refactor
coroiu Oct 16, 2024
85d4809
fix: broken impl and race condition in tests
coroiu Oct 16, 2024
276da3e
feat: add sdk override to desktop build
coroiu Oct 17, 2024
5e1647c
feat: add SDK version to browser about dialog
coroiu Oct 21, 2024
4045cd8
feat: add sdk override to browser build
coroiu Oct 21, 2024
f5af7df
fix: `npm ci` overriding the override
coroiu Oct 21, 2024
c0175b4
fix: artifacts not properly downloaded
coroiu Oct 21, 2024
f3895a8
fix: switch to new repository
coroiu Oct 22, 2024
dfa70f9
feat: add debug version function to web
coroiu Oct 23, 2024
3eb5298
feat: add sdk-version to CLI
coroiu Oct 23, 2024
020e4c6
feat: add version to desktop
coroiu Oct 23, 2024
79d61c9
feat: add override to cli
coroiu Oct 23, 2024
091b95f
feat: add override to web
coroiu Oct 23, 2024
cf565bb
fix: cli version acting as default command
coroiu Oct 23, 2024
f5f2cb8
fix: consistent workflow input name
coroiu Oct 23, 2024
5286644
feat: add error handling
coroiu Oct 24, 2024
b6da518
feat: upgrade sdk-internal
coroiu Oct 25, 2024
2ef1fb1
Merge branch 'main' into PM-12989-create-process-for-qa-to-build-clieโ€ฆ
coroiu Oct 25, 2024
9c8d841
fix: forgot to update package lock
coroiu Oct 28, 2024
858b495
Merge branch 'main' into PM-12989-create-process-for-qa-to-build-clieโ€ฆ
coroiu Oct 29, 2024
1f3ed1f
fix: broken CI build
coroiu Oct 29, 2024
32e038c
chore: revert version changes
coroiu Oct 29, 2024
f75f71f
refactor: move error handling code
coroiu Oct 29, 2024
f0319f9
chore: bump SDK to 0.2.0.main-1
coroiu Nov 4, 2024
8a9ef07
fix: clean up references to inputs.sdk_commit
coroiu Nov 4, 2024
da703f3
refactor: rename `init` to `applyVersionToWindow`
coroiu Nov 4, 2024
610697c
Merge branch 'main' into PM-12989-create-process-for-qa-to-build-clieโ€ฆ
coroiu Nov 4, 2024
5f4d6ec
Merge branch 'main' into PM-12989-create-process-for-qa-to-build-clieโ€ฆ
coroiu Nov 5, 2024
f241b15
Merge branch 'main' into PM-12989-create-process-for-qa-to-build-clieโ€ฆ
coroiu Nov 15, 2024
2d1c698
Merge branch 'main' into PM-12989-create-process-for-qa-to-build-clieโ€ฆ
coroiu Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion .github/workflows/build-browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ on:
workflow_call:
inputs: {}
workflow_dispatch:
inputs: {}
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
Expand Down Expand Up @@ -155,6 +159,25 @@ jobs:
run: npm ci
working-directory: browser-source/

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' || inputs.sdk_commit != '' }}
justindbaur marked this conversation as resolved.
Show resolved Hide resolved
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' || inputs.sdk_commit != '' }}
coroiu marked this conversation as resolved.
Show resolved Hide resolved
working-directory: browser-source/
run: |
npm link ../sdk-internal

- name: Build
run: npm run dist
working-directory: browser-source/apps/browser
Expand Down Expand Up @@ -327,6 +350,25 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
npm link ../sdk-internal

- name: Build Safari extension
run: npm run dist:safari
working-directory: apps/browser
Expand Down
46 changes: 45 additions & 1 deletion .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ on:
- '.github/workflows/build-cli.yml'
- 'bitwarden_license/bit-cli/**'
workflow_dispatch:
inputs: {}
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
Expand Down Expand Up @@ -102,6 +106,26 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Build & Package Unix
run: npm run dist:${{ matrix.license_type.build_prefix }}:${{ env.SHORT_RUNNER_OS }} --quiet

Expand Down Expand Up @@ -235,6 +259,26 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Build & Package Windows
run: npm run dist:${{ matrix.license_type.build_prefix }}:win --quiet

Expand Down
126 changes: 125 additions & 1 deletion .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ on:
- '!*.txt'
- '.github/workflows/build-desktop.yml'
workflow_dispatch:
inputs: {}
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
Expand Down Expand Up @@ -167,6 +171,26 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Cache Native Module
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
id: cache
Expand Down Expand Up @@ -297,6 +321,26 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Cache Native Module
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
id: cache
Expand Down Expand Up @@ -582,6 +626,26 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Cache Native Module
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
id: cache
Expand Down Expand Up @@ -748,6 +812,26 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Cache Native Module
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
id: cache
Expand Down Expand Up @@ -974,6 +1058,26 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Cache Native Module
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
id: cache
Expand Down Expand Up @@ -1209,6 +1313,26 @@ jobs:
run: npm ci
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Cache Native Module
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
id: cache
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ on:
custom_tag_extension:
description: "Custom image tag extension"
required: false
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

env:
_AZ_REGISTRY: bitwardenprod.azurecr.io
Expand Down Expand Up @@ -112,6 +116,26 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: sdk-internal
repo: bitwarden/sdk-internal
path: ../sdk-internal
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal

- name: Add Git metadata to build version
working-directory: apps/web
if: matrix.git_metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<div bitDialogContent>
<p>&copy; Bitwarden Inc. 2015-{{ year }}</p>
<p class="user-select">{{ "version" | i18n }}: {{ version$ | async }}</p>
<p class="user-select">SDK: {{ sdkVersion$ | async }}</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โ›๏ธ The label also requires localization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we translate SDK, see e.g. "Electron", "Rendered"

this.localize("version", this._version) +
"\nShell " +
process.versions.electron +
"\nRenderer " +
process.versions.chrome +
"\nNode " +
process.versions.node +
"\nArchitecture " +
process.arch;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like code we haven't transitioned yet. Of the 4 labels, only 1 (Node) is a brand name. The others are just words. That said, this isn't my call. I was nitting a code smell.

@danielleflinn - Should we be localizing the SDK label? Should I add a ticket to localize the snippet @coroiu just posted?

Copy link
Contributor Author

@coroiu coroiu Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some context, I don't really expect users to be looking at this, if anything they might copy and paste it when contacting CS. This is just a way to confirm that QA is testing with the correct version

<ng-container *ngIf="data$ | async as data">
<p *ngIf="data.isCloud">
{{ "serverVersion" | i18n }}: {{ data.serverConfig?.version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { SdkService } from "@bitwarden/common/platform/abstractions/sdk/sdk.service";

Check warning on line 9 in apps/browser/src/tools/popup/settings/about-dialog/about-dialog.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/tools/popup/settings/about-dialog/about-dialog.component.ts#L9

Added line #L9 was not covered by tests
import { ButtonModule, DialogModule } from "@bitwarden/components";

@Component({
Expand All @@ -22,10 +23,13 @@
this.environmentService.environment$.pipe(map((env) => env.isCloud())),
]).pipe(map(([serverConfig, isCloud]) => ({ serverConfig, isCloud })));

protected sdkVersion$ = this.sdkService.version$;

Check warning on line 26 in apps/browser/src/tools/popup/settings/about-dialog/about-dialog.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/tools/popup/settings/about-dialog/about-dialog.component.ts#L26

Added line #L26 was not covered by tests

constructor(
private configService: ConfigService,
private environmentService: EnvironmentService,
private platformUtilsService: PlatformUtilsService,
private sdkService: SdkService,

Check warning on line 32 in apps/browser/src/tools/popup/settings/about-dialog/about-dialog.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/tools/popup/settings/about-dialog/about-dialog.component.ts#L32

Added line #L32 was not covered by tests
) {
this.version$ = defer(() => this.platformUtilsService.getApplicationVersion());
}
Expand Down
9 changes: 9 additions & 0 deletions apps/cli/src/program.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as chalk from "chalk";
import { program, Command, OptionValues } from "commander";
import { firstValueFrom } from "rxjs";

Check warning on line 3 in apps/cli/src/program.ts

View check run for this annotation

Codecov / codecov/patch

apps/cli/src/program.ts#L3

Added line #L3 was not covered by tests

import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";

Expand Down Expand Up @@ -102,6 +103,14 @@
writeLn("", true);
});

program

Check warning on line 106 in apps/cli/src/program.ts

View check run for this annotation

Codecov / codecov/patch

apps/cli/src/program.ts#L106

Added line #L106 was not covered by tests
.command("sdk-version")
.description("Print the SDK version.")
.action(async () => {
const sdkVersion = await firstValueFrom(this.serviceContainer.sdkService.version$);
writeLn(sdkVersion, true);

Check warning on line 111 in apps/cli/src/program.ts

View check run for this annotation

Codecov / codecov/patch

apps/cli/src/program.ts#L109-L111

Added lines #L109 - L111 were not covered by tests
});

program
.command("login [email] [password]")
.description("Log into a user account.")
Expand Down
Loading
Loading