Skip to content

Instantly share code, notes, and snippets.

@jpadams
jpadams / output
Created September 22, 2023 14:28
echo '{container{from(address: "alpine"){trivyScan}}}' | dagger query > /tmp/output 2>&1
1: connect
1: > in init
1: starting engine
1: starting engine [0.26s]
Connected to engine 1212deac927f (version devel ())
1: starting session
1: [0.26s] !!! STARTING SESSION
1: [0.27s] Failed to connect; retrying... name:"error" value:"make request: Post \"http://dagger/query\": rpc error: code = Unknown desc = server \"2ugkzmj3sxy6y1fzwz7rnpndx\" not found"
1: [0.41s] OK!
1: starting session [0.15s]
import sys
import anyio
import dagger
async def test():
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:
src = client.host().directory(".")
@jpadams
jpadams / podman_dagger_engine.sh
Last active May 25, 2023 18:08
Thanks to @busla for sharing the original script, which I've modified a bit to use our registry alias
#!/bin/bash
set -eoux pipefail
default_state_dir=/var/lib/dagger
engine_version=${1:-v0.6.0}
dagger_cache="dagger-cache"
dagger_runner="dagger"
podman volume create $dagger_cache || true
// on-push-or-pull-request executes the Dagger CI/CD pipeline
// for every push or pull request to any branch within this repo.
//
// It performs the following steps:
// - TBD
package main
import (
"context"
"fmt"
@jpadams
jpadams / main.go
Created December 30, 2022 18:08
simple image build and publish (push)
package main
import (
"context"
"fmt"
"os"
"dagger.io/dagger"
)
@jpadams
jpadams / APIqueries.gql
Last active November 29, 2022 12:50
GraphQL API queries
query {
git(url: "https://github.com/dagger/dagger") {
branch(name: "main") {
tree {
readme: file(path: "README.md") {
contents
size
}
license: file(path: "LICENSE") {
contents
@jpadams
jpadams / lang-SDK-survey-QR-code.svg
Created November 15, 2022 18:10
Dagger Language SDK survey Typeform link QR code SVG generated by https://www.nayuki.io/page/qr-code-generator-library
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jpadams
jpadams / main.go
Last active November 13, 2022 18:54
Call for src twice, same client. Doesn't Work! Seems to use original snapshot of host workdir without exported build directory. To test ensure you've remove ./build/ before running.
package main
import (
"context"
"fmt"
"os"
"time"
"dagger.io/dagger"
)
@jpadams
jpadams / main.go
Last active November 13, 2022 18:38
Call for client twice. Works. Implicit client close between function calls to build and list.
package main
import (
"context"
"fmt"
"os"
"time"
"dagger.io/dagger"
)
# AWS CodeBuild
version: 0.2
phases:
build:
commands:
- docker run --rm --privileged public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 --install all
- go run ci/main.go test
- tail -n +1 output/*/*/*.out