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

make it compatible with Dagger Zenith #1

Merged
merged 5 commits into from
Oct 22, 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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@v1
with:
deno-version: v1.36
deno-version: v1.37
- name: Setup Fluent CI CLI
run: deno install -A -r https://cli.fluentci.io -n fluentci
- name: Setup Dagger
run: |
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh
sudo mv bin/dagger /usr/local/bin
dagger version
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.8 sh
sudo mv bin/dagger /usr/local/bin
dagger version
- name: Run Dagger Pipelines
run: dagger run fluentci deno_pipeline fmt lint test
run: fluentci run deno_pipeline fmt lint test
- name: Upload coverage to Codecov
run: dagger run fluentci codecov_pipeline
run: fluentci run codecov_pipeline
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: deno install -A -r https://cli.fluentci.io -n fluentci
- name: Setup Dagger
run: |
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.8 sh
sudo mv bin/dagger /usr/local/bin
dagger version
- name: Run Dagger Pipelines
Expand All @@ -26,4 +26,4 @@ jobs:
dagger run deno run -A ../src/dagger/runner.ts image
working-directory: example
env:
TRIVY_IMAGE: snyk/snyk:alpine
TRIVY_IMAGE: hashicorp/terraform:latest
23 changes: 23 additions & 0 deletions .github/workflows/zenith.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Do not edit this file directly. It is generated by https://deno.land/x/fluent_github_actions

name: Zenith Example
on:
push:
branches:
- zenith

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Dagger Zenith
run: |
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.8 sh
sudo mv bin/dagger /usr/local/bin
dagger version
- name: Run Dagger Pipelines
run: |
dagger query --doc config.gql
dagger query --doc image.gql
working-directory: example
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Trivy Pipeline

[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Ftrivy_pipeline&query=%24.version)](https://pkg.fluentci.io/trivy_pipeline)
![deno compatibility](https://shield.deno.dev/deno/^1.34)
![deno compatibility](https://shield.deno.dev/deno/^1.37)
[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/trivy-pipeline)](https://codecov.io/gh/fluent-ci-templates/trivy-pipeline)

A ready-to-use CI/CD Pipeline for scanning vulnerabilities using [Trivy](https://trivy.dev/).
Expand Down Expand Up @@ -46,19 +46,35 @@ fluentci run .
| image | Scan a container image |
| sbom | Scan a software bill of materials |

```graphql
config(exitCode: Int!, src: String!): String

fs(exitCode: Int!, src: String!): String

image(
exitCode: Int!,
image: String!,
src: String!
): String

repo(
exitCode: Int!,
repoUrl: String!,
src: String!
): String

sbom(
exitCode: Int!,
path: String!,
src: String!
): String
```
## Programmatic usage

You can also use this pipeline programmatically:

```ts
import Client, { connect } from "https://sdk.fluentci.io/v0.1.9/mod.ts";
import { fs } from "https://pkg.fluentci.io/trivy_pipeline@v0.1.0/mod.ts";

function pipeline(src = ".") {
connect(async (client: Client) => {
await fs(client, src);
});
}
import { fs } from "https://pkg.fluentci.io/trivy_pipeline@v0.2.0/mod.ts";

pipeline();
await fs();
```
11 changes: 2 additions & 9 deletions ci.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import Client, { connect } from "https://sdk.fluentci.io/v0.1.9/mod.ts";
import { fs } from "https://pkg.fluentci.io/trivy_pipeline@v0.1.0/mod.ts";
import { fs } from "https://pkg.fluentci.io/trivy_pipeline@v0.2.0/mod.ts";

function pipeline(src = ".") {
connect(async (client: Client) => {
await fs(client, src);
});
}

pipeline();
await fs();
5 changes: 5 additions & 0 deletions dagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"root": "",
"name": "trivy",
"sdkRuntime": "tsiry/dagger-sdk-deno"
}
24 changes: 19 additions & 5 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,29 @@
"tasks": {
"esm:add": "deno run -A https://esm.sh/v128 add",
"esm:update": "deno run -A https://esm.sh/v128 update",
"esm:remove": "deno run -A https://esm.sh/v128 remove"
"esm:remove": "deno run -A https://esm.sh/v128 remove",
"schema": "deno run -A src/dagger/schema.ts",
"clean": "rm -rf gen schema.graphql"
},
"fmt": {
"exclude": ["example/", ".fluentci/"]
"exclude": [
"example/",
".fluentci/",
"gen/"
]
},
"lint": {
"exclude": ["example/", ".fluentci/"]
"exclude": [
"example/",
".fluentci/",
"gen/"
]
},
"test": {
"exclude": ["example/", ".fluentci/"]
"exclude": [
"example/",
".fluentci/",
"gen/"
]
}
}
}
72 changes: 70 additions & 2 deletions deno.lock

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

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

export { connect, uploadContext } from "https://sdk.fluentci.io/v0.1.9/mod.ts";
export {
connect,
uploadContext,
CacheSharingMode,
} from "https://sdk.fluentci.io/z1/mod.ts";
export { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts";
export { withDevbox } from "https://nix.fluentci.io/v0.5.1/src/dagger/steps.ts";
export { withDevbox } from "https://nix.fluentci.io/zenith/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 };

export {
arg,
queryType,
stringArg,
intArg,
nonNull,
makeSchema,
} from "npm:nexus";
export {
dirname,
join,
resolve,
} from "https://deno.land/std@0.203.0/path/mod.ts";

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
25 changes: 25 additions & 0 deletions example/.fluentci/.fluentci/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/nix:1": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "nix develop --experimental-features \"nix-command flakes\""
// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/nix:1": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "nix develop --experimental-features \"nix-command flakes\""
// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/nix:1": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "nix develop --experimental-features \"nix-command flakes\""
// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Loading
Loading