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:
Andrea Luzzardi 2022-03-09 12:07:13 -08:00
parent 64f8bd95de
commit 24d6bfd692
96 changed files with 15028 additions and 70 deletions

View file

@ -0,0 +1,42 @@
// Base package for Alpine Linux
package alpine
import (
"universe.dagger.io/docker"
)
// Build an Alpine Linux container image
#Build: {
// Alpine version to install.
version: string | *"3.15.0@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300"
// 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: "index.docker.io/alpine:\(version)"
},
for pkgName, pkg in packages {
docker.#Run & {
command: {
name: "apk"
args: ["add", "\(pkgName)\(pkg.version)"]
flags: {
"-U": true
"--no-cache": true
}
}
}
},
]
}
}

View file

@ -0,0 +1,8 @@
setup() {
load '../../bats_helpers'
common_setup
}
@test "alpine" {
dagger up
}

View file

@ -0,0 +1,52 @@
package alpine
import (
"dagger.io/dagger"
"universe.dagger.io/alpine"
"universe.dagger.io/docker"
)
dagger.#Plan & {
actions: tests: {
// Test: customize alpine version
alpineVersion: {
build: alpine.#Build & {
// install an old version on purpose
version: "3.10.9"
}
verify: dagger.#Readfile & {
input: build.output.rootfs
path: "/etc/alpine-release"
contents: "3.10.9\n"
}
}
// Test: install packages
packageInstall: {
build: alpine.#Build & {
packages: {
jq: {}
curl: {}
}
}
check: docker.#Run & {
input: build.output
command: {
name: "sh"
flags: "-c": """
jq --version > /jq-version.txt
curl --version > /curl-version.txt
"""
}
export: files: {
"/jq-version.txt": contents: =~"^jq"
"/curl-version.txt": contents: =~"^curl"
}
}
}
}
}