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

Development 2.6 #2929

Merged
merged 169 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
80605f3
Add zmount unit tests
zaelgohary Jun 6, 2024
ef86eb5
Adding planetry ip to all solutions
maayarosama Jun 6, 2024
0860e49
Add farms alert
zaelgohary Jun 6, 2024
00611b3
Merge pull request #2902 from threefoldtech/development_2.6_farms_det…
zaelgohary Jun 6, 2024
f7e01b9
Replace v-autocomplete w v-select
zaelgohary Jun 6, 2024
bbbf728
Merge pull request #2901 from threefoldtech/development_2.6_planetary
maayarosama Jun 6, 2024
90a647c
Fix public ip delete btn
samaradel Jun 6, 2024
b433d30
Merge pull request #2905 from threefoldtech/development_2.6_deleteBtn
samaradel Jun 6, 2024
6ff03ea
Merge pull request #2903 from threefoldtech/development_2.6_fix_flist…
zaelgohary Jun 6, 2024
82dc3ad
Merge pull request #2894 from threefoldtech/development_2.6_zmount_tests
zaelgohary Jun 9, 2024
686ad19
Apply filters on enter
zaelgohary Jun 9, 2024
f66c4fe
Adding an alert and a retry button in case of failure of retrieving n…
maayarosama Jun 9, 2024
dda871b
Add applyOnEnter fn and condition it to envoke if filters are valid &…
zaelgohary Jun 9, 2024
b90af91
Change memory rules to accept decimals and edit min value
zaelgohary Jun 9, 2024
372e538
Replace applyOnEnter w a hidden submit input
zaelgohary Jun 9, 2024
9c46686
Merge branch 'development' into development_2.6
AhmedHanafy725 Jun 9, 2024
1ed4c1d
Add branch development_2.6 to trigger the workflow
AhmedHanafy725 Jun 9, 2024
2381bab
Add Nost solution
zaelgohary Jun 9, 2024
6d866b3
Add gitea
zaelgohary Jun 9, 2024
9e8bcbd
Merge pull request #2921 from threefoldtech/development_2.6_node_find…
maayarosama Jun 9, 2024
52589ac
Fix search your farms
zaelgohary Jun 9, 2024
ae31f76
Remove unused code
zaelgohary Jun 9, 2024
4392893
Merge pull request #2927 from threefoldtech/development_2.6_memory_rules
zaelgohary Jun 10, 2024
a87b0e7
Merge pull request #2938 from threefoldtech/development_2.6_search_farm
zaelgohary Jun 10, 2024
62f5da4
Fix farm finder table pagination
samaradel Jun 10, 2024
a2b967a
Fix profile manager inputs autocomplete
samaradel Jun 10, 2024
d96641b
Added a Mine filter in node finder to retrieve nodes rented by me
maayarosama Jun 10, 2024
f36b8ff
Merge pull request #2946 from threefoldtech/development_2.6_inputs
samaradel Jun 10, 2024
9eb3dae
Remove env tab & add mail server, Add gitea to deplyment list
zaelgohary Jun 10, 2024
19da6d3
Merge pull request #2949 from threefoldtech/development_2.6_add__mine…
maayarosama Jun 11, 2024
c8aeac8
Merge pull request #2942 from threefoldtech/development_2.6_farm_finder
samaradel Jun 11, 2024
d9a3d28
feat: Enhance the contracts list page and support sorting: (#2950)
Mahmoud-Emad Jun 11, 2024
ae864d9
Merge branch 'development' into development_2.6
AhmedHanafy725 Jun 11, 2024
4b75cbc
Fix too expensive box flashing
samaradel Jun 11, 2024
b53f20f
Fix nodes last deployment timestamp
samaradel Jun 11, 2024
3fec702
rm script push by mistake
samaradel Jun 11, 2024
5b92ddd
fix check node status condition
samaradel Jun 11, 2024
539dac6
Merge pull request #2957 from threefoldtech/development_2.6_deploymen…
samaradel Jun 11, 2024
ce6cb3b
Merge pull request #2956 from threefoldtech/development_2.6_pricing_c…
samaradel Jun 11, 2024
0d9ac3f
Fix the scroll of the main page when dashboard logger is opened
samaradel Jun 11, 2024
a4f899e
Merge pull request #2959 from threefoldtech/development_2.6_logger
samaradel Jun 12, 2024
08ab729
Merge branch 'development_2.6' of https://github.com/threefoldtech/tf…
zaelgohary Jun 12, 2024
4636067
feat: add validation for gateway IP range to match node's subnet:
Mahmoud-Emad Jun 12, 2024
7376b91
Merge branch 'development_2.6' of https://github.com/threefoldtech/tf…
zaelgohary Jun 12, 2024
7c6938f
Add nostr icon, add official flist, fix nostr view name
zaelgohary Jun 12, 2024
310cc61
Add window event listener to applyOnEnter
zaelgohary Jun 12, 2024
a1d2ceb
fix: Fixed the prefix len error:
Mahmoud-Emad Jun 12, 2024
9e24b8b
Add audit-fix script & workflow
zaelgohary Jun 12, 2024
db2775d
Check if location length > 0
zaelgohary Jun 12, 2024
26f5287
Edit workflow
zaelgohary Jun 12, 2024
b79b3fc
Rename workflow
zaelgohary Jun 12, 2024
f76c678
Edit err msg if node has active contract
zaelgohary Jun 12, 2024
1ffc811
Add no IPs msg
zaelgohary Jun 12, 2024
354edac
Remove script, edit workflow
zaelgohary Jun 12, 2024
bfd5029
Merge pull request #2917 from threefoldtech/development_2.6_filter_no…
zaelgohary Jun 13, 2024
b17a71c
Merge pull request #2969 from threefoldtech/development_2.6_fix_count…
zaelgohary Jun 13, 2024
f529188
Merge pull request #2971 from threefoldtech/development_2.6_add_no_IP…
zaelgohary Jun 13, 2024
2ee9c0f
Fix typo
zaelgohary Jun 13, 2024
7003247
Merge pull request #2932 from threefoldtech/development_2.6_nostr
zaelgohary Jun 13, 2024
239eac6
fix: Apply comments requested from @zaelgohary:
Mahmoud-Emad Jun 13, 2024
0aa0577
Use yarn audit workflow
zaelgohary Jun 13, 2024
0d985de
Merge pull request #2970 from threefoldtech/development_2.6_edit_err_msg
zaelgohary Jun 13, 2024
3a9fdb9
Change label
zaelgohary Jun 13, 2024
98e4198
Edit issue title
zaelgohary Jun 13, 2024
0cd773f
Change job name
zaelgohary Jun 13, 2024
d352dd0
Add link checker workflow
zaelgohary Jun 13, 2024
aca8b0d
Edit workflow
zaelgohary Jun 13, 2024
bd6b485
Edit workflow
zaelgohary Jun 13, 2024
189193b
Test workflow
zaelgohary Jun 13, 2024
e0a18a9
Edit workflow
zaelgohary Jun 13, 2024
c8ec0f3
add ip validation to check if ip exists in all farms
amiraabouhadid Jun 13, 2024
a2fded9
- Center all items vertically
samaradel Jun 13, 2024
b3fde30
extract ip check conditional to a function, remove repeated code
amiraabouhadid Jun 19, 2024
1944556
Merge pull request #2963 from threefoldtech/development_2.6_node_publ…
AhmedHanafy725 Jun 19, 2024
9892064
update date time format
amiraabouhadid Jun 19, 2024
a56cd38
Revert "update date time format"
amiraabouhadid Jun 19, 2024
5eafcc1
update date time format
amiraabouhadid Jun 19, 2024
2204a9b
switch day and month
amiraabouhadid Jun 19, 2024
a40ce95
Adding validation to admin email field
maayarosama Jun 19, 2024
44ac65b
Use chip group in delete IPs
zaelgohary Jun 19, 2024
e9d9323
Adding ipv6 to all applications
maayarosama Jun 19, 2024
fad9448
Edit link checker
zaelgohary Jun 19, 2024
d0ea591
discard changed link
zaelgohary Jun 19, 2024
2c87259
update month to month name instead of number, make year 4 digits
amiraabouhadid Jun 19, 2024
628105f
make month name first 3 letters only
amiraabouhadid Jun 19, 2024
4ade16d
Remove chip group and use margin instead
zaelgohary Jun 19, 2024
e887243
Remove create issue part
zaelgohary Jun 19, 2024
5ce75b6
Set workflow to run daily at 8 am
zaelgohary Jun 19, 2024
9c8e87a
Adding the network component in node pilot
maayarosama Jun 19, 2024
4a1f2e6
Update packages/playground/src/dashboard/components/add_ip.vue
amiraabouhadid Jun 19, 2024
cb845e9
Update packages/playground/src/dashboard/components/add_ip.vue
amiraabouhadid Jun 19, 2024
b77d097
Merge pull request #2990 from threefoldtech/dev_2.6_update_datetime_f…
amiraabouhadid Jun 19, 2024
2cbb3ca
Feat: introduce new way to parse tfchain errors
0oM4R Jun 19, 2024
8363e82
Chore: mark grid as raw to disable converting it by Vue to proxy
0oM4R Jun 19, 2024
d0d4e08
Merge pull request #2968 from threefoldtech/development_2.6_audit_fix…
zaelgohary Jun 19, 2024
2dc2a38
Feat: introduce new way to parse tfchain errors
0oM4R Jun 19, 2024
12fbc33
Chore: mark grid as raw to disable converting it by Vue to proxy
0oM4R Jun 19, 2024
ab3b477
Merge branch 'development_tfchain_error' of github.com:threefoldtech/…
0oM4R Jun 20, 2024
73281ec
Merge branch 'development' into development_2.6
AhmedHanafy725 Jun 20, 2024
2d479cc
Merge branch 'development_2.6' of github.com:threefoldtech/tfgrid-sdk…
0oM4R Jun 20, 2024
a1f095c
fix validation target value
amiraabouhadid Jun 20, 2024
55b3107
fix validation value
amiraabouhadid Jun 20, 2024
d8cf949
Merge pull request #2987 from threefoldtech/development_2.6_add_ip_vald
amiraabouhadid Jun 20, 2024
6372824
Merge pull request #2980 from threefoldtech/development_2.6_link_checker
zaelgohary Jun 20, 2024
4cb944a
Merge pull request #2994 from threefoldtech/development_2.6_node_pilot
maayarosama Jun 23, 2024
2611309
Merge pull request #2991 from threefoldtech/development_2.6_discourse…
maayarosama Jun 23, 2024
3f6d5c5
feat: Update Algorand resource requirements: (#3001)
Mahmoud-Emad Jun 23, 2024
59a53cb
style: Improved styling and functionality of application cards display
Mahmoud-Emad Jun 23, 2024
edfc0eb
- Let last card takes the full width
samaradel Jun 23, 2024
d304f93
Update ssh keys chip style, remove unused code
zaelgohary Jun 23, 2024
be0b48e
Merge branch 'development_2.6' into development_2.6_ipv6
maayarosama Jun 23, 2024
a545262
Adding ipv6 to caprover, owncloud and freeflow
maayarosama Jun 23, 2024
9cdba32
feat: Calculate the root file system when creating the deployment mac…
Mahmoud-Emad Jun 23, 2024
7ef8313
Merge pull request #2992 from threefoldtech/development_2.6_chip_group
zaelgohary Jun 23, 2024
77bfad5
add alert to add gpu cards
amiraabouhadid Jun 23, 2024
fd845b7
remove horizontal margin
amiraabouhadid Jun 23, 2024
235f705
Update packages/playground/src/components/node_selector/TfSelectGpu.vue
amiraabouhadid Jun 23, 2024
ef16fe4
Merge pull request #3008 from threefoldtech/dev_2.6_fix_gpu_alert
amiraabouhadid Jun 23, 2024
1f916fe
Add domain to node pilot
zaelgohary Jun 23, 2024
077aa55
chore: Replaced the `rootFS` function with the GC:
Mahmoud-Emad Jun 23, 2024
cde0ec2
style: Adjust card heights dynamically
Mahmoud-Emad Jun 24, 2024
8a461ae
chore: Updated the ZMachineData type.
Mahmoud-Emad Jun 24, 2024
a24581d
Merge pull request #2995 from threefoldtech/development_tfchain_error
0oM4R Jun 24, 2024
734ae77
Merge pull request #3006 from threefoldtech/development_2.6_calculate…
Mahmoud-Emad Jun 24, 2024
56debf3
Feat: add script to generate Types and modify the generated files
0oM4R Jun 24, 2024
9358865
Feat: Type generation
0oM4R Jun 24, 2024
fd0ba23
Feat: Type generation
0oM4R Jun 24, 2024
9f7ce01
Feat: Type generation
0oM4R Jun 24, 2024
09ab735
refactor: make powerTarget compatable with chain types
0oM4R Jun 24, 2024
3db714d
Merge branch 'development' into development_2.6
AhmedHanafy725 Jun 25, 2024
c4c73fb
Merge pull request #2989 from threefoldtech/development_2.6_node_stat…
samaradel Jun 25, 2024
f07edad
style: use Teleport for proper page hierarchy:
Mahmoud-Emad Jun 25, 2024
2492f60
Merge branch 'development_2.6' of https://github.com/threefoldtech/tf…
zaelgohary Jun 25, 2024
8f4d7a6
Merge branch 'development_2.6' into development_2.6_responsive_applic…
Mahmoud-Emad Jun 25, 2024
df84366
fix: Applied changes:
Mahmoud-Emad Jun 25, 2024
c776d6a
Create VM interface, Fix typos
zaelgohary Jun 25, 2024
af86453
Merge pull request #3014 from threefoldtech/development_2.6_grid_clie…
Mahmoud-Emad Jun 25, 2024
349d24d
Fix import, edit type
zaelgohary Jun 25, 2024
945ab1b
Merge branch 'development_2.6' into development_2.6_ipv6
maayarosama Jun 25, 2024
cdda708
Merge pull request #2993 from threefoldtech/development_2.6_ipv6
maayarosama Jun 25, 2024
329c091
Docs: add generateTypes docs
0oM4R Jun 25, 2024
6e5c58f
style: Update the application cards:
Mahmoud-Emad Jun 26, 2024
62ff834
Merge pull request #3003 from threefoldtech/development_2.6_responsiv…
Mahmoud-Emad Jun 26, 2024
041c511
Add zmachine tests
zaelgohary Jun 26, 2024
72ec46c
Replace VM type in Grid Client instead of Playground
zaelgohary Jun 26, 2024
2b16955
Merge branch 'development_2.6' of https://github.com/threefoldtech/tf…
zaelgohary Jun 26, 2024
c4ebdf5
Edit VM type
zaelgohary Jun 26, 2024
ed07d6c
feat: Add optional pagination in list table
MohamedElmdary Jun 26, 2024
db239ea
fix: generateTypes.md
0oM4R Jun 26, 2024
8f33ea1
Merge pull request #3039 from threefoldtech/development_2.6_zmachine_…
zaelgohary Jun 27, 2024
252d809
Merge branch 'development' into development_2.6
AhmedHanafy725 Jun 27, 2024
9113a08
Merge branch 'development_2.6' of https://github.com/threefoldtech/tf…
zaelgohary Jun 27, 2024
f52cd67
Edit flist
zaelgohary Jun 27, 2024
371f6d1
Fix: watch userBalance to calc the discount
0oM4R Jun 27, 2024
b6e4be1
Extend VM from ZMachineData
zaelgohary Jun 27, 2024
1a652cc
Merge pull request #3043 from threefoldtech/development_2.6_add_list_…
MohamedElmdary Jun 27, 2024
68fe8b8
Merge pull request #3010 from threefoldtech/development_2.6_node_pilo…
zaelgohary Jun 27, 2024
a0f77b4
Fix: respect useCurrentBalance if userBalance got changed
0oM4R Jun 27, 2024
49fd8fc
Chore: update userBalance watcher condition
0oM4R Jun 27, 2024
24df4c5
Add gitea image
zaelgohary Jun 27, 2024
788b94e
Merge pull request #3047 from threefoldtech/development_2.6_priceCalc
0oM4R Jul 1, 2024
ff4d10b
Merge pull request #2934 from threefoldtech/development_2.6_gitea
zaelgohary Jul 1, 2024
ceb447e
Cecking if ipv4 is true to display the bandwidth note and adding the …
maayarosama Jul 2, 2024
363d0a9
Merge pull request #3064 from threefoldtech/development_2.6_bandwidth…
maayarosama Jul 2, 2024
f32a697
Merge branch 'development' into development_2.6
AhmedHanafy725 Jul 2, 2024
ca8d7d7
fix: Added the attach attr to the dialog in the farms view.
Mahmoud-Emad Jul 2, 2024
8576aac
chore: fix typo
0oM4R Jul 2, 2024
9b27d34
Merge pull request #3020 from threefoldtech/development_chainTypes
0oM4R Jul 2, 2024
eb39bcb
Merge pull request #3022 from threefoldtech/development_2.6_teleport_…
Mahmoud-Emad Jul 2, 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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Full Clients Build

on:
push:
branches: [development, development_314]
branches: [development, development_2.6]
pull_request:
branches: [development, development_314]
branches: [development, development_2.6]

jobs:
build:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/link_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Link Checker

on:
schedule:
- cron: '0 8 * * *'

jobs:
check-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Link Checker
id: checker
uses: docker://ghcr.io/threefoldfoundation/website-link-checker:latest
with:
args: 'https://staging.dashboard.dev.grid.tf -e 404 501 503 504 -w all'
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Full Clients Lint

on:
push:
branches: [development, development_314]
branches: [development, development_2.6]
pull_request:
branches: [development, development_314]
branches: [development, development_2.6]

jobs:
lint:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/playground_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
push:
branches:
- development
- development_314
- development_2.6
paths:
- "packages/playground/**"
pull_request:
branches:
- development
- development_314
- development_2.6
paths:
- "packages/playground/**"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stats_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ name: Stats Build

on:
push:
branches: [development, development_314]
branches: [development, development_2.6]
paths:
- "packages/stats/**"
pull_request:
branches: [development, development_314]
branches: [development, development_2.6]
paths:
- "packages/stats/**"

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/yarn_audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# When the action is executed, it runs yarn audit command in all the paths that is mentioned in the input. The exit codes of the commands are compared and if it is greater than 7 (only high severity as of now), the action will try to fetch the open issues in the repo with the label provided in the input. The label is mandatory to prevent from creating duplicate issues. If there are no open issues with the given label in open state, the action will try to create a Github Issue with the details provided in the input.

name: Full Clients Audit

on:
push:
branches: [development, development_2.6]
pull_request:
branches: [development, development_2.6]

jobs:
audit-and-open-issue:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Yarn Audit
uses: pragatheeswarans/[email protected]
with:
token: ${{ github.token }}
label: 'audit'
title: "${{ github.workflow }}: Critical Security Vulnerability Identified"
description: 'High severity issues are identified in the repo.'
paths: |
.
16 changes: 9 additions & 7 deletions packages/grid_client/scripts/single_vm.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { MachinesModel } from "../src";
import { GridClient, MachinesModel } from "../src";
import { type ZmachineData } from "../src/helpers/types";
import { config, getClient } from "./client_loader";
import { log } from "./utils";

async function deploy(client, vms) {
async function deploy(client: GridClient, vms: MachinesModel) {
const res = await client.machines.deploy(vms);
log("================= Deploying VM =================");
log(res);
log("================= Deploying VM =================");
}

async function getDeployment(client, vms) {
const res = await client.machines.getObj(vms);
async function getDeployment(client: GridClient, name: string): Promise<ZmachineData[]> {
const res = await client.machines.getObj(name);
log("================= Getting deployment information =================");
log(res);
log("================= Getting deployment information =================");
return res;
}

async function cancel(client, vms) {
const res = await client.machines.delete(vms);
async function cancel(client: GridClient, name: string) {
const res = await client.machines.delete({ name: name });
log("================= Canceling the deployment =================");
log(res);
log("================= Canceling the deployment =================");
Expand Down Expand Up @@ -69,7 +71,7 @@ async function main() {
await getDeployment(grid3, name);

//Uncomment the line below to cancel the deployment
// await cancel(grid3, { name });
// await cancel(grid3, name);

await grid3.disconnect();
}
Expand Down
2 changes: 2 additions & 0 deletions packages/grid_client/src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export * from "./events";
export * from "./validator";
export * from "./expose";
export * from "./migration";
export * from "./root_fs";
export * from "./types";
39 changes: 39 additions & 0 deletions packages/grid_client/src/helpers/root_fs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Decimal } from "decimal.js";

const GB = 1024;

interface RootFSOptions {
/** The machine CPU, should be in cores e.g. 5 cores*/
CPUCores: number;
/** The machine memory, should be in megabytes e.g. 1024 or 2048 MG*/
RAMInMegaBytes: number;
}

/**
* Calculate the root filesystem size (CU - Compute Units) based on provided options.
*
* This function calculates the compute units (CU) required based on the CPU cores and RAM in megabytes.
* If both CPU cores and RAM are provided in the `options` parameter, it calculates CU by multiplying
* the CPU cores with RAM and dividing by 8 * GB, then converting the result to an integer. If the
* calculated CU is zero, it returns 500 / GB; otherwise, it returns 2.
*
* @param {RootFSOptions} [options] - Optional configuration object.
* @param {number} [options.CPUCores] - The number of CPU cores.
* @param {number} [options.RAMInMegaBytes] - The RAM size in megabytes.
*
* @returns {number} - The calculated compute units (CU) based on the provided options.
*/
function calculateRootFileSystem(options?: RootFSOptions): number {
let cu = 0;

if (options && options.CPUCores && options.RAMInMegaBytes) {
cu = new Decimal(options.CPUCores)
.mul(options.RAMInMegaBytes)
.divToInt(8 * GB)
.toNumber();
}

return cu === 0 ? 500 / GB : 2;
}

export { calculateRootFileSystem, RootFSOptions };
100 changes: 100 additions & 0 deletions packages/grid_client/src/helpers/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { PublicIPResult, ResultStates } from "../zos";

interface NetworkInterface {
/** The network identifier */
network: string;
/** The IP address of the interface */
ip: string;
}

interface ComputeCapacity {
/** Number of CPU cores allocated */
cpu: number;
/** Amount of memory allocated in MB */
memory: number;
}

interface BaseMountData {
/** The name of the mount */
name: string;
/** The mount point in the filesystem */
mountPoint: string;
}

interface ExtendedMountData extends BaseMountData {
/** The size of the mount (optional) */
size?: number;
/** The state of the mount result (optional) */
state?: ResultStates;
/** Message providing additional information about the mount result (optional) */
message?: string;
/** Cache information (optional) */
cache?: any;
/** Prefix information (optional) */
prefix?: any;
/** Minimal shards (optional) */
minimal_shards?: number;
/** Expected shards (optional) */
expected_shards?: number;
/** QSFS ZDBs name (optional) */
qsfs_zdbs_name?: string;
/** Metrics endpoint (optional) */
metricsEndpoint?: string;
}

// Union type for the mount data
type MountData = BaseMountData | ExtendedMountData;

interface ZmachineData {
/** The version of the workload */
version: number;
/** The contract ID associated with the workload */
contractId: number;
/** The node ID where the workload is deployed */
nodeId: string;
/** The name of the workload */
name: string;
/** The creation timestamp of the workload result */
created: number;
/** The current state of the workload */
status: string;
/** Message providing additional information about the workload state */
message: string;
/** The flist (file list) used by the workload */
flist: string;
/** The public IP address obtained by the machine */
publicIP: PublicIPResult;
/** The planetary IP address of the machine */
planetary: string;
/** The Mycelium IP address of the machine, if applicable */
myceliumIP: string;
/** List of network interfaces */
interfaces: NetworkInterface[];
/** The compute capacity (CPU and memory) allocated to the machine */
capacity: ComputeCapacity;
/** List of mounts associated with the machine */
mounts: MountData[];
/** Environment variables set for the workload */
env: Record<string, unknown>;
/** The entrypoint command for the workload */
entrypoint: string;
/** Metadata associated with the workload */
metadata: string;
/** Description of the workload */
description: string;
/** Size of the root filesystem */
rootfs_size: number;
/** Indicates if corex is enabled */
corex: boolean;
/** The list of the GPUs */
gpu: string[] | undefined;
}

interface VM extends ZmachineData {
customDomain?: string;
deploymentName: string;
projectName: string;
wireguard: string;
}

export { ZmachineData, VM };
7 changes: 7 additions & 0 deletions packages/grid_client/src/high_level/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { GridClientErrors, ValidationError } from "@threefold/types";
import { Addr } from "netaddr";

import { events } from "../helpers/events";
import { calculateRootFileSystem } from "../helpers/root_fs";
import { randomChoice, zeroPadding } from "../helpers/utils";
import { validateHexSeed } from "../helpers/validator";
import { DiskModel, MyceliumNetworkModel, QSFSDiskModel } from "../modules/models";
Expand Down Expand Up @@ -53,6 +54,12 @@ class VMHL extends HighLevelBase {
zlogsOutput?: string,
gpus: string[] = [],
): Promise<[TwinDeployment[], string]> {
if (!rootfs_size) {
rootfs_size = calculateRootFileSystem({
CPUCores: cpu,
RAMInMegaBytes: memory,
});
}
const deployments: TwinDeployment[] = [];
const workloads: Workload[] = [];
let totalDisksSize = rootfs_size;
Expand Down
3 changes: 2 additions & 1 deletion packages/grid_client/src/modules/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { GqlNodeContract, RMB } from "../clients";
import { TFClient } from "../clients/tf-grid/client";
import { GridClientConfig } from "../config";
import { formatErrorMessage } from "../helpers";
import { type ZmachineData } from "../helpers/types";
import { HighLevelBase } from "../high_level/base";
import { KubernetesHL } from "../high_level/kubernetes";
import { VMHL } from "../high_level/machine";
Expand Down Expand Up @@ -306,7 +307,7 @@ class BaseModule {
return null;
}

async _getZmachineData(deploymentName: string, deployments, workload: Workload): Promise<Record<string, unknown>> {
async _getZmachineData(deploymentName: string, deployments, workload: Workload): Promise<ZmachineData> {
const data = workload.data as Zmachine;
const resultData = workload.result.data as ZmachineResult;
return {
Expand Down
64 changes: 64 additions & 0 deletions packages/grid_client/tests/modules/zmachine.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { ComputeCapacity, Mount, Zmachine, ZmachineNetwork } from "../../src";

const zmachine = new Zmachine();

beforeAll(() => {
const computeCapacity = new ComputeCapacity();
computeCapacity.cpu = 1;
computeCapacity.memory = 5;

const network = new ZmachineNetwork();
network.planetary = true;
network.public_ip = "10.249.0.0/16";
network.interfaces = [
{
network: "znetwork",
ip: "10.20.2.2",
},
];

const rootfs_size = 2;

const disks = new Mount();
disks.name = "zdisk";
disks.mountpoint = "/mnt/data";

zmachine.flist = "https://hub.grid.tf/tf-official-vms/ubuntu-22.04.flist";
zmachine.network = network;
zmachine.size = rootfs_size * 1024 ** 3;
zmachine.mounts = [disks];
zmachine.entrypoint = "/sbin/zinit init";
zmachine.compute_capacity = computeCapacity;
zmachine.env = {};
zmachine.corex = false;
zmachine.gpu = [];
});

describe("Zmachine Class Tests", () => {
it("should create a valid Zmachine instance", () => {
expect(zmachine).toBeInstanceOf(Zmachine);
});

it("should correctly compute the challenge string", () => {
const expectedChallenge =
"https://hub.grid.tf/tf-official-vms/ubuntu-22.04.flist" +
"10.249.0.0/16" +
"true" +
"znetwork" +
"10.20.2.22" +
"14748364815" +
"zdisk" +
"/mnt/data" +
"/sbin/zinit init";

expect(zmachine.challenge()).toBe(expectedChallenge);
});

it("should fail validation for missing required fields", () => {
const result = () => {
zmachine.flist = "";
zmachine.entrypoint = "";
};
expect(result).toThrow();
});
});
Loading
Loading