Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Martin <[email protected]>
  • Loading branch information
feloy committed Mar 1, 2024
2 parents b59397f + 87b4bf5 commit a54c799
Show file tree
Hide file tree
Showing 21 changed files with 502 additions and 62 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/next-build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2022 Red Hat, Inc.
# Copyright (C) 2022-2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -191,3 +191,9 @@ jobs:
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" packages/extension-api/package.json
cd packages/extension-api && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
- name: Publish ui/svelte to npmjs
run: |
echo "Using version ${{ needs.tag.outputs.desktopVersion }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ needs.tag.outputs.desktopVersion }}\",#g" packages/ui/package.json
cd packages/ui && yarn publish --tag next --no-git-tag-version --new-version "${{ needs.tag.outputs.desktopVersion }}" --access public
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"compile:pull-request": "cross-env MODE=production npm run build && electron-builder build --publish never --config .electron-builder.config.cjs",
"compile:current": "cross-env MODE=production npm run build && electron-builder build --config .electron-builder.config.cjs",
"test": "npm run test:unit && npm run test:e2e",
"test:unit": "npm run test:main && npm run test:preload && npm run test:preload-docker-extension && npm run test:preload-webview && npm run test:renderer && npm run test:ui && npm run test:tools && npm run test:extensions",
"test:unit": "npm run test:main && npm run test:preload && npm run test:preload-docker-extension && npm run test:preload-webview && npm run test:ui && npm run test:renderer && npm run test:tools && npm run test:extensions",
"test:e2e": "npm run test:e2e:build && npm run test:e2e:run",
"test:e2e:build": "cross-env NODE_ENV=development MODE=development DEBUG=pw:browser npm run build",
"test:e2e:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- vitest run tests/src/ --pool=threads --poolOptions.threads.singleThread --poolOptions.threads.isolate --no-file-parallelism",
Expand All @@ -68,7 +68,7 @@
"test:extensions:podman": "vitest run -r extensions/podman --passWithNoTests --coverage ",
"test:extensions:registries": "vitest run -r extensions/registries --passWithNoTests --coverage ",
"test:extensions:kubectl-cli": "vitest run -r extensions/kubectl-cli --passWithNoTests --coverage ",
"test:renderer": "vitest -c packages/renderer/vite.config.js run packages/renderer --passWithNoTests --coverage",
"test:renderer": "npm run build:ui && vitest -c packages/renderer/vite.config.js run packages/renderer --passWithNoTests --coverage",
"test:ui": "vitest run -r packages/ui --passWithNoTests --coverage",
"test:tools": "vitest run tools --passWithNoTests --coverage",
"test:watch": "vitest watch",
Expand All @@ -80,7 +80,7 @@
"lint:clean": "rimraf .eslintcache",
"lint:check": "node --max-old-space-size=4096 node_modules/eslint/bin/eslint.js --cache . --ext js,ts,tsx,svelte",
"lint:fix": "node --max-old-space-size=4096 node_modules/eslint/bin/eslint.js --cache . --fix --ext js,ts,tsx,svelte",
"svelte:check": "svelte-check",
"svelte:check": "svelte-check --ignore \"packages/ui/dist\"",
"typecheck:main": "tsc --noEmit -p packages/main/tsconfig.json",
"typecheck:preload": "tsc --noEmit -p packages/preload/tsconfig.json",
"typecheck:preload-dd-extension": "tsc --noEmit -p packages/preload-docker-extension/tsconfig.json",
Expand Down Expand Up @@ -152,7 +152,7 @@
"nock": "^13.5.0",
"postcss-import": "^16.0.1",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.1",
"prettier-plugin-svelte": "^3.2.2",
"proxy": "^2.1.1",
"typescript": "5.3.3",
"validator": "^13.11.0",
Expand Down
25 changes: 21 additions & 4 deletions packages/extension-api/src/extension-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ declare module '@podman-desktop/api' {
portmappings?: PodCreatePortOptions[];
labels?: { [key: string]: string };
// Set the provider to use, if not we will try select the first one available (sorted in favor of Podman).
provider?: ProviderContainerConnectionInfo | ContainerProviderConnection;
provider?: ContainerProviderConnection;
}

export interface KubernetesProviderConnectionEndpoint {
Expand Down Expand Up @@ -827,7 +827,7 @@ declare module '@podman-desktop/api' {
/**
* A description of the field to be show (Markdown format)
*/
markdownDescription?;
markdownDescription?: string;

/**
* An optional string to show as placeholder in the input box to guide the user what to type.
Expand Down Expand Up @@ -1113,6 +1113,8 @@ declare module '@podman-desktop/api' {
dispose(): void;
}

type NotificationType = 'info' | 'warn' | 'error';

export interface NotificationOptions {
/**
* A title for the notification, which will be shown at the top of the notification window when it is shown.
Expand Down Expand Up @@ -1913,6 +1915,13 @@ declare module '@podman-desktop/api' {
IPv4Address: string;
IPv6Address: string;
}

interface IPAM {
Driver: string;
Config?: Array<{ [key: string]: string }>;
Options?: { [key: string]: string };
}

export interface NetworkInspectInfo {
engineId: string;
engineName: string;
Expand Down Expand Up @@ -2069,6 +2078,14 @@ declare module '@podman-desktop/api' {

type MountConfig = MountSettings[];

interface DeviceRequest {
Driver?: string;
Count?: number;
DeviceIDs?: string[];
Capabilities?: string[][];
Options?: { [key: string]: string };
}

interface HostConfig {
AutoRemove?: boolean;
Binds?: string[];
Expand Down Expand Up @@ -2650,7 +2667,7 @@ declare module '@podman-desktop/api' {
/**
* Set the provider to use, if not we will try select the first one available (sorted in favor of Podman)
*/
provider?: ProviderContainerConnectionInfo | containerDesktopAPI.ContainerProviderConnection;
provider?: ContainerProviderConnection;

/**
* The abort controller for running the build image operation
Expand Down Expand Up @@ -2927,7 +2944,7 @@ declare module '@podman-desktop/api' {
context: string,
eventCollect: (eventName: 'stream' | 'error' | 'finish', data: string) => void,
options?: BuildImageOptions,
);
): Promise<unknown>;

/**
* Save on disk a tarball containing the image and its metadata.
Expand Down
156 changes: 156 additions & 0 deletions packages/main/src/plugin/api/image-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,164 @@
***********************************************************************/

import type * as Dockerode from 'dockerode';
import type { ProviderContainerConnectionInfo } from './provider-info.js';
import type { ContainerProviderConnection } from '@podman-desktop/api';

export interface ImageInfo extends Dockerode.ImageInfo {
engineId: string;
engineName: string;
}

export interface BuildImageOptions {
/**
* Specifies a Containerfile which contains instructions for building the image
*/
containerFile?: string;

/**
* Specifies the name which is assigned to the resulting image if the build process completes successfully
*/
tag?: string;

/**
* Set the os/arch of the built image (and its base image, when using one) to the provided value instead of using the current operating system and architecture of the host
*/
platform?: string;

/**
* Set the provider to use, if not we will try select the first one available (sorted in favor of Podman)
*/
provider?: ProviderContainerConnectionInfo | ContainerProviderConnection;

/**
* The abort controller for running the build image operation
*/
abortController?: AbortController;

/**
* Extra hosts to add to /etc/hosts
*/
extrahosts?: string;

/**
* A Git repository URI or HTTP/HTTPS context URI. If the URI points to a single text file, the file’s contents are
* placed into a file called Dockerfile and the image is built from that file. If the URI points to a tarball, the
* file is downloaded by the daemon and the contents therein used as the context for the build. If the URI points
* to a tarball and the dockerfile parameter is also specified, there must be a file with the corresponding path
* inside the tarball.
*/
remote?: string;

/**
* Default: false
*
* Suppress verbose build output.
*/
q?: boolean;

/**
* JSON array of images used for build cache resolution.
*/
cachefrom?: string;

/**
* Attempt to pull the image even if an older image exists locally.
*/
pull?: string;

/**
* Default: true
*
* Remove intermediate containers after a successful build.
*/
rm?: boolean;

/**
* Default: false
*
* Always remove intermediate containers, even upon failure.
*/
forcerm?: boolean;

/**
* Set memory limit for build.
*/
memory?: number;

/**
* Total memory (memory + swap). Set as -1 to disable swap.
*/
memswap?: number;

/**
* CPU shares (relative weight).
*/
cpushares?: number;

/**
* CPUs in which to allow execution (e.g., 0-3, 0,1).
*/
cpusetcpus?: number;

/**
* The length of a CPU period in microseconds.
*/
cpuperiod?: number;

/**
* Microseconds of CPU time that the container can get in a CPU period.
*/
cpuquota?: number;

/**
* JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the
* buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable
* expansion in other `Dockerfilev` instructions. This is not meant for passing secret values.
* For example, the build arg `FOO=bar` would become `{"FOO":"bar"}` in JSON. This would result in the query
* parameter `buildargs={"FOO":"bar"}`. Note that `{"FOO":"bar"}` should be URI component encoded.
*/
buildargs?: { [key: string]: string };

/**
* Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
*/
shmsize?: number;

/**
* Squash the resulting images layers into a single layer.
*/
squash?: boolean;

/**
* Arbitrary key/value labels to set on the image, as a JSON map of string pairs.
*/
labels?: { [key: string]: string };

/**
* Sets the networking mode for the run commands during build. Supported standard values are: `bridge`,
* `host`, `none`, and `container:<name|id>`. Any other value is taken as a custom network's name or ID
* to which this container should connect to.
*/
networkmode?: string;

/**
* Default: ""
*
* Target build stage
*/
target?: string;

/**
* Default: ""
*
* BuildKit output configuration
*/
outputs?: string;

/**
* Default: false
*
* Do not use the cache when building the image.
*/
nocache?: boolean;
}
10 changes: 10 additions & 0 deletions packages/main/src/plugin/api/pod-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
* SPDX-License-Identifier: Apache-2.0
***********************************************************************/

import type { ContainerProviderConnection, PodCreatePortOptions } from '@podman-desktop/api';
import type {
PodInfo as LibPodPodInfo,
PodInspectInfo as LibPodPodInspectInfo,
} from '../dockerode/libpod-dockerode.js';
import type { ProviderContainerConnectionInfo } from './provider-info.js';

export interface PodInfo extends LibPodPodInfo {
engineId: string;
Expand All @@ -31,3 +33,11 @@ export interface PodInspectInfo extends LibPodPodInspectInfo {
engineId: string;
engineName: string;
}

export interface PodCreateOptions {
name: string;
portmappings?: PodCreatePortOptions[];
labels?: { [key: string]: string };
// Set the provider to use, if not we will try select the first one available (sorted in favor of Podman).
provider?: ProviderContainerConnectionInfo | ContainerProviderConnection;
}
8 changes: 4 additions & 4 deletions packages/main/src/plugin/container-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import type {
VolumeCreateOptions,
VolumeCreateResponseInfo,
} from './api/container-info.js';
import type { ImageInfo } from './api/image-info.js';
import type { PodInfo, PodInspectInfo } from './api/pod-info.js';
import type { BuildImageOptions, ImageInfo } from './api/image-info.js';
import type { PodCreateOptions, PodInfo, PodInspectInfo } from './api/pod-info.js';
import type { ImageInspectInfo } from './api/image-inspect-info.js';
import type { ProviderContainerConnectionInfo } from './api/provider-info.js';
import type { ImageRegistry } from './image-registry.js';
Expand Down Expand Up @@ -1168,7 +1168,7 @@ export class ContainerProviderRegistry {
}
}

async createPod(podOptions: containerDesktopAPI.PodCreateOptions): Promise<{ engineId: string; Id: string }> {
async createPod(podOptions: PodCreateOptions): Promise<{ engineId: string; Id: string }> {
let telemetryOptions = {};
try {
let internalContainerProvider: InternalContainerProvider;
Expand Down Expand Up @@ -2013,7 +2013,7 @@ export class ContainerProviderRegistry {
async buildImage(
containerBuildContextDirectory: string,
eventCollect: (eventName: 'stream' | 'error' | 'finish', data: string) => void,
options?: containerDesktopAPI.BuildImageOptions,
options?: BuildImageOptions,
): Promise<unknown> {
let telemetryOptions = {};
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ import type { ColorInfo } from './api/color-info.js';
import { ColorRegistry } from './color-registry.js';
import { DialogRegistry } from './dialog-registry.js';
import type { Deferred } from './util/deferred.js';
import { Updater } from '/@/plugin/updater.js';
import type { ContextGeneralState, ResourceName } from './kubernetes-context-state.js';
import { Updater } from '/@/plugin/updater.js';

type LogType = 'log' | 'warn' | 'trace' | 'debug' | 'error';

Expand Down Expand Up @@ -523,7 +523,7 @@ export class PluginSystem {
);

// Init update logic
new Updater(messageBox, statusBarRegistry, commandRegistry).init();
new Updater(messageBox, configurationRegistry, statusBarRegistry, commandRegistry).init();

commandRegistry.registerCommand('feedback', () => {
apiSender.send('display-feedback', '');
Expand Down
Loading

0 comments on commit a54c799

Please sign in to comment.