-
Notifications
You must be signed in to change notification settings - Fork 0
/
piper.cue
139 lines (119 loc) · 2.51 KB
/
piper.cue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package main
import (
"piper.octohelm.tech/wd"
"piper.octohelm.tech/file"
"piper.octohelm.tech/client"
"piper.octohelm.tech/container"
"piper.octohelm.tech/kubepkg"
"github.com/octohelm/piper/cuepkg/github"
"github.com/octohelm/piper/cuepkg/golang"
"github.com/octohelm/piper/cuepkg/debian"
"github.com/octohelm/piper/cuepkg/distroless"
"github.com/octohelm/piper/cuepkg/containerutil"
"github.com/octohelm/piper/testdata/cuepkg/example"
)
hosts: local: wd.#Local & {}
ver: client.#RevInfo & {}
actions: go: X=golang.#Project & {
cwd: hosts.local.dir
main: "./cmd/piper"
version: ver.version
goos: [
"darwin",
"linux",
]
goarch: [
"amd64",
"arm64",
]
ldflags: [
"-s", "-w",
"-X", "\(X.module)/internal/version.version=\(X.version)",
]
}
actions: release: {
_env: client.#Env & {
GH_PASSWORD!: client.#Secret
}
github.#Release & {
owner: "octohelm"
repo: "piper"
token: _env.GH_PASSWORD
prerelease: true
assets: [
for f in actions.go.archive {
f.file
},
]
}
}
actions: ship: "distroless": distroless.#Ship & {
name: "ghcr.io/octohelm/distroless"
tag: "static-debian-12"
}
actions: ship: piper: containerutil.#Ship & {
name: "ghcr.io/octohelm/piper"
tag: "\(ver.version)"
from: "docker.io/library/debian:bookworm-slim"
steps: [
debian.#InstallPackage & {
packages: {
git: _
make: _
file: _
}
},
{
input: _
_bin: container.#SourceFile & {
file: actions.go.build[input.platform].file
}
_copy: container.#Copy & {
"input": input
contents: _bin.output
source: "/"
include: ["piper"]
dest: "/usr/local/bin"
}
output: _copy.output
},
container.#Set & {
config: {
label: "org.opencontainers.image.source": "https://github.com/octohelm/piper"
entrypoint: ["/bin/sh"]
}
},
]
}
settings: {
_env: client.#Env & {
GH_USERNAME!: string
GH_PASSWORD!: client.#Secret
}
registry: container.#Config & {
auths: "ghcr.io": {
username: _env.GH_USERNAME
secret: _env.GH_PASSWORD
}
}
}
actions: pkg: {
manifests: kubepkg.#Manifests & {
"kubepkg": example.#Example & {}
}
yaml: file.#WriteAsYAML & {
data: manifests.manifests
outFile: {
wd: hosts.local.dir
filename: "target/\(manifests.kubepkg.metadata.name).kubepkg.yaml"
}
}
ocitar: kubepkg.#OciTar & {
"kubepkg": manifests.kubepkg
"rename": "docker.io/x/{{ .name }}"
"outFile": {
wd: hosts.local.dir
filename: "target/\(manifests.kubepkg.metadata.name).kubepkg.tar"
}
}
}