mirror of
https://github.com/dagger/dagger-for-github.git
synced 2026-01-02 13:20:11 +11:00
update action to dagger 0.2
- Remove AGE key setup - Update README to use `dagger do` - Update tests to dagger 0.2 Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
64f8bd95de
commit
24d6bfd692
96 changed files with 15028 additions and 70 deletions
59
test/cue.mod/pkg/universe.dagger.io/bash/bash.cue
vendored
Executable file
59
test/cue.mod/pkg/universe.dagger.io/bash/bash.cue
vendored
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
// Helpers to run bash commands in containers
|
||||
package bash
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
// Run a bash script in a Docker container
|
||||
// Since this is a thin wrapper over docker.#Run, we embed it.
|
||||
// Whether to embed or wrap is a case-by-case decision, like in Go.
|
||||
#Run: {
|
||||
// The script to execute
|
||||
script: {
|
||||
// A directory containing one or more bash scripts
|
||||
directory: dagger.#FS
|
||||
|
||||
// Name of the file to execute
|
||||
filename: string
|
||||
|
||||
_directory: directory
|
||||
_filename: filename
|
||||
} | {
|
||||
// Script contents
|
||||
contents: string
|
||||
|
||||
_filename: "run.sh"
|
||||
_write: dagger.#WriteFile & {
|
||||
input: dagger.#Scratch
|
||||
path: _filename
|
||||
"contents": contents
|
||||
}
|
||||
_directory: _write.output
|
||||
}
|
||||
|
||||
// Arguments to the script
|
||||
args: [...string]
|
||||
|
||||
// Where in the container to mount the scripts directory
|
||||
_mountpoint: "/bash/scripts"
|
||||
|
||||
docker.#Run & {
|
||||
command: {
|
||||
name: "bash"
|
||||
"args": ["\(_mountpoint)/\(script._filename)"] + args
|
||||
// FIXME: make default flags overrideable
|
||||
flags: {
|
||||
"--norc": true
|
||||
"-e": true
|
||||
"-o": "pipefail"
|
||||
}
|
||||
}
|
||||
mounts: "Bash scripts": {
|
||||
contents: script._directory
|
||||
dest: _mountpoint
|
||||
}
|
||||
}
|
||||
}
|
||||
3
test/cue.mod/pkg/universe.dagger.io/bash/test/data/hello.sh
vendored
Executable file
3
test/cue.mod/pkg/universe.dagger.io/bash/test/data/hello.sh
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo Hello, world > /out.txt
|
||||
10
test/cue.mod/pkg/universe.dagger.io/bash/test/test.bats
vendored
Executable file
10
test/cue.mod/pkg/universe.dagger.io/bash/test/test.bats
vendored
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
setup() {
|
||||
load '../../bats_helpers'
|
||||
|
||||
common_setup
|
||||
}
|
||||
|
||||
@test "bash" {
|
||||
dagger up
|
||||
}
|
||||
|
||||
49
test/cue.mod/pkg/universe.dagger.io/bash/test/test.cue
vendored
Executable file
49
test/cue.mod/pkg/universe.dagger.io/bash/test/test.cue
vendored
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
package bash
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/bash"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
actions: tests: {
|
||||
|
||||
_pull: docker.#Pull & {
|
||||
source: "index.docker.io/debian"
|
||||
}
|
||||
_image: _pull.output
|
||||
|
||||
// Run a script from source directory + filename
|
||||
runFile: {
|
||||
|
||||
dir: _load.output
|
||||
_load: dagger.#Source & {
|
||||
path: "./data"
|
||||
include: ["*.sh"]
|
||||
}
|
||||
|
||||
run: bash.#Run & {
|
||||
input: _image
|
||||
export: files: "/out.txt": _
|
||||
script: {
|
||||
directory: dir
|
||||
filename: "hello.sh"
|
||||
}
|
||||
}
|
||||
output: run.export.files."/out.txt" & "Hello, world\n"
|
||||
}
|
||||
|
||||
// Run a script from string
|
||||
runString: {
|
||||
run: bash.#Run & {
|
||||
input: _image
|
||||
export: files: "/output.txt": _
|
||||
script: contents: "echo 'Hello, inlined world!' > /output.txt"
|
||||
}
|
||||
output: run.export.files."/output.txt" & "Hello, inlined world!\n"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue