Skip to content

Commit

Permalink
chore: cleaned up code and logs
Browse files Browse the repository at this point in the history
  • Loading branch information
eikc committed Sep 1, 2020
1 parent 037bb7b commit 796b6f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
4 changes: 0 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3103,11 +3103,9 @@ function run() {
yield kubectl_1.setupKubectl(core.getInput('kubectl'));
yield setImages(registry, imageInputs, overlay);
yield deploy();
core.info(`monitoring: ${monitoring}`);
if (monitoring === "true") {
yield monitorDeployment();
}
yield execHelper("kubectl", ["get", "pods", "-n", "mityousee-staging"]);
});
}
const setImages = (registry, imageInputs, overlay) => __awaiter(void 0, void 0, void 0, function* () {
Expand Down Expand Up @@ -3135,11 +3133,9 @@ const monitorDeployment = () => __awaiter(void 0, void 0, void 0, function* () {
const resourceLocation = `${process.cwd()}/resources.yaml`;
const file = fs_1.default.readFileSync(resourceLocation);
const manifests = yaml_1.default.parseAllDocuments(file.toString('utf8'));
core.info(JSON.stringify(manifests));
const deployments = manifests
.map(x => x.toJSON())
.filter((x) => x.kind === "Deployment" || x.kind === "StatefulSet" || x.kind === "DaemonSet");
core.info(JSON.stringify(deployments));
for (const deployment of deployments) {
yield execHelper("kubectl", [
"rollout",
Expand Down
8 changes: 2 additions & 6 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ async function run() {

await setImages(registry, imageInputs, overlay)
await deploy()
core.info(`monitoring: ${monitoring}`)

if (monitoring === "true") {
await monitorDeployment()
}

await execHelper("kubectl", ["get", "pods", "-n", "mityousee-staging"])
}

const setImages = async (registry, imageInputs, overlay) => {
Expand Down Expand Up @@ -55,13 +53,10 @@ const monitorDeployment = async () => {

const file = fs.readFileSync(resourceLocation)
const manifests = YAML.parseAllDocuments(file.toString('utf8'))
core.info(JSON.stringify(manifests))
const deployments = manifests
.map(x => x.toJSON())
.filter((x: any) => x.kind === "Deployment" || x.kind === "StatefulSet" || x.kind === "DaemonSet") as any[];

core.info(JSON.stringify(deployments))

for (const deployment of deployments) {
await execHelper("kubectl", [
"rollout",
Expand Down Expand Up @@ -100,4 +95,5 @@ const execHelper = async (tool, args: string[], options: exec.ExecOptions = {})

return exitCode
}

run().catch(core.setFailed)

0 comments on commit 796b6f1

Please sign in to comment.