Skip to content

Commit

Permalink
fix zsh issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vmleon committed Jun 11, 2024
1 parent 81cfe96 commit c0b30e2
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 108 deletions.
2 changes: 0 additions & 2 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { getNamespace, getRegionByName } from "./lib/oci.mjs";
import { checkPodmanMachineRunning, buildImage } from "./lib/container.mjs";
import { getVersionGradle } from "./lib/gradle.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

checkPodmanMachineRunning();
Expand Down
2 changes: 0 additions & 2 deletions scripts/bump.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
import { bump } from "./lib/npm.mjs";
import { bumpGradle, getVersionGradle } from "./lib/gradle.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

let properties = await readEnvJson();
Expand Down
2 changes: 0 additions & 2 deletions scripts/ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
} from "./lib/oci.mjs";
import { readEnvJson } from "./lib/utils.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

let properties = await readEnvJson();
Expand Down
132 changes: 52 additions & 80 deletions scripts/containerInstances.mjs
Original file line number Diff line number Diff line change
@@ -1,41 +1,15 @@
#!/usr/bin/env zx
import {
getNamespace,
setVariableFromEnvOrPrompt,
writeEnvJson,
generateRandomString,
readEnvJson,
} from "./lib/utils.mjs";
import {
getRegions,
getTenancyId,
} from "./lib/oci.mjs";
import {
containerLogin,
whichContainerEngine,
checkPodmanMachineRunning,
} from "./lib/container.mjs";
import { readEnvJson } from "./lib/utils.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = true;

const {
containerRegistryURL,
containerRegistryUser,
containerRegistryToken,
namespace,
regionKey,
adbCompartmentId,
adbName,
adbPassword,
} = await readEnvJson();
$.verbose = true;

const { containerRegistryURL, containerRegistryUser, containerRegistryToken } =
await readEnvJson();

// const region = env.REGION || await setVariableFromEnvOrPrompt("REGION", "Enter the region: ", getRegions);

const createContainerInstances = async (attributes) => {

const output = await $`oci container-instances container-instance create \
const output = await $`oci container-instances container-instance create \
--display-name "${attributes.displayName}" \
--availability-domain "${attributes.ad_ocid}" \
--compartment-id "${attributes.compartment_ocid}" \
Expand All @@ -45,62 +19,60 @@ const createContainerInstances = async (attributes) => {
--containers ${JSON.stringify(containersArgs)} \
--image-pull-secrets ${JSON.stringify(secretsArgs)} \
--vnics ${JSON.stringify(vnicsArgs)} --debug`;
return output;
};
return output;
};

const attributes = {
"displayName": "autoDeploTest",
"compartment_ocid": "xxx",
"ad_ocid": "xxx",
"subnet_ocid": "xxx",
"containerRegistryURL": containerRegistryURL,
"containerRegistryUser": containerRegistryUser,
"region": "xxx",
"servercontainerURL": "xxx.ocir.io/xxx/save-the-wildlife/server:0.0.8",
"webcontainerURL": "xxx.ocir.io/xxx/save-the-wildlife/web:0.0.8",
};
const attributes = {
displayName: "autoDeploTest",
compartment_ocid: "xxx",
ad_ocid: "xxx",
subnet_ocid: "xxx",
containerRegistryURL: containerRegistryURL,
containerRegistryUser: containerRegistryUser,
region: "xxx",
servercontainerURL: "xxx.ocir.io/xxx/save-the-wildlife/server:0.0.8",
webcontainerURL: "xxx.ocir.io/xxx/save-the-wildlife/web:0.0.8",
};

const vnicsArgs = [
{ displayName: "multiplayer vcn", subnetId: `${attributes.subnet_ocid}` },
];
const vnicsArgs = [
{ displayName: "multiplayer vcn", subnetId: `${attributes.subnet_ocid}` },
];

const secretsArgs = [
{
password:btoa(containerRegistryToken),
registryEndpoint:containerRegistryURL,
secretType:"BASIC",
username:btoa(containerRegistryUser)
}
];
const secretsArgs = [
{
password: btoa(containerRegistryToken),
registryEndpoint: containerRegistryURL,
secretType: "BASIC",
username: btoa(containerRegistryUser),
},
];

const containersArgs = [
{
displayName: "ServerContainer2",
imageUrl: `${attributes.servercontainerURL}`,
resourceConfig: {
memoryLimitInGBs: 8,
vcpusLimit: 1.5,
},
{
displayName: "ServerContainer2",
imageUrl: `${attributes.servercontainerURL}`,
resourceConfig: {
memoryLimitInGBs: 8,
vcpusLimit: 1.5,
},
{
displayName: "WebContainer2",
imageUrl: `${attributes.webcontainerURL}`,
resourceConfig: {
memoryLimitInGBs: 8,
vcpusLimit: 1.5,
},
},
{
displayName: "WebContainer2",
imageUrl: `${attributes.webcontainerURL}`,
resourceConfig: {
memoryLimitInGBs: 8,
vcpusLimit: 1.5,
},
];
},
];

const output = await createContainerInstances(attributes);


const output = await createContainerInstances(attributes);

console.log(output);

console.log(output);

const display_name = "test";
const compartment_ocid = "xx";
const ad_ocid = "xxx";
// const subnet_ocid = await setVariableFromEnvOrPrompt("SUBNET_OCID", "Enter the OCID of the subnet: ");
const display_name = "test";
const compartment_ocid = "xx";
const ad_ocid = "xxx";
// const subnet_ocid = await setVariableFromEnvOrPrompt("SUBNET_OCID", "Enter the OCID of the subnet: ");

createContainerInstances();
2 changes: 0 additions & 2 deletions scripts/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { exitWithError, getVersion, readEnvJson } from "./lib/utils.mjs";
import { getVersionGradle } from "./lib/gradle.mjs";
import { downloadAdbWallet, listAdbDatabases } from "./lib/oci.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

const {
Expand Down
2 changes: 0 additions & 2 deletions scripts/kustom.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { getNpmVersion } from "./lib/npm.mjs";
import { getNamespace } from "./lib/oci.mjs";
import { exitWithError } from "./lib/utils.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

const { _ } = argv;
Expand Down
2 changes: 0 additions & 2 deletions scripts/release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
getVersionGradle,
} from "./lib/gradle.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

let properties = await readEnvJson();
Expand Down
11 changes: 5 additions & 6 deletions scripts/setenv.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import {
} from "./lib/container.mjs";
import { getVersionGradle } from "./lib/gradle.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

const ce = await whichContainerEngine();
Expand Down Expand Up @@ -141,8 +139,10 @@ async function adbDetails() {
"Autonomous Database password"
);

const adbDisplayName = await listAdbDatabasesbyname(adbName, adbCompartmentId);

const adbDisplayName = await listAdbDatabasesbyname(
adbName,
adbCompartmentId
);

properties = {
...properties,
Expand All @@ -152,8 +152,7 @@ async function adbDetails() {
adbPassword,
adbDisplayName,
};
// console.log("Properties:", properties);

// console.log("Properties:", properties);
}

async function printRegionNames(regions) {
Expand Down
2 changes: 0 additions & 2 deletions scripts/start_coherence.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import { exitWithError } from "./lib/utils.mjs";
import { whichContainerEngine } from "./lib/container.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

const containerName = "coherence_multiplayer";
Expand Down
2 changes: 0 additions & 2 deletions scripts/start_redis.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import { exitWithError } from "./lib/utils.mjs";
import { whichContainerEngine } from "./lib/container.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

const containerName = "redis_multiplayer";
Expand Down
2 changes: 0 additions & 2 deletions scripts/stop_coherence.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import { whichContainerEngine } from "./lib/container.mjs";
import { exitWithError } from "./lib/utils.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

const containerName = "coherence_multiplayer";
Expand Down
2 changes: 0 additions & 2 deletions scripts/stop_redis.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import { whichContainerEngine } from "./lib/container.mjs";
import { exitWithError } from "./lib/utils.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

const containerName = "redis_multiplayer";
Expand Down
2 changes: 0 additions & 2 deletions scripts/tfvars.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
} from "./lib/oci.mjs";
import { setVariableFromEnvOrPrompt, exitWithError } from "./lib/utils.mjs";

const shell = process.env.SHELL | "/bin/zsh";
$.shell = shell;
$.verbose = false;

const { _ } = argv;
Expand Down

0 comments on commit c0b30e2

Please sign in to comment.