Skip to content

Commit

Permalink
fix issue with dagger connect
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Jan 21, 2024
1 parent ba76d68 commit 6788393
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 59 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/rust-pipeline)](https://codecov.io/gh/fluent-ci-templates/rust-pipeline)

A ready-to-use CI/CD Pipeline for your Rust projects.

![Made with VHS](https://vhs.charm.sh/vhs-f5jk3sceXQrc55XC4fW3c.gif)

## 🚀 Usage

Run the following command in your Rust Project:
Expand Down Expand Up @@ -79,7 +82,7 @@ llvmCov(
You can also use this pipeline programmatically:

```ts
import { build, test } from "https://pkg.fluentci.io/rust_pipeline@v0.8.1/mod.ts";
import { build, test } from "https://pkg.fluentci.io/rust_pipeline@v0.8.2/mod.ts";

await test();
await build();
Expand Down
2 changes: 1 addition & 1 deletion ci.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
build,
test,
} from "https://pkg.fluentci.io/rust_pipeline@v0.8.1/mod.ts";
} from "https://pkg.fluentci.io/rust_pipeline@v0.8.2/mod.ts";

await test();
await build();
2 changes: 0 additions & 2 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts";
import { Client } from "./sdk/client.gen.ts";
export default Client;

export { connect, uploadContext } from "https://sdk.fluentci.io/v0.3.0/mod.ts";
export { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts";
Expand Down
2 changes: 0 additions & 2 deletions example/.fluentci/deps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts";
import { Client } from "./sdk/client.gen.ts";
export default Client;

export { connect, uploadContext } from "https://sdk.fluentci.io/v0.3.0/mod.ts";
export { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts";
Expand Down
20 changes: 1 addition & 19 deletions example/.fluentci/sdk/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ export async function connect(
config: ConnectOpts = {}
): Promise<void> {
let client: Client;
// let close: null | (() => void) = null;

if (Deno.env.has("FLUENTCI_TOKEN") && Deno.env.has("FLUENTCI_SESSION_ID")) {
const client = new Client({
host: Deno.env.get("FLUENTCI_HOST") || "vm.fluentci.io",
sessionToken: Deno.env.get("FLUENTCI_TOKEN"),
});
await cb(client).finally(() => {
if (close) {
close();
}
});
return;
}

// Prefer DAGGER_SESSION_PORT if set
const daggerSessionPort = Deno.env.get("DAGGER_SESSION_PORT");
Expand All @@ -81,9 +67,5 @@ export async function connect(
throw new Error("DAGGER_SESSION_PORT must be set");
}

await cb(client).finally(() => {
if (close) {
close();
}
});
await cb(client);
}
3 changes: 1 addition & 2 deletions example/.fluentci/src/dagger/jobs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Client from "../../deps.ts";
import { Directory, DirectoryID, File } from "../../sdk/client.gen.ts";
import { Directory, DirectoryID, File, Client } from "../../sdk/client.gen.ts";
import { connect } from "../../sdk/connect.ts";

export enum Job {
Expand Down
5 changes: 0 additions & 5 deletions example/.fluentci/src/dagger/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { uploadContext } from "../../deps.ts";
import * as jobs from "./jobs.ts";

const { build, test, exclude } = jobs;

export default async function pipeline(src = ".", args: string[] = []) {
if (Deno.env.has("FLUENTCI_SESSION_ID")) {
await uploadContext(src, exclude);
}

if (args.length > 0) {
await runSpecificJobs(args);
return;
Expand Down
20 changes: 1 addition & 19 deletions sdk/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ export async function connect(
config: ConnectOpts = {}
): Promise<void> {
let client: Client;
// let close: null | (() => void) = null;

if (Deno.env.has("FLUENTCI_TOKEN") && Deno.env.has("FLUENTCI_SESSION_ID")) {
const client = new Client({
host: Deno.env.get("FLUENTCI_HOST") || "vm.fluentci.io",
sessionToken: Deno.env.get("FLUENTCI_TOKEN"),
});
await cb(client).finally(() => {
if (close) {
close();
}
});
return;
}

// Prefer DAGGER_SESSION_PORT if set
const daggerSessionPort = Deno.env.get("DAGGER_SESSION_PORT");
Expand All @@ -81,9 +67,5 @@ export async function connect(
throw new Error("DAGGER_SESSION_PORT must be set");
}

await cb(client).finally(() => {
if (close) {
close();
}
});
await cb(client);
}
3 changes: 1 addition & 2 deletions src/dagger/jobs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Client from "../../deps.ts";
import { Directory, DirectoryID, File } from "../../sdk/client.gen.ts";
import { Directory, DirectoryID, File, Client } from "../../sdk/client.gen.ts";
import { connect } from "../../sdk/connect.ts";

export enum Job {
Expand Down
7 changes: 1 addition & 6 deletions src/dagger/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { uploadContext } from "../../deps.ts";
import * as jobs from "./jobs.ts";

const { build, test, exclude } = jobs;
const { build, test } = jobs;

export default async function pipeline(src = ".", args: string[] = []) {
if (Deno.env.has("FLUENTCI_SESSION_ID")) {
await uploadContext(src, exclude);
}

if (args.length > 0) {
await runSpecificJobs(args);
return;
Expand Down

0 comments on commit 6788393

Please sign in to comment.