Skip to content

Instantly share code, notes, and snippets.

@jpadams
Last active November 29, 2022 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpadams/a4e8a5c7de9c4803363d3a9918fc4a19 to your computer and use it in GitHub Desktop.
Save jpadams/a4e8a5c7de9c4803363d3a9918fc4a19 to your computer and use it in GitHub Desktop.
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
size
}
}
}
}
}
query Secret {
host {
envVariable(name: "HOME") {
secret {
id
}
}
}
}
query Decode {
secret(id: "eyJob3N0X2VudiI6IkhPTUUifQ==") {
plaintext
}
}
query {
http(url: "http://dagger.io") {
size
contents
}
}
query {
container {
from(address: "alpine") {
defaultArgs
entrypoint
platform
rootfs {
entries
}
}
}
}
query ContainerDirectory {
container {
from(address: "alpine") {
directory(path: ".") {
withNewDirectory(path: "foo") {
withNewDirectory(path: "foo/bar/baz") {
withNewFile(path: "foo/bar/greeting", contents: "hello, world!\n") {
entries(path: "foo/bar")
file(path: "foo/bar/greeting") {
contents
}
}
}
}
}
}
}
}
query ContainerApkInfo {
container {
from(address: "alpine") {
withExec(args: ["apk", "info"]) {
stdout
}
}
}
}
query DirectoryFileReadme {
host {
directory(path: ".") {
file(path: "README.md") {
contents
}
}
}
}
query DefaultPlatform {
defaultPlatform
}
query GitRefsHead {
git(url: "https://github.com/dagger/dagger", keepGitDir: true) {
branch(name: "main") {
tree {
file(path: ".git/refs/heads/main") {
contents
}
}
}
}
}
query NewDir {
directory {
withNewDirectory(path: "foo") {
withNewDirectory(path: "bar/baz") {
withNewFile(path: "foo/greeting", contents: "hello, world!\n") {
export(path: ".")
}
}
}
}
}
query Ls {
host {
directory(path: "./foo") {
entries
}
}
}
query {
host {
read: directory(path: ".") {
file(path: ".markdownlint.yaml") {
contents
}
}
home: envVariable(name: "HOME") {
value
}
pwd: envVariable(name: "PWD") {
value
}
write: directory(path: ".") {
withNewFile(path: "greeting", contents: "Hello Dagger!") {
export(path: ".")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment