#Do you want to do something specific

1 messages · Page 1 of 1 (latest)

rough lily
#

i want to execute different gradle steps and see how this works in dagger.

wind latch
#

I'm almost completely new to Dagger myself, but here are my thoughts:

Running dagger means creating a new Docker container that should run everything you need. This means in order to run a gradle task, you need to either:

  1. use core.#Copy to copy gradlew from your local filesystem into the container
  2. use volume mount to mount your local directory onto your docker container

The nice thing about gradlew that you might already know is that if Gradle is not present on the system, running any gradle task will automatically download the required dependencies
https://docs.gradle.org/current/userguide/gradle_wrapper.html

So the next step would be to execute a gradle task with core.#Exec, where you specify for example gradlew build

You can see the core actions here:
https://docs.dagger.io/1222/core-actions-reference

Core Actions are primitives implemented by the Dagger Engine itself. They can be combined into higher-level composite actions. Their definitions can be imported in the dagger.io/dagger/core package.

#

Not sure if this is how it actually works, but it's a start

rough lily
#

I started with a copy of the alpine action with amazon corretto as a image

#

do i need to copy everything to the container, or can i mount always?

#
package todoappimport ( "dagger.io/dagger" "dagger.io/dagger/core" "universe.dagger.io/bash" "universe.dagger.io/docker")_#appName: "search-di-variation-exporter"#AmazonCorrettoBuild: { // Alpine version to install. version: string | *"11" // List of packages to install packages: [pkgName=string]: {  // NOTE(samalba, gh issue #1532):  //   it's not recommended to pin the version as it is already pinned by the major Alpine version  //   version pinning is for future use (as soon as we support custom repositories like `community`,  //   `testing` or `edge`)  version: string | *"" } docker.#Build & {  steps: [   docker.#Pull & {    source: "amazoncorretto:\(version)"   },   for pkgName, pkg in packages {    docker.#Run & {     command: {      name: "yum"      args: ["install", "\(pkgName)\(pkg.version)"]      flags: {       "-y": true      }     }    }   },  ] }}dagger.#Plan & { _app: "./": {  dest:     "/src/"  type:     "cache"  contents: core.#CacheDir & {   id: _#appName  } } client: filesystem: {  "./": {   read: contents: dagger.#FS  } } actions: {  image: #AmazonCorrettoBuild & {   packages: "git": _  }  test: bash.#Run & {   input:   image.output   mounts:  _app   workdir: "/src"   script: contents: #"""    ls -al /    ls -al /src    ./gradlew test    """#  } }}
#

dont know how to format...