-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into development_add_storing_arch_decision
- Loading branch information
Showing
76 changed files
with
1,296 additions
and
393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Mass Deployments | ||
|
||
on: | ||
schedule: | ||
- cron: "0 1 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
mass-deployments: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
env: | ||
NETWORK: main | ||
RMB_PROXY: true | ||
STORE_SECRET: secret | ||
MNEMONIC: ${{ secrets.MNEMONIC }} | ||
SSH_KEY: ${{ secrets.SSH_KEY }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up node 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "yarn" | ||
|
||
- name: Install deps | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y git libtool tmux redis net-tools | ||
- name: Install | ||
run: | | ||
yarn | ||
lerna run build --no-private | ||
- name: Run test mass deployments | ||
id: massdeployments | ||
continue-on-error: true | ||
run: | | ||
yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/mass_deployments.ts | ||
- name: Cleanup - Delete all contracts | ||
id: deleteall | ||
run: | | ||
yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/delete_all_contracts.ts | ||
- name: Test Results | ||
run: | | ||
echo Batch Vms: ${{ steps.massdeployments.outcome }} | ||
echo Delete all contracts: ${{ steps.deleteall.outcome }} | ||
- name: Check test script status | ||
if: | | ||
steps.massdeployments.outcome != 'success' | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json", | ||
"version": "2.1.1", | ||
"version": "2.2.0-rc4", | ||
"npmClient": "yarn" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import { | ||
DiskModel, | ||
FarmFilterOptions, | ||
FilterOptions, | ||
generateString, | ||
MachineModel, | ||
MachinesModel, | ||
NetworkModel, | ||
randomChoice, | ||
} from "../src"; | ||
import { config, getClient } from "./client_loader"; | ||
import { log } from "./utils"; | ||
|
||
async function main() { | ||
const grid3 = await getClient(); | ||
|
||
const errors: any = []; | ||
let failedCount = 0; | ||
let successCount = 0; | ||
|
||
for (let i = 0; i < 100; i++) { | ||
//Generating the resources | ||
const cru = 1; | ||
const mru = 256; | ||
const diskSize = 5; | ||
const rootFs = 1; | ||
const vmName = "vm" + generateString(8); | ||
const deploymentName = "dep" + generateString(8); | ||
const publicIp = false; | ||
|
||
// create network Object | ||
const n = new NetworkModel(); | ||
n.name = "nw" + generateString(5); | ||
n.ip_range = "10.238.0.0/16"; | ||
|
||
// create disk Object | ||
const disk1 = new DiskModel(); | ||
disk1.name = "d" + generateString(5); | ||
disk1.size = diskSize; | ||
disk1.mountpoint = "/newDisk1"; | ||
|
||
//Farm Selection | ||
const farms = await grid3.capacity.filterFarms({ | ||
nodeMRU: mru / 1024, | ||
nodeSRU: diskSize + rootFs, | ||
publicIp: publicIp, | ||
availableFor: await grid3.twins.get_my_twin_id(), | ||
randomize: true, | ||
} as FarmFilterOptions); | ||
|
||
if (farms.length < 1) { | ||
throw new Error("No farms found"); | ||
} | ||
|
||
//Node Selection | ||
const nodes = await grid3.capacity.filterNodes({ | ||
cru: cru, | ||
mru: mru / 1024, | ||
sru: rootFs + diskSize, | ||
availableFor: await grid3.twins.get_my_twin_id(), | ||
farmId: +randomChoice(farms).farmId, | ||
randomize: true, | ||
} as FilterOptions); | ||
|
||
if (nodes.length < 1) { | ||
errors.push("Node not found"); | ||
failedCount++; | ||
continue; | ||
} | ||
|
||
// create vm node Object | ||
const vm = new MachineModel(); | ||
vm.name = vmName; | ||
vm.node_id = nodes[0].nodeId; | ||
vm.disks = [disk1]; | ||
vm.public_ip = publicIp; | ||
vm.planetary = true; | ||
vm.cpu = cru; | ||
vm.memory = mru; | ||
vm.rootfs_size = rootFs; | ||
vm.flist = "https://hub.grid.tf/tf-official-apps/base:latest.flist"; | ||
vm.entrypoint = "/sbin/zinit init"; | ||
vm.env = { | ||
SSH_KEY: config.ssh_key, | ||
}; | ||
|
||
// create VMs Object | ||
const vms = new MachinesModel(); | ||
vms.name = deploymentName; | ||
vms.network = n; | ||
vms.machines = [vm]; | ||
vms.metadata = ""; | ||
vms.description = "test deploying VMs via ts grid3 client"; | ||
|
||
// deploy vm | ||
try { | ||
await grid3.machines.deploy(vms); | ||
successCount++; | ||
} catch (error) { | ||
log(error); | ||
errors.push(error); | ||
failedCount++; | ||
continue; | ||
} | ||
} | ||
|
||
log("Successful Deployments: " + successCount); | ||
log("Failed Deployments: " + failedCount); | ||
|
||
// List of failed deployments errors | ||
log("Failed deployments errors: "); | ||
for (let i = 0; i < errors.length; i++) { | ||
log(errors[i]); | ||
log("---------------------------------------------"); | ||
} | ||
|
||
await grid3.disconnect(); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.