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

chore(containers): modernize #24

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 2 additions & 14 deletions containers/helm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@ const fs = require('fs');
const path = require('path');
const crypto = require('crypto');

function findWorkdir(scope) {
if (typeof(scope.workdir) == "string") {
return scope.workdir;
}

const parent = scope.node.scope;
if (!parent) {
throw new Error("cannot determine workdir");
}
return findWorkdir(parent);
}

exports.toHelmChart = function(chart) {

exports.toHelmChart = function (wingdir, chart) {
const app = cdk8s.App.of(chart);
const wingdir = findWorkdir(chart);

app.resolvers = [new cdk8s.LazyResolver(), new cdk8s.ImplicitTokenResolver(), new cdk8s.NumberStringUnionResolver()];
const docs = cdk8s.App._synthChart(chart);
Expand Down
2 changes: 1 addition & 1 deletion containers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/containers",
"version": "0.0.16",
"version": "0.0.17",
"description": "Container support for Wing",
"repository": {
"type": "git",
Expand Down
5 changes: 4 additions & 1 deletion containers/utils.w
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ bring fs;
pub class Util {
extern "./utils.js" pub static inflight shell(command: str, args: Array<str>, cwd: str?): str;
extern "./utils.js" pub static contentHash(files: Array<str>, cwd: str): str;
extern "./utils.js" pub static entrypointDir(scope: std.IResource): str;
extern "./utils.js" pub static dirname(): str;

pub static entrypointDir(scope: std.IResource): str {
return std.Node.of(scope).app.entrypointDir;
}

pub static isPath(s: str): bool {
return s.startsWith("/") || s.startsWith("./");
}
Expand Down
5 changes: 3 additions & 2 deletions containers/workload.tfaws.w
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ pub class Workload_tfaws {
}

pub toHelm(): str {
return _Chart.toHelmChart(this);
let wingdir = std.Node.of(this).app.workdir;
return _Chart.toHelmChart(wingdir, this);
}

extern "./helm.js" pub static toHelmChart(chart: cdk8s.Chart): str;
extern "./helm.js" pub static toHelmChart(wingdir: str, chart: cdk8s.Chart): str;
}


Expand Down