-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,18 +14,76 @@ This is called "function chaining", and is a core feature of Dagger. | |
Dagger's core types ([Container](https://docs.dagger.io/api/reference/#definition-Container), [Directory](https://docs.dagger.io/api/reference/#definition-Directory), [File](https://docs.dagger.io/api/reference/#definition-File), [Service](https://docs.dagger.io/api/reference/#definition-Service), ...) | ||
are all objects. They each define various functions for interacting with their respective objects. | ||
|
||
Print the contents of a file returned by a Dagger Function, by chaining a call to the `File` object's `Contents()` function: | ||
Let's explore them step by step: | ||
|
||
```bash | ||
dagger call --mod github.com/dagger/dagger/dev/ruff@a29dadbb5d9968784847a15fccc5629daf2985ae lint --source=https://github.com/puzzle/puzzle-radicale-auth-ldap report contents | ||
dagger call --mod github.com/sagikazarmark/daggerverse/[email protected] --help | ||
``` | ||
|
||
{{% details title="show available 'module' functions" mode-switcher="normalexpertmode" %}} | ||
``` | ||
USAGE | ||
dagger call [options] [arguments] <function> | ||
FUNCTIONS | ||
container | ||
host-keys Returns the SSH host keys. | ||
known-hosts Return a formatted SSH known_hosts file. | ||
---> service Return a service that runs the OpenSSH server. | ||
with-authorized-key Authorize a public key. | ||
with-config Mount a custom SSH configuration file (with .conf extension). | ||
``` | ||
{{% /details %}} | ||
|
||
```bash | ||
dagger call --mod github.com/sagikazarmark/daggerverse/[email protected] service --help | ||
``` | ||
|
||
{{% details title="show available 'service' object functions" mode-switcher="normalexpertmode" %}} | ||
``` | ||
USAGE | ||
dagger call service [arguments] <function> | ||
FUNCTIONS | ||
endpoint Retrieves an endpoint that clients can use to reach this container. | ||
hostname Retrieves a hostname which can be used by clients to reach this container. | ||
ports Retrieves the list of ports provided by the service. | ||
start Start the service and wait for its health checks to succeed. | ||
stop Stop the service. | ||
---> up Creates a tunnel that forwards traffic from the callers network to this service. | ||
``` | ||
{{% /details %}} | ||
|
||
```bash | ||
dagger call --mod github.com/sagikazarmark/daggerverse/[email protected] service up --help | ||
``` | ||
|
||
{{% details title="show available 'up' function arguments" mode-switcher="normalexpertmode" %}} | ||
``` | ||
USAGE | ||
dagger call service up [arguments] | ||
ARGUMENTS | ||
---> --ports PortForward List of frontend/backend port mappings to forward. | ||
Frontend is the port accepting traffic on the host, backend is the service port. (default []) | ||
--random Bind each tunnel port to a random port on the host. | ||
``` | ||
{{% /details %}} | ||
|
||
Expose a service returned by a Dagger Function on a specified host port, by chaining a call to the `Service` object's `Up()` function: | ||
Now that we have got all the pieces together, let's expose a Service returned by a Dagger Function on a specified host port, | ||
by chaining a call to the `Service` object's `Up()` function: | ||
|
||
```bash | ||
dagger call --mod github.com/sagikazarmark/daggerverse/[email protected] service up --ports=22022:22 | ||
``` | ||
|
||
Here we print the contents of a File returned by a Dagger Function, by chaining a call to the `File` object's `Contents()` function: | ||
|
||
```bash | ||
dagger call --mod github.com/dagger/dagger/dev/ruff@a29dadbb5d9968784847a15fccc5629daf2985ae lint --source=https://github.com/puzzle/puzzle-radicale-auth-ldap report contents | ||
``` | ||
|
||
|
||
### Task {{% param sectionnumber %}}.1: Chain calls | ||
|
||
|