mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-08-17 20:53:29 +02:00
Compare commits
28 Commits
dagger-sdk
...
feat/ci-mu
Author | SHA1 | Date | |
---|---|---|---|
665164464d
|
|||
7e6853ed63
|
|||
0f816b5e29
|
|||
46208d5681
|
|||
1570e01ff9
|
|||
7d3fc5e3e2
|
|||
c56370182f
|
|||
6858ee74cd
|
|||
84bcf10809
|
|||
59b42fc273
|
|||
1e10149522
|
|||
cb66d99088
|
|||
2d171249d9
|
|||
8ad390f813
|
|||
6dd6a47131
|
|||
e194a01893
|
|||
9599e6f484
|
|||
11d20935c6 | |||
384294b390 | |||
79d931e908 | |||
756a080533 | |||
ea27fa8168 | |||
71f98d0293 | |||
6ef4bdf587 | |||
b55bcc159f | |||
76fab3f466
|
|||
6629d2db4f
|
|||
8fd6bb983e |
121
.github/workflows/ci-multiplatform.yml
vendored
Normal file
121
.github/workflows/ci-multiplatform.yml
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
name: ci-multi-platform
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '00 01 * * *'
|
||||
jobs:
|
||||
test:
|
||||
name: test
|
||||
env:
|
||||
# For some builds, we use cross to test on 32-bit and big-endian
|
||||
# systems.
|
||||
CARGO: cargo
|
||||
# When CARGO is set to CROSS, this is set to `--target matrix.target`.
|
||||
TARGET_FLAGS: ""
|
||||
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target.
|
||||
TARGET_DIR: ./target
|
||||
# Emit backtraces on panics.
|
||||
RUST_BACKTRACE: 1
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
build:
|
||||
- pinned
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
#- nightly-musl
|
||||
#- nightly-32
|
||||
#- nightly-mips
|
||||
#- nightly-arm
|
||||
#- macos
|
||||
# - win-msvc
|
||||
#- win-gnu
|
||||
include:
|
||||
- build: pinned
|
||||
os: ubuntu-22.04
|
||||
rust: 1.65.0
|
||||
- build: stable
|
||||
os: ubuntu-22.04
|
||||
rust: stable
|
||||
- build: beta
|
||||
os: ubuntu-22.04
|
||||
rust: beta
|
||||
- build: nightly
|
||||
os: ubuntu-22.04
|
||||
rust: nightly
|
||||
#- build: nightly-musl
|
||||
# os: ubuntu-22.04
|
||||
# rust: nightly
|
||||
# target: x86_64-unknown-linux-musl
|
||||
#- build: nightly-32
|
||||
# os: ubuntu-22.04
|
||||
# rust: nightly
|
||||
# target: i686-unknown-linux-gnu
|
||||
#- build: nightly-mips
|
||||
# os: ubuntu-22.04
|
||||
# rust: nightly
|
||||
# target: mips64-unknown-linux-gnuabi64
|
||||
#- build: nightly-arm
|
||||
# os: ubuntu-22.04
|
||||
# rust: nightly
|
||||
# target: arm-unknown-linux-gnueabihf
|
||||
#- build: macos
|
||||
# os: macos-12
|
||||
# rust: nightly
|
||||
#- build: win-msvc
|
||||
# os: windows-2022
|
||||
# rust: nightly
|
||||
#- build: win-gnu
|
||||
# os: windows-2022
|
||||
# rust: nightly-x86_64-gnu
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
#- name: Install packages (Ubuntu)
|
||||
# if: matrix.os == 'ubuntu-22.04'
|
||||
# run: |
|
||||
# ci/ubuntu-install-packages
|
||||
- name: Install packages (macOS)
|
||||
if: matrix.os == 'macos-12'
|
||||
run: |
|
||||
ci/scripts/macos-install-packages
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2.0.0
|
||||
- uses: actions-rs/toolchain@v1
|
||||
if: matrix.target == ''
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
- uses: actions-rs/toolchain@v1
|
||||
if: matrix.target != ''
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
target: ${{ matrix.target }}
|
||||
use-cross: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
if: matrix.target != ''
|
||||
with:
|
||||
use-cross: true
|
||||
command: build
|
||||
args: --workspace --verbose --target ${{ matrix.target }}
|
||||
- uses: actions-rs/cargo@v1
|
||||
if: matrix.target == ''
|
||||
with:
|
||||
command: build
|
||||
args: --workspace --verbose
|
||||
- uses: actions-rs/cargo@v1
|
||||
if: matrix.target != ''
|
||||
with:
|
||||
use-cross: true
|
||||
command: test
|
||||
args: --all --verbose --target ${{ matrix.target }}
|
||||
- uses: actions-rs/cargo@v1
|
||||
if: matrix.target == ''
|
||||
with:
|
||||
command: test
|
||||
args: --all --verbose
|
504
Cargo.lock
generated
504
Cargo.lock
generated
@@ -24,16 +24,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e"
|
||||
|
||||
[[package]]
|
||||
name = "async-compression"
|
||||
version = "0.3.15"
|
||||
name = "async-trait"
|
||||
version = "0.1.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a"
|
||||
checksum = "86ea188f25f0255d8f92797797c97ebf5631fa88178beb1a46fdf5622c9a00e4"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"futures-core",
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -71,9 +69,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.3"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
@@ -121,9 +119,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.1.6"
|
||||
version = "4.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3"
|
||||
checksum = "ce38afc168d8665cfc75c7b1dd9672e50716a137f433f070991619744a67342a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"clap_lex",
|
||||
@@ -134,9 +132,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.3.1"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
|
||||
checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646"
|
||||
dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
@@ -241,7 +239,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dagger-bootstrap"
|
||||
version = "0.2.10"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"color-eyre",
|
||||
"dagger-codegen",
|
||||
"dagger-core",
|
||||
"dirs",
|
||||
"eyre",
|
||||
"graphql_client",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"platform-info",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"tar",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -262,38 +283,12 @@ dependencies = [
|
||||
name = "dagger-core"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"async-trait",
|
||||
"base64",
|
||||
"dirs",
|
||||
"eyre",
|
||||
"flate2",
|
||||
"genco",
|
||||
"graphql-introspection-query",
|
||||
"graphql_client",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"platform-info",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"tar",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dagger-rs"
|
||||
version = "0.2.10"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"color-eyre",
|
||||
"dagger-codegen",
|
||||
"dagger-core",
|
||||
"dirs",
|
||||
"eyre",
|
||||
"flate2",
|
||||
"genco",
|
||||
"graphql-introspection-query",
|
||||
"gql_client",
|
||||
"graphql_client",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
@@ -305,31 +300,34 @@ dependencies = [
|
||||
"tar",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dagger-sdk"
|
||||
version = "0.2.17"
|
||||
version = "0.2.19"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"dagger-core",
|
||||
"derive_builder",
|
||||
"eyre",
|
||||
"futures",
|
||||
"genco",
|
||||
"gql_client",
|
||||
"pretty_assertions",
|
||||
"rand",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"tracing-test",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.14.3"
|
||||
version = "0.14.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8"
|
||||
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
@@ -337,27 +335,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.14.3"
|
||||
version = "0.14.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb"
|
||||
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.14.3"
|
||||
version = "0.14.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
|
||||
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -378,7 +376,7 @@ dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -388,7 +386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
|
||||
dependencies = [
|
||||
"derive_builder_core",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -501,7 +499,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"libz-sys",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
@@ -591,7 +588,7 @@ checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -643,7 +640,7 @@ checksum = "c85fd34848b1f708e6344a4af6f7bfc05172ae20ce4b35c8e417efffb4f306aa"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -730,7 +727,7 @@ dependencies = [
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -741,14 +738,14 @@ checksum = "d52fc9cde811f44b15ec0692b31e56a3067f6f431c5ace712f286e47c1dacc98"
|
||||
dependencies = [
|
||||
"graphql_client_codegen",
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4"
|
||||
checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
@@ -838,9 +835,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.24"
|
||||
version = "0.14.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c"
|
||||
checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
@@ -860,6 +857,19 @@ dependencies = [
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-rustls"
|
||||
version = "0.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c"
|
||||
dependencies = [
|
||||
"http",
|
||||
"hyper",
|
||||
"rustls",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-tls"
|
||||
version = "0.5.0"
|
||||
@@ -916,10 +926,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.5"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
|
||||
checksum = "0dd6da19f25979c7270e70fa95ab371ec3b701cd0eefc47667a09785b3c59155"
|
||||
dependencies = [
|
||||
"hermit-abi 0.3.1",
|
||||
"libc",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
@@ -932,9 +943,9 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.3"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
|
||||
checksum = "8687c819457e979cc940d09cb16e42a1bf70aa6b60a549de6d3a62a0ee90c69e"
|
||||
dependencies = [
|
||||
"hermit-abi 0.3.1",
|
||||
"io-lifetimes",
|
||||
@@ -953,9 +964,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.5"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
@@ -974,20 +985,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.139"
|
||||
version = "0.2.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
@@ -1014,6 +1014,15 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matchers"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
|
||||
dependencies = [
|
||||
"regex-automata",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
@@ -1065,6 +1074,16 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.46.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
|
||||
dependencies = [
|
||||
"overload",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.15.0"
|
||||
@@ -1092,9 +1111,9 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.45"
|
||||
version = "0.10.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1"
|
||||
checksum = "fd2523381e46256e40930512c7fd25562b9eae4812cb52078f155e87217c9d1e"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
@@ -1113,7 +1132,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1124,9 +1143,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.80"
|
||||
version = "0.9.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7"
|
||||
checksum = "176be2629957c157240f68f61f2d0053ad3a4ecfdd9ebf1e6521d18d9635cf67"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cc",
|
||||
@@ -1150,6 +1169,12 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "overload"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
||||
|
||||
[[package]]
|
||||
name = "owo-colors"
|
||||
version = "3.5.0"
|
||||
@@ -1233,18 +1258,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.51"
|
||||
version = "1.0.52"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||
checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -1300,27 +1325,41 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "relative-path"
|
||||
version = "1.7.3"
|
||||
name = "regex"
|
||||
version = "1.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3bf6b372449361333ac1f498b7edae4dd5e70dccd7c0c2a7c7bce8f05ede648"
|
||||
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
|
||||
dependencies = [
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
version = "0.5.3"
|
||||
name = "regex-automata"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||
|
||||
[[package]]
|
||||
name = "relative-path"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bf2521270932c3c7bed1a59151222bd7643c79310f2916f01925e1e16255698"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"base64",
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
@@ -1330,6 +1369,7 @@ dependencies = [
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"hyper-rustls",
|
||||
"hyper-tls",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
@@ -1339,11 +1379,14 @@ dependencies = [
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls",
|
||||
"rustls-pemfile",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tokio-rustls",
|
||||
"tokio-util",
|
||||
"tower-service",
|
||||
"url",
|
||||
@@ -1351,9 +1394,25 @@ dependencies = [
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-streams",
|
||||
"web-sys",
|
||||
"webpki-roots",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.16.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"spin",
|
||||
"untrusted",
|
||||
"web-sys",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.21"
|
||||
@@ -1362,9 +1421,9 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.36.8"
|
||||
version = "0.36.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
|
||||
checksum = "2fe885c3a125aa45213b68cc1472a49880cb5923dc23f522ad2791b882228778"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
@@ -1375,10 +1434,31 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.12"
|
||||
name = "rustls"
|
||||
version = "0.20.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
|
||||
checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"sct",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b"
|
||||
dependencies = [
|
||||
"base64",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
@@ -1395,6 +1475,16 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "sct"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "2.8.2"
|
||||
@@ -1420,29 +1510,29 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.152"
|
||||
version = "1.0.157"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
|
||||
checksum = "707de5fcf5df2b5788fca98dd7eab490bc2fd9b7ef1404defc462833b83f25ca"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.152"
|
||||
version = "1.0.157"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
|
||||
checksum = "78997f4555c22a7971214540c4a661291970619afd56de19f77e0de86296e1e5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.93"
|
||||
version = "1.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
|
||||
checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -1507,14 +1597,20 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.7"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
|
||||
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
@@ -1523,9 +1619,20 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.107"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cff13bb1732bccfe3b246f3fdb09edfd51c01d6f5299b7ccd9457c2e4e37774"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1545,16 +1652,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.3.0"
|
||||
version = "3.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
|
||||
checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi",
|
||||
"rustix",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1568,22 +1674,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.38"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
|
||||
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.38"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1613,9 +1719,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.25.0"
|
||||
version = "1.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
|
||||
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
@@ -1628,7 +1734,7 @@ dependencies = [
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1639,7 +1745,7 @@ checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1652,6 +1758,17 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.23.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
|
||||
dependencies = [
|
||||
"rustls",
|
||||
"tokio",
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.7"
|
||||
@@ -1679,10 +1796,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.30"
|
||||
@@ -1703,15 +1833,56 @@ dependencies = [
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
|
||||
dependencies = [
|
||||
"matchers",
|
||||
"nu-ansi-term",
|
||||
"once_cell",
|
||||
"regex",
|
||||
"sharded-slab",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-test"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a2c0ff408fe918a94c428a3f2ad04e4afd5c95bbc08fcf868eff750c15728a4"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"tracing-core",
|
||||
"tracing-subscriber",
|
||||
"tracing-test-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-test-macro"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "258bc1c4f8e2e73a977812ab339d503e6feeb92700f6d07a6de4d321522d5c08"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1728,15 +1899,15 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.10"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58"
|
||||
checksum = "7d502c968c6a838ead8e69b2ee18ec708802f99db92a0d156705ec9ef801993b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.6"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
|
||||
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
@@ -1762,6 +1933,12 @@ dependencies = [
|
||||
"void",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.3.1"
|
||||
@@ -1834,7 +2011,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@@ -1868,7 +2045,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.109",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@@ -1902,6 +2079,25 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.22.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87"
|
||||
dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
@@ -1959,9 +2155,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
@@ -1974,45 +2170,45 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
|
||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
|
37
Cargo.toml
37
Cargo.toml
@@ -1,42 +1,25 @@
|
||||
[package]
|
||||
name = "dagger-rs"
|
||||
version = "0.2.10"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
description = "A dagger sdk for rust, written in rust"
|
||||
repository = "https://github.com/kjuulh/dagger-rs"
|
||||
publish = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/dagger-codegen",
|
||||
"crates/dagger-sdk",
|
||||
"crates/dagger-core",
|
||||
"crates/dagger-bootstrap",
|
||||
"ci",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
[workspace.dependencies]
|
||||
dagger-codegen = { path = "crates/dagger-codegen", version = "^0.2.5" }
|
||||
dagger-core = { path = "crates/dagger-core", version = "^0.2.8" }
|
||||
dagger-bootstrap = { path = "crates/dagger-bootstrap", version = "^0.2.10" }
|
||||
dagger-sdk = { path = "crates/dagger-sdk", version = "^0.2.19" }
|
||||
|
||||
clap = "4.1.6"
|
||||
dirs = "4.0.0"
|
||||
eyre = "0.6.8"
|
||||
flate2 = { version = "1.0.25", features = ["zlib"] }
|
||||
genco = "0.17.3"
|
||||
graphql-introspection-query = "0.2.0"
|
||||
graphql_client = { version = "0.12.0", features = ["reqwest"] }
|
||||
hex = "0.4.3"
|
||||
hex-literal = "0.3.4"
|
||||
platform-info = "1.0.2"
|
||||
reqwest = { version = "0.11.14", features = ["stream", "deflate"] }
|
||||
color-eyre = "0.6.2"
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.93"
|
||||
sha2 = "0.10.6"
|
||||
tar = "0.4.38"
|
||||
tempfile = "3.3.0"
|
||||
color-eyre = "0.6.2"
|
||||
tokio = { version = "1.25.0", features = ["full"] }
|
||||
tracing = { version = "0.1.37", features = ["log"] }
|
||||
tracing-subscriber = { version = "0.3.16", features = [
|
||||
"tracing-log",
|
||||
"tracing",
|
||||
] }
|
||||
|
@@ -3,6 +3,19 @@ command = "cargo"
|
||||
args = ["run", "-p", "ci", "--", "codegen"]
|
||||
workspace = false
|
||||
|
||||
[tasks.local_codegen]
|
||||
command = "cargo"
|
||||
args = [
|
||||
"run",
|
||||
"-p",
|
||||
"dagger-bootstrap",
|
||||
"--",
|
||||
"generate",
|
||||
"--output",
|
||||
"crates/dagger-sdk/src/gen.rs",
|
||||
]
|
||||
workspace = false
|
||||
|
||||
[tasks.build]
|
||||
command = "cargo"
|
||||
args = ["run", "-p", "ci", "--", "ci"]
|
||||
@@ -20,6 +33,10 @@ args = ["fix", "--workspace", "--allow-dirty"]
|
||||
dependencies = ["fmt"]
|
||||
workspace = false
|
||||
|
||||
[tasks.gen]
|
||||
dependencies = ["local_codegen", "fmt", "fix"]
|
||||
workspace = false
|
||||
|
||||
[tasks.release_crate]
|
||||
command = "cargo"
|
||||
args = [
|
||||
|
@@ -8,6 +8,6 @@ edition = "2021"
|
||||
[dependencies]
|
||||
clap = "4.1.6"
|
||||
color-eyre = "0.6.2"
|
||||
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.17" }
|
||||
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.19" }
|
||||
eyre = "0.6.8"
|
||||
tokio = { version = "1.25.0", features = ["full"] }
|
||||
|
4
ci/scripts/macos-install-packages
Executable file
4
ci/scripts/macos-install-packages
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
brew install docker
|
||||
colima start
|
@@ -90,7 +90,7 @@ async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), col
|
||||
"--execute",
|
||||
"--allow-fully-generated-changelogs",
|
||||
"--no-changelog-preview",
|
||||
"dagger-rs",
|
||||
"dagger-sdk",
|
||||
"dagger-sdk",
|
||||
]);
|
||||
let exit = container.exit_code().await?;
|
||||
|
39
crates/dagger-bootstrap/Cargo.toml
Normal file
39
crates/dagger-bootstrap/Cargo.toml
Normal file
@@ -0,0 +1,39 @@
|
||||
[package]
|
||||
name = "dagger-bootstrap"
|
||||
version = "0.2.10"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
description = "A dagger sdk for rust, written in rust"
|
||||
repository = "https://github.com/kjuulh/dagger-sdk"
|
||||
publish = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dagger-core = { workspace = true }
|
||||
dagger-codegen = { workspace = true }
|
||||
|
||||
eyre = { workspace = true }
|
||||
color-eyre = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
||||
reqwest = { version = "0.11.14", features = [
|
||||
"stream",
|
||||
"rustls",
|
||||
"hyper-rustls",
|
||||
"rustls-tls",
|
||||
] }
|
||||
clap = "4.1.6"
|
||||
dirs = "4.0.0"
|
||||
graphql_client = { version = "0.12.0", features = [
|
||||
"reqwest-rustls",
|
||||
], default_features = false }
|
||||
hex = "0.4.3"
|
||||
hex-literal = "0.3.4"
|
||||
platform-info = "1.0.2"
|
||||
sha2 = "0.10.6"
|
||||
tar = "0.4.38"
|
||||
tempfile = "3.3.0"
|
@@ -5,17 +5,20 @@ edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
description = "dagger sdk codegen library"
|
||||
repository = "https://github.com/kjuulh/dagger-rs"
|
||||
repository = "https://github.com/kjuulh/dagger-sdk"
|
||||
publish = true
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
convert_case = "0.6.0"
|
||||
dagger-core = { path = "../dagger-core", version = "^0.2.8" }
|
||||
dagger-core = { workspace = true }
|
||||
|
||||
eyre = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
eyre = "0.6.8"
|
||||
genco = "0.17.3"
|
||||
convert_case = "0.6.0"
|
||||
itertools = "0.10.5"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.3.0"
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.93"
|
||||
|
@@ -196,6 +196,22 @@ pub fn type_ref_is_scalar(type_ref: &TypeRef) -> bool {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn type_ref_is_enum(type_ref: &TypeRef) -> bool {
|
||||
let mut type_ref = type_ref.clone();
|
||||
if type_ref
|
||||
.kind
|
||||
.pipe(|k| *k == __TypeKind::NON_NULL)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
type_ref = *type_ref.of_type.unwrap().clone();
|
||||
}
|
||||
|
||||
type_ref
|
||||
.kind
|
||||
.pipe(|k| *k == __TypeKind::ENUM)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn type_ref_is_object(type_ref: &TypeRef) -> bool {
|
||||
let mut type_ref = type_ref.clone();
|
||||
if type_ref
|
||||
|
@@ -3,10 +3,11 @@ use dagger_core::introspection::{FullTypeFields, TypeRef};
|
||||
use genco::prelude::rust;
|
||||
use genco::quote;
|
||||
use genco::tokens::quoted;
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::functions::{
|
||||
type_field_has_optional, type_ref_is_list, type_ref_is_list_of_objects, type_ref_is_object,
|
||||
type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar,
|
||||
type_field_has_optional, type_ref_is_enum, type_ref_is_list, type_ref_is_list_of_objects,
|
||||
type_ref_is_object, type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar,
|
||||
};
|
||||
use crate::utility::OptionExt;
|
||||
|
||||
@@ -133,6 +134,12 @@ fn render_required_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
|
||||
}
|
||||
}
|
||||
|
||||
if type_ref_is_enum(&s.input_value.type_) {
|
||||
return Some(quote! {
|
||||
query = query.arg_enum($(quoted(name)), $(n));
|
||||
})
|
||||
}
|
||||
|
||||
if type_ref_is_list(&s.input_value.type_) {
|
||||
let inner = *s
|
||||
.input_value
|
||||
@@ -187,6 +194,14 @@ fn render_optional_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
|
||||
let n = format_struct_name(&s.input_value.name);
|
||||
let name = &s.input_value.name;
|
||||
|
||||
if type_ref_is_enum(&s.input_value.type_) {
|
||||
return Some(quote! {
|
||||
if let Some($(&n)) = opts.$(&n) {
|
||||
query = query.arg_enum($(quoted(name)), $(n));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Some(quote! {
|
||||
if let Some($(&n)) = opts.$(&n) {
|
||||
query = query.arg($(quoted(name)), $(&n));
|
||||
@@ -232,7 +247,7 @@ fn render_execution(funcs: &CommonFunctions, field: &FullTypeFields) -> rust::To
|
||||
return $(output_type) {
|
||||
proc: self.proc.clone(),
|
||||
selection: query,
|
||||
conn: self.conn.clone(),
|
||||
graphql_client: self.graphql_client.clone(),
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -258,15 +273,13 @@ fn render_execution(funcs: &CommonFunctions, field: &FullTypeFields) -> rust::To
|
||||
return vec![$(output_type) {
|
||||
proc: self.proc.clone(),
|
||||
selection: query,
|
||||
conn: self.conn.clone(),
|
||||
graphql_client: self.graphql_client.clone(),
|
||||
}]
|
||||
};
|
||||
}
|
||||
|
||||
let graphql_client = rust::import("crate::client", "graphql_client");
|
||||
|
||||
quote! {
|
||||
query.execute(&$graphql_client(&self.conn)).await
|
||||
query.execute(self.graphql_client.clone()).await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,6 +404,7 @@ pub fn format_optional_args(
|
||||
.map(|t| {
|
||||
t.into_iter()
|
||||
.filter(|t| type_ref_is_optional(&t.input_value.type_))
|
||||
.sorted_by_key(|val| &val.input_value.name)
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.pipe(|t| render_optional_field_args(funcs, t))
|
||||
|
@@ -1,6 +1,7 @@
|
||||
use dagger_core::introspection::FullType;
|
||||
use genco::prelude::rust;
|
||||
use genco::quote;
|
||||
use itertools::Itertools;
|
||||
|
||||
fn render_enum_values(values: &FullType) -> Option<rust::Tokens> {
|
||||
let values = values
|
||||
@@ -10,6 +11,7 @@ fn render_enum_values(values: &FullType) -> Option<rust::Tokens> {
|
||||
.map(|values| {
|
||||
values
|
||||
.into_iter()
|
||||
.sorted_by_key(|a| &a.name)
|
||||
.map(|val| quote! { $(val.name.as_ref()), })
|
||||
})
|
||||
.flatten()
|
||||
|
@@ -1,6 +1,7 @@
|
||||
use dagger_core::introspection::{FullType, FullTypeInputFields};
|
||||
use genco::prelude::rust;
|
||||
use genco::quote;
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::functions::CommonFunctions;
|
||||
use crate::rust::functions::{format_name, format_struct_name};
|
||||
@@ -20,7 +21,10 @@ pub fn render_input_fields(
|
||||
funcs: &CommonFunctions,
|
||||
fields: &[FullTypeInputFields],
|
||||
) -> Option<rust::Tokens> {
|
||||
let rendered_fields = fields.iter().map(|f| render_input_field(funcs, f));
|
||||
let rendered_fields = fields
|
||||
.iter()
|
||||
.sorted_by_key(|val| &val.input_value.name)
|
||||
.map(|f| render_input_field(funcs, f));
|
||||
|
||||
if rendered_fields.len() == 0 {
|
||||
None
|
||||
|
@@ -12,15 +12,15 @@ use crate::utility::OptionExt;
|
||||
pub fn render_object(funcs: &CommonFunctions, t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||
let selection = rust::import("crate::querybuilder", "Selection");
|
||||
let child = rust::import("tokio::process", "Child");
|
||||
let conn = rust::import("dagger_core::connect_params", "ConnectParams");
|
||||
let graphql_client = rust::import("dagger_core::graphql_client", "DynGraphQLClient");
|
||||
let arc = rust::import("std::sync", "Arc");
|
||||
|
||||
Ok(quote! {
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone)]
|
||||
pub struct $(t.name.pipe(|s| format_name(s))) {
|
||||
pub proc: $arc<$child>,
|
||||
pub selection: $selection,
|
||||
pub conn: $conn,
|
||||
pub graphql_client: $graphql_client
|
||||
}
|
||||
|
||||
$(t.fields.pipe(|f| render_optional_args(funcs, f)))
|
||||
|
@@ -5,25 +5,34 @@ edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
description = "dagger sdk core library"
|
||||
repository = "https://github.com/kjuulh/dagger-rs"
|
||||
repository = "https://github.com/kjuulh/dagger-sdk"
|
||||
publish = true
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap = "4.1.6"
|
||||
eyre = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
|
||||
base64 = "0.21.0"
|
||||
gql_client = "1.0.7"
|
||||
dirs = "4.0.0"
|
||||
eyre = "0.6.8"
|
||||
flate2 = { version = "1.0.25", features = ["zlib"] }
|
||||
genco = "0.17.3"
|
||||
graphql-introspection-query = "0.2.0"
|
||||
graphql_client = { version = "0.12.0", features = ["reqwest"] }
|
||||
flate2 = { version = "1.0.25", features = ["rust_backend"] }
|
||||
graphql_client = { version = "0.12.0", features = [
|
||||
"reqwest-rustls",
|
||||
"graphql_query_derive",
|
||||
], default-features = false }
|
||||
hex = "0.4.3"
|
||||
hex-literal = "0.3.4"
|
||||
platform-info = "1.0.2"
|
||||
reqwest = { version = "0.11.14", features = ["stream", "deflate"] }
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.93"
|
||||
reqwest = { version = "0.11.14", features = [
|
||||
"stream",
|
||||
"rustls-tls",
|
||||
], default-features = false }
|
||||
sha2 = "0.10.6"
|
||||
tar = "0.4.38"
|
||||
tempfile = "3.3.0"
|
||||
tokio = { version = "1.25.0", features = ["full"] }
|
||||
async-trait = "0.1.67"
|
||||
|
@@ -35,7 +35,7 @@ impl InnerCliSession {
|
||||
cli_path: &PathBuf,
|
||||
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
|
||||
let proc = self.start(config, cli_path)?;
|
||||
let params = self.get_conn(proc).await?;
|
||||
let params = self.get_conn(proc, config).await?;
|
||||
Ok(params)
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ impl InnerCliSession {
|
||||
async fn get_conn(
|
||||
&self,
|
||||
mut proc: tokio::process::Child,
|
||||
config: &Config,
|
||||
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
|
||||
let stdout = proc
|
||||
.stdout
|
||||
@@ -82,6 +83,7 @@ impl InnerCliSession {
|
||||
|
||||
let (sender, mut receiver) = tokio::sync::mpsc::channel(1);
|
||||
|
||||
let logger = config.logger.as_ref().map(|p| p.clone());
|
||||
tokio::spawn(async move {
|
||||
let mut stdout_bufr = tokio::io::BufReader::new(stdout).lines();
|
||||
while let Ok(Some(line)) = stdout_bufr.next_line().await {
|
||||
@@ -89,14 +91,19 @@ impl InnerCliSession {
|
||||
sender.send(conn).await.unwrap();
|
||||
}
|
||||
|
||||
println!("dagger: {}", line);
|
||||
if let Some(logger) = &logger {
|
||||
logger.stdout(&line).unwrap();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let logger = config.logger.as_ref().map(|p| p.clone());
|
||||
tokio::spawn(async move {
|
||||
let mut stdout_bufr = tokio::io::BufReader::new(stderr).lines();
|
||||
while let Ok(Some(line)) = stdout_bufr.next_line().await {
|
||||
println!("dagger: {}", line);
|
||||
let mut stderr_bufr = tokio::io::BufReader::new(stderr).lines();
|
||||
while let Ok(Some(line)) = stderr_bufr.next_line().await {
|
||||
if let Some(logger) = &logger {
|
||||
logger.stdout(&line).unwrap();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -1,15 +1,18 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::logger::DynLogger;
|
||||
|
||||
pub struct Config {
|
||||
pub workdir_path: Option<PathBuf>,
|
||||
pub config_path: Option<PathBuf>,
|
||||
pub timeout_ms: u64,
|
||||
pub execute_timeout_ms: Option<u64>,
|
||||
pub logger: Option<DynLogger>,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self::new(None, None, None, None)
|
||||
Self::new(None, None, None, None, None)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +22,14 @@ impl Config {
|
||||
config_path: Option<PathBuf>,
|
||||
timeout_ms: Option<u64>,
|
||||
execute_timeout_ms: Option<u64>,
|
||||
logger: Option<DynLogger>,
|
||||
) -> Self {
|
||||
Self {
|
||||
workdir_path,
|
||||
config_path,
|
||||
timeout_ms: timeout_ms.unwrap_or(10 * 1000),
|
||||
execute_timeout_ms,
|
||||
logger,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -139,9 +139,10 @@ impl Downloader {
|
||||
if let Ok(entry) = file {
|
||||
let path = entry.path();
|
||||
if path != cli_bin_path {
|
||||
println!(
|
||||
"deleting client: path: {:?} vs cli_bin_path: {:?}",
|
||||
path, cli_bin_path
|
||||
tracing::debug!(
|
||||
path = path.display().to_string(),
|
||||
cli_bin_path = cli_bin_path.display().to_string(),
|
||||
"deleting existing dagger-engine"
|
||||
);
|
||||
std::fs::remove_file(path)?;
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@ impl Engine {
|
||||
&self,
|
||||
cfg: &Config,
|
||||
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
|
||||
tracing::info!("starting dagger-engine");
|
||||
|
||||
// TODO: Add from existing session as well
|
||||
self.from_cli(cfg).await
|
||||
}
|
||||
|
375
crates/dagger-core/src/gql_client.rs
Normal file
375
crates/dagger-core/src/gql_client.rs
Normal file
@@ -0,0 +1,375 @@
|
||||
use reqwest::Error;
|
||||
use reqwest::{Client, Url};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::{self, Formatter};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct GraphQLError {
|
||||
message: String,
|
||||
json: Option<Vec<GraphQLErrorMessage>>,
|
||||
}
|
||||
|
||||
// https://spec.graphql.org/June2018/#sec-Errors
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[allow(dead_code)]
|
||||
pub struct GraphQLErrorMessage {
|
||||
message: String,
|
||||
locations: Option<Vec<GraphQLErrorLocation>>,
|
||||
extensions: Option<HashMap<String, String>>,
|
||||
path: Option<Vec<GraphQLErrorPathParam>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[allow(dead_code)]
|
||||
pub struct GraphQLErrorLocation {
|
||||
line: u32,
|
||||
column: u32,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[serde(untagged)]
|
||||
pub enum GraphQLErrorPathParam {
|
||||
String(String),
|
||||
Number(u32),
|
||||
}
|
||||
|
||||
impl GraphQLError {
|
||||
pub fn with_text(message: impl AsRef<str>) -> Self {
|
||||
Self {
|
||||
message: message.as_ref().to_string(),
|
||||
json: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_message_and_json(message: impl AsRef<str>, json: Vec<GraphQLErrorMessage>) -> Self {
|
||||
Self {
|
||||
message: message.as_ref().to_string(),
|
||||
json: Some(json),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_json(json: Vec<GraphQLErrorMessage>) -> Self {
|
||||
Self::with_message_and_json("Look at json field for more details", json)
|
||||
}
|
||||
|
||||
pub fn message(&self) -> &str {
|
||||
&self.message
|
||||
}
|
||||
|
||||
pub fn json(&self) -> Option<Vec<GraphQLErrorMessage>> {
|
||||
self.json.clone()
|
||||
}
|
||||
}
|
||||
|
||||
fn format(err: &GraphQLError, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
// Print the main error message
|
||||
writeln!(f, "\nGQLClient Error: {}", err.message)?;
|
||||
|
||||
// Check if query errors have been received
|
||||
if err.json.is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let errors = err.json.as_ref();
|
||||
|
||||
for err in errors.unwrap() {
|
||||
writeln!(f, "Message: {}", err.message)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl fmt::Display for GraphQLError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
format(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for GraphQLError {
|
||||
#[allow(clippy::needless_borrow)]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
format(&self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Error> for GraphQLError {
|
||||
fn from(error: Error) -> Self {
|
||||
Self {
|
||||
message: error.to_string(),
|
||||
json: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// GQL client config
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ClientConfig {
|
||||
/// the endpoint about graphql server
|
||||
pub endpoint: String,
|
||||
/// gql query timeout, unit: seconds
|
||||
pub timeout: Option<u64>,
|
||||
/// additional request header
|
||||
pub headers: Option<HashMap<String, String>>,
|
||||
/// request proxy
|
||||
pub proxy: Option<GQLProxy>,
|
||||
}
|
||||
|
||||
/// proxy type
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum ProxyType {
|
||||
Http,
|
||||
Https,
|
||||
All,
|
||||
}
|
||||
|
||||
/// proxy auth, basic_auth
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ProxyAuth {
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
/// request proxy
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct GQLProxy {
|
||||
/// schema, proxy url
|
||||
pub schema: String,
|
||||
/// proxy type
|
||||
pub type_: ProxyType,
|
||||
/// auth
|
||||
pub auth: Option<ProxyAuth>,
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl TryFrom<GQLProxy> for reqwest::Proxy {
|
||||
type Error = GraphQLError;
|
||||
|
||||
fn try_from(gql_proxy: GQLProxy) -> Result<Self, Self::Error> {
|
||||
let proxy = match gql_proxy.type_ {
|
||||
ProxyType::Http => reqwest::Proxy::http(gql_proxy.schema),
|
||||
ProxyType::Https => reqwest::Proxy::https(gql_proxy.schema),
|
||||
ProxyType::All => reqwest::Proxy::all(gql_proxy.schema),
|
||||
}
|
||||
.map_err(|e| Self::Error::with_text(format!("{:?}", e)))?;
|
||||
Ok(proxy)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct GQLClient {
|
||||
config: ClientConfig,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct RequestBody<T: Serialize> {
|
||||
query: String,
|
||||
variables: T,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct GraphQLResponse<T> {
|
||||
data: Option<T>,
|
||||
errors: Option<Vec<GraphQLErrorMessage>>,
|
||||
}
|
||||
|
||||
impl GQLClient {
|
||||
fn client(&self) -> Result<Client, GraphQLError> {
|
||||
let mut builder = Client::builder().timeout(std::time::Duration::from_secs(
|
||||
self.config.timeout.unwrap_or(5),
|
||||
));
|
||||
if let Some(proxy) = &self.config.proxy {
|
||||
builder = builder.proxy(proxy.clone().try_into()?);
|
||||
}
|
||||
builder
|
||||
.build()
|
||||
.map_err(|e| GraphQLError::with_text(format!("Can not create client: {:?}", e)))
|
||||
}
|
||||
}
|
||||
|
||||
impl GQLClient {
|
||||
pub fn new(endpoint: impl AsRef<str>) -> Self {
|
||||
Self {
|
||||
config: ClientConfig {
|
||||
endpoint: endpoint.as_ref().to_string(),
|
||||
timeout: None,
|
||||
headers: Default::default(),
|
||||
proxy: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_with_headers(
|
||||
endpoint: impl AsRef<str>,
|
||||
headers: HashMap<impl ToString, impl ToString>,
|
||||
) -> Self {
|
||||
let _headers: HashMap<String, String> = headers
|
||||
.iter()
|
||||
.map(|(name, value)| (name.to_string(), value.to_string()))
|
||||
.into_iter()
|
||||
.collect();
|
||||
Self {
|
||||
config: ClientConfig {
|
||||
endpoint: endpoint.as_ref().to_string(),
|
||||
timeout: None,
|
||||
headers: Some(_headers),
|
||||
proxy: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_with_config(config: ClientConfig) -> Self {
|
||||
Self { config }
|
||||
}
|
||||
}
|
||||
|
||||
impl GQLClient {
|
||||
pub async fn query<K>(&self, query: &str) -> Result<Option<K>, GraphQLError>
|
||||
where
|
||||
K: for<'de> Deserialize<'de>,
|
||||
{
|
||||
self.query_with_vars::<K, ()>(query, ()).await
|
||||
}
|
||||
|
||||
pub async fn query_unwrap<K>(&self, query: &str) -> Result<K, GraphQLError>
|
||||
where
|
||||
K: for<'de> Deserialize<'de>,
|
||||
{
|
||||
self.query_with_vars_unwrap::<K, ()>(query, ()).await
|
||||
}
|
||||
|
||||
pub async fn query_with_vars_unwrap<K, T: Serialize>(
|
||||
&self,
|
||||
query: &str,
|
||||
variables: T,
|
||||
) -> Result<K, GraphQLError>
|
||||
where
|
||||
K: for<'de> Deserialize<'de>,
|
||||
{
|
||||
match self.query_with_vars(query, variables).await? {
|
||||
Some(v) => Ok(v),
|
||||
None => Err(GraphQLError::with_text(format!(
|
||||
"No data from graphql server({}) for this query",
|
||||
self.config.endpoint
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn query_with_vars<K, T: Serialize>(
|
||||
&self,
|
||||
query: &str,
|
||||
variables: T,
|
||||
) -> Result<Option<K>, GraphQLError>
|
||||
where
|
||||
K: for<'de> Deserialize<'de>,
|
||||
{
|
||||
self.query_with_vars_by_endpoint(&self.config.endpoint, query, variables)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn query_with_vars_by_endpoint<K, T: Serialize>(
|
||||
&self,
|
||||
endpoint: impl AsRef<str>,
|
||||
query: &str,
|
||||
variables: T,
|
||||
) -> Result<Option<K>, GraphQLError>
|
||||
where
|
||||
K: for<'de> Deserialize<'de>,
|
||||
{
|
||||
let mut times = 1;
|
||||
let mut endpoint = endpoint.as_ref().to_string();
|
||||
let endpoint_url = Url::from_str(&endpoint).map_err(|e| {
|
||||
GraphQLError::with_text(format!("Wrong endpoint: {}. {:?}", endpoint, e))
|
||||
})?;
|
||||
let schema = endpoint_url.scheme();
|
||||
let host = endpoint_url
|
||||
.host()
|
||||
.ok_or_else(|| GraphQLError::with_text(format!("Wrong endpoint: {}", endpoint)))?;
|
||||
|
||||
let client: Client = self.client()?;
|
||||
let body = RequestBody {
|
||||
query: query.to_string(),
|
||||
variables,
|
||||
};
|
||||
|
||||
loop {
|
||||
if times > 10 {
|
||||
return Err(GraphQLError::with_text(format!(
|
||||
"Many redirect location: {}",
|
||||
endpoint
|
||||
)));
|
||||
}
|
||||
|
||||
let mut request = client.post(&endpoint).json(&body);
|
||||
if let Some(headers) = &self.config.headers {
|
||||
if !headers.is_empty() {
|
||||
for (name, value) in headers {
|
||||
request = request.header(name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let raw_response = request.send().await?;
|
||||
if let Some(location) = raw_response.headers().get(reqwest::header::LOCATION) {
|
||||
let redirect_url = location.to_str().map_err(|e| {
|
||||
GraphQLError::with_text(format!(
|
||||
"Failed to parse response header: Location. {:?}",
|
||||
e
|
||||
))
|
||||
})?;
|
||||
|
||||
// if the response location start with http:// or https://
|
||||
if redirect_url.starts_with("http://") || redirect_url.starts_with("https://") {
|
||||
times += 1;
|
||||
endpoint = redirect_url.to_string();
|
||||
continue;
|
||||
}
|
||||
|
||||
// without schema
|
||||
endpoint = if redirect_url.starts_with('/') {
|
||||
format!("{}://{}{}", schema, host, redirect_url)
|
||||
} else {
|
||||
format!("{}://{}/{}", schema, host, redirect_url)
|
||||
};
|
||||
times += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
let status = raw_response.status();
|
||||
let response_body_text = raw_response
|
||||
.text()
|
||||
.await
|
||||
.map_err(|e| GraphQLError::with_text(format!("Can not get response: {:?}", e)))?;
|
||||
|
||||
let json: GraphQLResponse<K> =
|
||||
serde_json::from_str(&response_body_text).map_err(|e| {
|
||||
GraphQLError::with_text(format!(
|
||||
"Failed to parse response: {:?}. The response body is: {}",
|
||||
e, response_body_text
|
||||
))
|
||||
})?;
|
||||
|
||||
if !status.is_success() {
|
||||
return Err(GraphQLError::with_message_and_json(
|
||||
format!("The response is [{}]", status.as_u16()),
|
||||
json.errors.unwrap_or_default(),
|
||||
));
|
||||
}
|
||||
|
||||
// Check if error messages have been received
|
||||
if json.errors.is_some() {
|
||||
return Err(GraphQLError::with_json(json.errors.unwrap_or_default()));
|
||||
}
|
||||
if json.data.is_none() {
|
||||
tracing::warn!(
|
||||
target = "gql-client",
|
||||
response_text = response_body_text,
|
||||
"The deserialized data is none, the response",
|
||||
);
|
||||
}
|
||||
|
||||
return Ok(json.data);
|
||||
}
|
||||
}
|
||||
}
|
52
crates/dagger-core/src/graphql_client.rs
Normal file
52
crates/dagger-core/src/graphql_client.rs
Normal file
@@ -0,0 +1,52 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use base64::engine::general_purpose;
|
||||
use base64::Engine;
|
||||
use gql_client::ClientConfig;
|
||||
|
||||
use crate::connect_params::ConnectParams;
|
||||
|
||||
#[async_trait]
|
||||
pub trait GraphQLClient {
|
||||
async fn query(&self, query: &str) -> eyre::Result<Option<serde_json::Value>>;
|
||||
}
|
||||
|
||||
pub type DynGraphQLClient = Arc<dyn GraphQLClient + Send + Sync>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DefaultGraphQLClient {
|
||||
client: gql_client::Client,
|
||||
}
|
||||
|
||||
impl DefaultGraphQLClient {
|
||||
pub fn new(conn: &ConnectParams) -> Self {
|
||||
let token = general_purpose::URL_SAFE.encode(format!("{}:", conn.session_token));
|
||||
|
||||
let mut headers = HashMap::new();
|
||||
headers.insert("Authorization".to_string(), format!("Basic {}", token));
|
||||
|
||||
Self {
|
||||
client: gql_client::Client::new_with_config(ClientConfig {
|
||||
endpoint: conn.url(),
|
||||
timeout: Some(1000),
|
||||
headers: Some(headers),
|
||||
proxy: None,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl GraphQLClient for DefaultGraphQLClient {
|
||||
async fn query(&self, query: &str) -> eyre::Result<Option<serde_json::Value>> {
|
||||
let res: Option<serde_json::Value> = self
|
||||
.client
|
||||
.query(&query)
|
||||
.await
|
||||
.map_err(|r| eyre::anyhow!(r.to_string()))?;
|
||||
|
||||
return Ok(res);
|
||||
}
|
||||
}
|
@@ -7,7 +7,9 @@ pub mod config;
|
||||
pub mod connect_params;
|
||||
pub mod downloader;
|
||||
pub mod engine;
|
||||
pub mod graphql_client;
|
||||
pub mod introspection;
|
||||
pub mod logger;
|
||||
pub mod schema;
|
||||
pub mod session;
|
||||
|
||||
|
8
crates/dagger-core/src/logger.rs
Normal file
8
crates/dagger-core/src/logger.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
pub trait Logger {
|
||||
fn stdout(&self, output: &str) -> eyre::Result<()>;
|
||||
fn stderr(&self, output: &str) -> eyre::Result<()>;
|
||||
}
|
||||
|
||||
pub type DynLogger = Arc<dyn Logger + Send + Sync>;
|
@@ -2,7 +2,7 @@ use crate::introspection::IntrospectionResponse;
|
||||
use crate::{config::Config, engine::Engine, session::Session};
|
||||
|
||||
pub async fn get_schema() -> eyre::Result<IntrospectionResponse> {
|
||||
let cfg = Config::new(None, None, None, None);
|
||||
let cfg = Config::default();
|
||||
|
||||
//TODO: Implement context for proc
|
||||
let (conn, _proc) = Engine::new().start(&cfg).await?;
|
||||
|
@@ -6,8 +6,43 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to
|
||||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## v0.2.19 (2023-03-14)
|
||||
|
||||
### Chore
|
||||
|
||||
- <csr-id-6629d2db4fbc7cdba9b2e4a241e4b0a2592cf384/> fix release version
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- <csr-id-8fd6bb983ef00b1aa2cf1ba3088028329033c38f/> serialization of enum args for graphql
|
||||
|
||||
### Commit Statistics
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 2 commits contributed to the release.
|
||||
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||
- 1 unique issue was worked on: [#34](https://github.com/kjuulh/dagger-rs/issues/34)
|
||||
|
||||
### Commit Details
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
<details><summary>view details</summary>
|
||||
|
||||
* **[#34](https://github.com/kjuulh/dagger-rs/issues/34)**
|
||||
- serialization of enum args for graphql ([`8fd6bb9`](https://github.com/kjuulh/dagger-rs/commit/8fd6bb983ef00b1aa2cf1ba3088028329033c38f))
|
||||
* **Uncategorized**
|
||||
- fix release version ([`6629d2d`](https://github.com/kjuulh/dagger-rs/commit/6629d2db4fbc7cdba9b2e4a241e4b0a2592cf384))
|
||||
</details>
|
||||
|
||||
## v0.2.17 (2023-03-13)
|
||||
|
||||
<csr-id-f67928155f02076cbb41abd4010523879ff3caf1/>
|
||||
<csr-id-2cc0231c5f29993081f0f7e15e44cac95a7d6086/>
|
||||
<csr-id-9ba01396cb44ee02cf7a16008e3f0bdae9f78754/>
|
||||
<csr-id-e9e35edb1cb67eee8cc033212aba3b1888def78f/>
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- <csr-id-1bfd084cd28e2b984c61de7f3f9a065cc41be007/> make sure tests have a command to execute
|
||||
@@ -30,7 +65,7 @@ and this project adheres to
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 9 commits contributed to the release over the course of 2 calendar days.
|
||||
- 10 commits contributed to the release over the course of 2 calendar days.
|
||||
- 2 days passed between releases.
|
||||
- 9 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||
- 0 issues like '(#ID)' were seen in commit messages
|
||||
@@ -42,6 +77,7 @@ and this project adheres to
|
||||
<details><summary>view details</summary>
|
||||
|
||||
* **Uncategorized**
|
||||
- Release dagger-sdk v0.2.17 ([`a8e6dde`](https://github.com/kjuulh/dagger-rs/commit/a8e6dde615029d9a94d159ed84b5373121cd201f))
|
||||
- make sure tests have a command to execute ([`1bfd084`](https://github.com/kjuulh/dagger-rs/commit/1bfd084cd28e2b984c61de7f3f9a065cc41be007))
|
||||
- remove unused imports ([`5593fce`](https://github.com/kjuulh/dagger-rs/commit/5593fce2e16e0aa97a2e6843f15d3bb1121048f5))
|
||||
- remove export and instead use exitcode ([`2cc0231`](https://github.com/kjuulh/dagger-rs/commit/2cc0231c5f29993081f0f7e15e44cac95a7d6086))
|
||||
|
@@ -1,28 +1,30 @@
|
||||
[package]
|
||||
name = "dagger-sdk"
|
||||
version = "0.2.17"
|
||||
version = "0.2.19"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
description = "A dagger sdk for rust, written in rust"
|
||||
repository = "https://github.com/kjuulh/dagger-rs"
|
||||
repository = "https://github.com/kjuulh/dagger-sdk"
|
||||
publish = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dagger-core = { path = "../dagger-core", version = "^0.2.8" }
|
||||
dagger-core = { workspace = true }
|
||||
|
||||
eyre = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tracing.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
|
||||
base64 = "0.21.0"
|
||||
eyre = "0.6.8"
|
||||
futures = "0.3.27"
|
||||
gql_client = "1.0.7"
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.93"
|
||||
tokio = { version = "1.25.0", features = ["full"] }
|
||||
derive_builder = "0.12.0"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.3.0"
|
||||
rand = "0.8.5"
|
||||
genco = "0.17.3"
|
||||
tracing-test = "0.2.4"
|
||||
|
@@ -35,7 +35,7 @@ async fn main() -> eyre::Result<()> {
|
||||
.container()
|
||||
.from("nginx")
|
||||
.with_directory("/usr/share/nginx/html", build_dir.id().await?)
|
||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))
|
||||
.publish(format!("ttl.sh/hello-dagger-sdk-{}:1h", rng.gen::<u64>()))
|
||||
.await?;
|
||||
|
||||
println!("published image to: {}", ref_);
|
||||
|
@@ -13,7 +13,7 @@ async fn main() -> eyre::Result<()> {
|
||||
let ref_ = client
|
||||
.container()
|
||||
.build(context_dir.id().await?)
|
||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))
|
||||
.publish(format!("ttl.sh/hello-dagger-sdk-{}:1h", rng.gen::<u64>()))
|
||||
.await?;
|
||||
|
||||
println!("published image to: {}", ref_);
|
||||
|
25
crates/dagger-sdk/examples/logging/app/.gitignore
vendored
Normal file
25
crates/dagger-sdk/examples/logging/app/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
build-*
|
17
crates/dagger-sdk/examples/logging/app/README.md
Normal file
17
crates/dagger-sdk/examples/logging/app/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# React Build
|
||||
|
||||
This is based on the [Getting Started guide for Nodejs](https://docs.dagger.io/sdk/nodejs/783645/get-started#step-5-test-against-multiple-nodejs-versions)
|
||||
|
||||
A simple react app is created with `create-react-app` which is built and tested by `build.js` or `build.ts`.
|
||||
|
||||
Run:
|
||||
|
||||
`npm install`
|
||||
|
||||
and then:
|
||||
|
||||
`node --loader ts-node/esm ./build.ts`
|
||||
|
||||
or
|
||||
|
||||
`node ./build.js`
|
29700
crates/dagger-sdk/examples/logging/app/package-lock.json
generated
Normal file
29700
crates/dagger-sdk/examples/logging/app/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
48
crates/dagger-sdk/examples/logging/app/package.json
Normal file
48
crates/dagger-sdk/examples/logging/app/package.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "react-build",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/node": "^16.18.6",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-scripts": "5.0.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.3",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@dagger.io/dagger": "^0.3.2"
|
||||
}
|
||||
}
|
BIN
crates/dagger-sdk/examples/logging/app/public/favicon.ico
Normal file
BIN
crates/dagger-sdk/examples/logging/app/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
43
crates/dagger-sdk/examples/logging/app/public/index.html
Normal file
43
crates/dagger-sdk/examples/logging/app/public/index.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
BIN
crates/dagger-sdk/examples/logging/app/public/logo192.png
Normal file
BIN
crates/dagger-sdk/examples/logging/app/public/logo192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
crates/dagger-sdk/examples/logging/app/public/logo512.png
Normal file
BIN
crates/dagger-sdk/examples/logging/app/public/logo512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
25
crates/dagger-sdk/examples/logging/app/public/manifest.json
Normal file
25
crates/dagger-sdk/examples/logging/app/public/manifest.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
3
crates/dagger-sdk/examples/logging/app/public/robots.txt
Normal file
3
crates/dagger-sdk/examples/logging/app/public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
38
crates/dagger-sdk/examples/logging/app/src/App.css
Normal file
38
crates/dagger-sdk/examples/logging/app/src/App.css
Normal file
@@ -0,0 +1,38 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
9
crates/dagger-sdk/examples/logging/app/src/App.test.tsx
Normal file
9
crates/dagger-sdk/examples/logging/app/src/App.test.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
26
crates/dagger-sdk/examples/logging/app/src/App.tsx
Normal file
26
crates/dagger-sdk/examples/logging/app/src/App.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
13
crates/dagger-sdk/examples/logging/app/src/index.css
Normal file
13
crates/dagger-sdk/examples/logging/app/src/index.css
Normal file
@@ -0,0 +1,13 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
19
crates/dagger-sdk/examples/logging/app/src/index.tsx
Normal file
19
crates/dagger-sdk/examples/logging/app/src/index.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
const root = ReactDOM.createRoot(
|
||||
document.getElementById('root') as HTMLElement
|
||||
);
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
1
crates/dagger-sdk/examples/logging/app/src/logo.svg
Normal file
1
crates/dagger-sdk/examples/logging/app/src/logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
After Width: | Height: | Size: 2.6 KiB |
1
crates/dagger-sdk/examples/logging/app/src/react-app-env.d.ts
vendored
Normal file
1
crates/dagger-sdk/examples/logging/app/src/react-app-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="react-scripts" />
|
@@ -0,0 +1,15 @@
|
||||
import { ReportHandler } from 'web-vitals';
|
||||
|
||||
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
5
crates/dagger-sdk/examples/logging/app/src/setupTests.ts
Normal file
5
crates/dagger-sdk/examples/logging/app/src/setupTests.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
26
crates/dagger-sdk/examples/logging/app/tsconfig.json
Normal file
26
crates/dagger-sdk/examples/logging/app/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
49
crates/dagger-sdk/examples/logging/main.rs
Normal file
49
crates/dagger-sdk/examples/logging/main.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use dagger_sdk::logging::TracingLogger;
|
||||
use dagger_sdk::HostDirectoryOpts;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> eyre::Result<()> {
|
||||
dagger_sdk::logging::default_logging()?;
|
||||
|
||||
let client = dagger_sdk::connect_opts(dagger_sdk::Config {
|
||||
workdir_path: None,
|
||||
config_path: None,
|
||||
timeout_ms: 1000,
|
||||
execute_timeout_ms: None,
|
||||
logger: Some(Arc::new(TracingLogger::default())),
|
||||
})
|
||||
.await?;
|
||||
|
||||
let host_source_dir = client.host().directory_opts(
|
||||
"examples/build-the-application/app",
|
||||
HostDirectoryOpts {
|
||||
exclude: Some(vec!["node_modules".into(), "ci/".into()]),
|
||||
include: None,
|
||||
},
|
||||
);
|
||||
|
||||
let source = client
|
||||
.container()
|
||||
.from("node:16")
|
||||
.with_mounted_directory("/src", host_source_dir.id().await?);
|
||||
|
||||
let runner = source
|
||||
.with_workdir("/src")
|
||||
.with_exec(vec!["npm", "install"]);
|
||||
|
||||
let test = runner.with_exec(vec!["npm", "test", "--", "--watchAll=false"]);
|
||||
|
||||
let build_dir = test
|
||||
.with_exec(vec!["npm", "run", "build"])
|
||||
.directory("./build");
|
||||
|
||||
let _ = build_dir.export("./build");
|
||||
|
||||
let entries = build_dir.entries().await;
|
||||
|
||||
println!("build dir contents: \n {:?}", entries);
|
||||
|
||||
Ok(())
|
||||
}
|
@@ -34,7 +34,7 @@ async fn main() -> eyre::Result<()> {
|
||||
.container()
|
||||
.from("nginx")
|
||||
.with_directory("/usr/share/nginx/html", build_dir.id().await?)
|
||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))
|
||||
.publish(format!("ttl.sh/hello-dagger-sdk-{}:1h", rng.gen::<u64>()))
|
||||
.await?;
|
||||
|
||||
println!("published image to: {}", ref_);
|
||||
|
@@ -39,7 +39,7 @@ async fn main() -> eyre::Result<()> {
|
||||
"/usr/share/nginx/html",
|
||||
client.host().directory(output).id().await?,
|
||||
)
|
||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))
|
||||
.publish(format!("ttl.sh/hello-dagger-sdk-{}:1h", rng.gen::<u64>()))
|
||||
.await?;
|
||||
|
||||
println!("published image to: {}", ref_);
|
||||
|
@@ -1,43 +1,32 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use base64::engine::general_purpose;
|
||||
use base64::Engine;
|
||||
use dagger_core::graphql_client::DefaultGraphQLClient;
|
||||
|
||||
use dagger_core::config::Config;
|
||||
use dagger_core::connect_params::ConnectParams;
|
||||
use dagger_core::engine::Engine as DaggerEngine;
|
||||
use gql_client::ClientConfig;
|
||||
|
||||
use crate::gen::Query;
|
||||
use crate::logging::StdLogger;
|
||||
use crate::querybuilder::query;
|
||||
|
||||
pub type DaggerConn = Arc<Query>;
|
||||
|
||||
pub async fn connect() -> eyre::Result<DaggerConn> {
|
||||
let cfg = Config::default();
|
||||
let cfg = Config::new(None, None, None, None, Some(Arc::new(StdLogger::default())));
|
||||
|
||||
connect_opts(cfg).await
|
||||
}
|
||||
|
||||
pub async fn connect_opts(cfg: Config) -> eyre::Result<DaggerConn> {
|
||||
let (conn, proc) = DaggerEngine::new().start(&cfg).await?;
|
||||
|
||||
Ok(Arc::new(Query {
|
||||
conn,
|
||||
proc: Arc::new(proc),
|
||||
selection: query(),
|
||||
graphql_client: Arc::new(DefaultGraphQLClient::new(&conn)),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn graphql_client(conn: &ConnectParams) -> gql_client::Client {
|
||||
let token = general_purpose::URL_SAFE.encode(format!("{}:", conn.session_token));
|
||||
|
||||
let mut headers = HashMap::new();
|
||||
headers.insert("Authorization".to_string(), format!("Basic {}", token));
|
||||
|
||||
gql_client::Client::new_with_config(ClientConfig {
|
||||
endpoint: conn.url(),
|
||||
timeout: Some(1000),
|
||||
headers: Some(headers),
|
||||
proxy: None,
|
||||
})
|
||||
}
|
||||
|
||||
// Conn will automatically close on drop of proc
|
||||
|
||||
#[cfg(test)]
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,9 @@
|
||||
|
||||
mod client;
|
||||
mod gen;
|
||||
pub mod logging;
|
||||
mod querybuilder;
|
||||
|
||||
pub use client::*;
|
||||
pub use dagger_core::config::Config;
|
||||
pub use gen::*;
|
||||
|
81
crates/dagger-sdk/src/logging.rs
Normal file
81
crates/dagger-sdk/src/logging.rs
Normal file
@@ -0,0 +1,81 @@
|
||||
use dagger_core::logger::{DynLogger, Logger};
|
||||
use tracing::Level;
|
||||
|
||||
pub fn default_logging() -> eyre::Result<()> {
|
||||
tracing_subscriber::fmt().with_max_level(Level::INFO).init();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub struct StdLogger {}
|
||||
|
||||
impl Default for StdLogger {
|
||||
fn default() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Logger for StdLogger {
|
||||
fn stdout(&self, output: &str) -> eyre::Result<()> {
|
||||
println!("{}", output);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stderr(&self, output: &str) -> eyre::Result<()> {
|
||||
eprintln!("{}", output);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TracingLogger {}
|
||||
|
||||
impl Default for TracingLogger {
|
||||
fn default() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Logger for TracingLogger {
|
||||
fn stdout(&self, output: &str) -> eyre::Result<()> {
|
||||
tracing::info!(output = output, "dagger-sdk");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stderr(&self, output: &str) -> eyre::Result<()> {
|
||||
tracing::warn!(output = output, "dagger-sdk");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct AggregateLogger {
|
||||
pub loggers: Vec<DynLogger>,
|
||||
}
|
||||
|
||||
impl Default for AggregateLogger {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
loggers: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Logger for AggregateLogger {
|
||||
fn stdout(&self, output: &str) -> eyre::Result<()> {
|
||||
for logger in &self.loggers {
|
||||
logger.stdout(output).unwrap()
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stderr(&self, output: &str) -> eyre::Result<()> {
|
||||
for logger in &self.loggers {
|
||||
logger.stderr(output).unwrap()
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
use std::{collections::HashMap, ops::Add, sync::Arc};
|
||||
|
||||
use dagger_core::graphql_client::DynGraphQLClient;
|
||||
use eyre::Context;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -68,6 +69,29 @@ impl Selection {
|
||||
s
|
||||
}
|
||||
|
||||
pub fn arg_enum<S>(&self, name: &str, value: S) -> Selection
|
||||
where
|
||||
S: Serialize,
|
||||
{
|
||||
let mut s = self.clone();
|
||||
|
||||
let val = serde_json::to_string(&value).unwrap();
|
||||
let val = val[1..val.len() - 1].to_string();
|
||||
|
||||
match s.args.as_mut() {
|
||||
Some(args) => {
|
||||
let _ = args.insert(name.to_string(), val);
|
||||
}
|
||||
None => {
|
||||
let mut hm = HashMap::new();
|
||||
let _ = hm.insert(name.to_string(), val);
|
||||
s.args = Some(hm);
|
||||
}
|
||||
}
|
||||
|
||||
s
|
||||
}
|
||||
|
||||
pub fn build(&self) -> eyre::Result<String> {
|
||||
let mut fields = vec!["query".to_string()];
|
||||
|
||||
@@ -76,7 +100,7 @@ impl Selection {
|
||||
if let Some(args) = sel.args {
|
||||
let actualargs = args
|
||||
.iter()
|
||||
.map(|(name, arg)| format!("{name}:{arg}"))
|
||||
.map(|(name, arg)| format!("{name}:{}", arg.as_str()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
query = query.add(&format!("({})", actualargs.join(", ")));
|
||||
@@ -93,12 +117,14 @@ impl Selection {
|
||||
Ok(fields.join("{") + &"}".repeat(fields.len() - 1))
|
||||
}
|
||||
|
||||
pub async fn execute<D>(&self, gql_client: &gql_client::Client) -> eyre::Result<D>
|
||||
pub async fn execute<D>(&self, gql_client: DynGraphQLClient) -> eyre::Result<D>
|
||||
where
|
||||
D: for<'de> Deserialize<'de>,
|
||||
{
|
||||
let query = self.build()?;
|
||||
|
||||
tracing::trace!(query = query.as_str(), "dagger-query");
|
||||
|
||||
let resp: Option<serde_json::Value> = match gql_client.query(&query).await {
|
||||
Ok(r) => r,
|
||||
Err(e) => eyre::bail!(e),
|
||||
|
29
crates/dagger-sdk/tests/issues/iss_33.rs
Normal file
29
crates/dagger-sdk/tests/issues/iss_33.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use dagger_sdk::{ContainerWithExposedPortOpts, NetworkProtocol};
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_issue_30_alt() -> eyre::Result<()> {
|
||||
let client = dagger_sdk::connect().await?;
|
||||
|
||||
client
|
||||
.container()
|
||||
.from("denoland/deno:debian-1.30.3")
|
||||
.with_exposed_port_opts(
|
||||
53,
|
||||
ContainerWithExposedPortOpts {
|
||||
protocol: Some(NetworkProtocol::TCP),
|
||||
description: None,
|
||||
},
|
||||
)
|
||||
.with_exposed_port_opts(
|
||||
53,
|
||||
ContainerWithExposedPortOpts {
|
||||
protocol: Some(NetworkProtocol::UDP),
|
||||
description: None,
|
||||
},
|
||||
)
|
||||
.with_exec(vec!["echo", "hello"])
|
||||
.exit_code()
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
@@ -1 +1,2 @@
|
||||
mod iss_30;
|
||||
mod iss_33;
|
||||
|
Reference in New Issue
Block a user