cue modules: move stdlib to pkg/alpha.dagger.io
In preparation for Europa, we will vendor multiple CUE modules: - `pkg/alpha.dagger.io`: legacy non-europa packages - `pkg/dagger.io`: core Europa packages - `pkg/universe.dagger.io`: Europa universe Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
36
pkg/alpha.dagger.io/alpine/alpine.cue
Normal file
36
pkg/alpha.dagger.io/alpine/alpine.cue
Normal file
@@ -0,0 +1,36 @@
|
||||
// Base package for Alpine Linux
|
||||
package alpine
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
)
|
||||
|
||||
// Default Alpine version
|
||||
let defaultVersion = "3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||
|
||||
// Base image for Alpine Linux
|
||||
#Image: {
|
||||
// List of packages to install
|
||||
package: [string]: true | false | string
|
||||
// Alpine version to install
|
||||
version: string | *defaultVersion
|
||||
|
||||
// Use of os package not possible : alpine is a low level component
|
||||
#up: [
|
||||
op.#FetchContainer & {
|
||||
ref: "index.docker.io/alpine:\(version)"
|
||||
},
|
||||
for pkg, info in package {
|
||||
if (info & true) != _|_ {
|
||||
op.#Exec & {
|
||||
args: ["apk", "add", "-U", "--no-cache", pkg]
|
||||
}
|
||||
}
|
||||
if (info & string) != _|_ {
|
||||
op.#Exec & {
|
||||
args: ["apk", "add", "-U", "--no-cache", "\(pkg)\(info)"]
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
43
pkg/alpha.dagger.io/alpine/tests/alpine.cue
Normal file
43
pkg/alpha.dagger.io/alpine/tests/alpine.cue
Normal file
@@ -0,0 +1,43 @@
|
||||
package alpine
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
)
|
||||
|
||||
TestImageVersion: {
|
||||
image: #Image & {
|
||||
// install an old version on purpose
|
||||
version: "3.10.9"
|
||||
}
|
||||
|
||||
test: #up: [
|
||||
op.#Load & {from: image},
|
||||
op.#Exec & {
|
||||
args: [
|
||||
"sh",
|
||||
"-ec",
|
||||
"""
|
||||
test "$(cat /etc/alpine-release)" = 3.10.9
|
||||
""",
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
TestPackageInstall: {
|
||||
image: #Image & {
|
||||
package: jq: true
|
||||
package: curl: true
|
||||
version: "3.15.0"
|
||||
}
|
||||
|
||||
test: #up: [
|
||||
op.#Load & {from: image},
|
||||
op.#Exec & {
|
||||
args: ["jq", "--version"]
|
||||
},
|
||||
op.#Exec & {
|
||||
args: ["sh", "-ec", "curl --version"]
|
||||
},
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user