-
Notifications
You must be signed in to change notification settings - Fork 4
/
dagger.cue
136 lines (130 loc) · 3.79 KB
/
dagger.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
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/bash"
"universe.dagger.io/docker"
)
dagger.#Plan & {
client: {
filesystem: {
".": {
read: {
contents: dagger.#FS
exclude: [
".github",
"cue.mod",
"dagger.cue",
"LICENSE",
"README.md",
"renovate.json",
]
}
}
"./": write: contents: actions.fix.output
}
}
actions: {
_bin: core.#Source & {
path: "./bin"
}
_build_lint: docker.#Build & {
steps: [
docker.#Pull & {
source: "debian:stable-slim"
},
bash.#Run & {
script: {
directory: _bin.output
filename: "setup-ci"
}
},
docker.#Copy & {
dest: "/io"
contents: client.filesystem.".".read.contents
},
]
}
_lint_image: _build_lint.output
_build_shellcheck: docker.#Build & {
steps: [
docker.#Pull & {
source: "koalaman/shellcheck-alpine"
},
docker.#Copy & {
dest: "/mnt"
contents: client.filesystem.".".read.contents
},
]
}
_shellcheck_image: _build_shellcheck.output
// Run linting suite
lint: {
terraform_fmt: docker.#Run & {
input: _lint_image
workdir: "/io"
entrypoint: ["terraform"]
command: {
name: "fmt"
args: ["--check", "--recursive"]
}
}
helm_lint: bash.#Run & {
input: _lint_image
script: {
directory: _bin.output
filename: "helm-lint"
}
}
shellcheck: docker.#Run & {
input: _shellcheck_image
workdir: "/mnt"
entrypoint: ["/bin/sh"]
command: {
name: "-c"
args: ["/bin/shellcheck bin/*"]
}
}
shfmt: bash.#Run & {
input: _lint_image
workdir: "/io"
script: {
contents: "/root/.go/bin/shfmt -f . | xargs /root/.go/bin/shfmt -s -d"
}
}
}
// Auto-resolve test and lint issues
fix: {
helm_lint: bash.#Run & {
input: terraform_fmt.output
script: {
directory: _bin.output
filename: "helm-lint"
}
}
terraform_fmt: docker.#Run & {
input: _lint_image
workdir: "/io"
export: directories: {
"/io": _
}
entrypoint: ["terraform"]
command: {
name: "fmt"
args: ["--recursive"]
}
}
shfmt: bash.#Run & {
input: terraform_fmt.output
workdir: "/io"
export: directories: {
"/io": _
}
script: {
contents: "/root/.go/bin/shfmt -f . | xargs /root/.go/bin/shfmt -s -w"
}
}
output: shfmt.export.directories."/io"
}
}
}