Skip to content

Commit

Permalink
Merge pull request #7 from fluent-ci-templates/feat/pipeline-args
Browse files Browse the repository at this point in the history
feat: handle pipeline arguments
  • Loading branch information
tsirysndr authored Nov 8, 2023
2 parents 8eaa24a + 746a8e7 commit 4432e0d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
19 changes: 19 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts";
import Client from "https://sdk.fluentci.io/z1/mod.ts";
import Client from "https://sdk.fluentci.io/v0.2.0/mod.ts";
export default Client;

export { connect, uploadContext } from "https://sdk.fluentci.io/z1/mod.ts";
export { connect, uploadContext } from "https://sdk.fluentci.io/v0.2.0/mod.ts";
export { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts";
export { withDevbox } from "https://nix.fluentci.io/zenith/src/dagger/steps.ts";
export { withDevbox } from "https://nix.fluentci.io/v0.5.2/src/dagger/steps.ts";
export { stringifyTree } from "https://esm.sh/stringify-tree@1.1.1";
import gql from "https://esm.sh/graphql-tag@2.12.6";
export { gql };
Expand All @@ -21,6 +21,8 @@ export {
join,
resolve,
} from "https://deno.land/std@0.203.0/path/mod.ts";
export { parse } from "https://deno.land/std@0.205.0/flags/mod.ts";
export { snakeCase, camelCase } from "https://cdn.skypack.dev/lodash";

export * as FluentGitlabCI from "https://deno.land/x/fluent_gitlab_ci@v0.4.2/mod.ts";
export * as FluentGithubActions from "https://deno.land/x/fluent_github_actions@v0.2.1/mod.ts";
Expand Down
16 changes: 15 additions & 1 deletion src/dagger/runner.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
import pipeline from "./pipeline.ts";
import { parse, camelCase, snakeCase } from "../../deps.ts";

await pipeline(".", Deno.args);
const args = parse(Deno.args.map((x) => x.split(" ")).flat());

if (!Array.isArray(Deno.args)) {
for (const param of Object.keys(args)
.filter((x) => x !== "_")
.map((x) => snakeCase(x).toUpperCase())) {
Deno.env.set(param, args[camelCase(param)]);
}
}

await pipeline(
".",
Array.isArray(Deno.args) ? Deno.args : (args._ as string[])
);

0 comments on commit 4432e0d

Please sign in to comment.