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

chore(ci): Update trezor user env image to latest #16969

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docker/docker-compose.connect-popup-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.connect-popup-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- DISPLAY=$DISPLAY
- QT_X11_NO_MITSHM=1
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.connect-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.connect-webextension-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.suite-ci-pw.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.suite-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.suite-desktop-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.suite-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- DISPLAY=$DISPLAY
- QT_X11_NO_MITSHM=1
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.suite-native-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
trezor-user-env-unix:
network_mode: "host"
container_name: trezor-user-env.unix
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.suite-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- DISPLAY=$DISPLAY
- QT_X11_NO_MITSHM=1
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.transport-test-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
trezor-user-env-unix:
image: ghcr.io/trezor/trezor-user-env:b23cde1860e03c8bdaebbbc8fcbcd2cc9d6375d3
image: ghcr.io/trezor/trezor-user-env:6339d48f1df4f007fe5caee659e4bca3997d480a
environment:
- SDL_VIDEODRIVER=dummy
- XDG_RUNTIME_DIR=/var/tmp
Expand Down
35 changes: 17 additions & 18 deletions packages/trezor-user-env-link/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */

import semverRSort from 'semver/functions/rsort';
import rcompare from 'semver/functions/rcompare';
import semverValid from 'semver/functions/valid';

import { TypedEmitter } from '@trezor/utils';
Expand Down Expand Up @@ -95,7 +95,6 @@ export const DEFAULT_BRIDGE_VERSION = '2.0.33';
export class TrezorUserEnvLinkClass extends TypedEmitter<WebsocketClientEvents> {
private client: WebsocketClient;
public firmwares?: Firmwares;
private defaultFirmware?: string;
public defaultModel: Model = 'T2T1';

public currentEmulatorSetup?: Partial<SetupEmu> = {};
Expand All @@ -110,11 +109,6 @@ export class TrezorUserEnvLinkClass extends TypedEmitter<WebsocketClientEvents>

this.client.on('firmwares', (firmwares: Firmwares) => {
this.firmwares = firmwares;
// select the highest version from the list of available firmwares.
// this is the version that is likely to be the newest production.
this.defaultFirmware = semverRSort(
this.firmwares[this.defaultModel].filter(fw => semverValid(fw)),
)[0];
});

this.client.on('disconnected', () => this.emit('disconnected'));
Expand Down Expand Up @@ -198,23 +192,28 @@ export class TrezorUserEnvLinkClass extends TypedEmitter<WebsocketClientEvents>

return null;
}
async startEmu(arg?: StartEmu) {
const params = {
async startEmu(arg: StartEmu = {}) {
const { model = this.defaultModel, ...rest } = arg;
const defaultFirmware = this.firmwares?.[model]
?.filter(version => semverValid(version))
?.sort(rcompare)?.[0] ?? '2-main';

await this.client.send({
type: 'emulator-start',
model: this.defaultModel,
version: this.defaultFirmware || '2-main',
...arg,
};

await this.client.send(params);

if (params.wipe) {
model,
version: defaultFirmware,
...rest,
});

if (rest.wipe) {
this.currentEmulatorSettings = {};
this.currentEmulatorSetup = {};
}

return null;
}


async startEmuFromUrl({ url, model, wipe }: StartEmuFromUrl) {
await this.client.send({
type: 'emulator-start-from-url',
Expand Down
Loading