#Logic in functions

1 messages · Page 1 of 1 (latest)

lime relic
#

I have a beginner question. When I look at the examples of functions, most of them use the builder pattern to declare their logic combining engine primitives such as containers, and I was wondering if functions can be imperative, for example running a system process. I have the feeling it’s possible, but it’s hard to tell from the docs.

finite seal
lime relic
#

Is that container a Docker container? Let’s say I have a Swift SDK and a function implemented in Swift:

  • Is that function compiled using the host architecture? Or is it compiled inside a Docker container?
  • If I want to run system commands, like xcodebuild (from Xcode), which can’t run in a Linux container, can I do so?
finite seal
#

Yes, it's a Docker (OCI) container, using the Dagger API under the hood (the Dagger SDK which builds your Dagger module, is itself a Dagger module, it's the same Dagger API all the way down)

#

So the Dagger SDK uses the same API to build and run your module's runtime container, that you yourself can use to run containers in your pipeline

#

As a consequence of that: no, you can't execute system commands on your host system. (xcode etc). It's Linux only at the moment

lime relic
#

Gotcha 😞

finite seal
#

But, you can make calls to dagger functions from a script running on your local system for example

lime relic
#

It’s more that the inverse of that is not possible? (the Dagger function calling macOS-bound tools)

finite seal
lime relic
#

Do you think it’ll ever be possible to address the above without resorting to ssh connections to remote Mac servers?

finite seal
#

Not for a while

#

But eventually, yes

#

I'm going to say, 12 months from now

#

(this is my educated guess as an individual, not a commitment 🙂

#

Actually there may be shortcuts that make that 6 months. We could make special exceptions for well-known software like xcode

#

I think that if we get design consensus on how to special-case well-know, trusted software on the host (eg. xcode, we could conceivably accelerate this)

#

Can you tell me more about your use case @lime relic ?

lime relic
#

The iOS community is settled in a Ruby tool, Fastlane, which provides a DSL for automation plus some building blocks to ease automation.
The community would prefer to write those in Swift, so I want to build something and I thought, wait a second, Dagger could enable that, and not only that but free them from the vendor locking of proprietary pipelines.

#

The tools that are used the most that require macOS are those provided by Apple, which live in a conventional path that Dagger could detect.

#

I think if something like this was implemented, you’d gain a good chunk of the Swift community.