-
Notifications
You must be signed in to change notification settings - Fork 1
/
eden.cue
142 lines (136 loc) · 2.58 KB
/
eden.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
140
141
142
package todoapp
import (
"dagger.io/dagger"
"universe.dagger.io/bash"
"universe.dagger.io/docker"
)
dagger.#Plan & {
client: {
filesystem: {
"./": read: {
contents: dagger.#FS
exclude: [
"README.md",
"eden.cue",
]
}
}
env: {
SONAR_LOGIN: dagger.#Secret
GITHUB_HEAD_REF: GITHUB_HEAD_REF
}
}
actions: {
deps: {
node:
docker.#Build & {
steps: [
docker.#Pull & {
source: "index.docker.io/node"
},
docker.#Copy & {
contents: client.filesystem."./".read.contents
dest: "./src"
},
]
}
gitleaks:
docker.#Build & {
steps: [
docker.#Pull & {
source: "index.docker.io/zricethezav/gitleaks"
},
docker.#Copy & {
contents: client.filesystem."./".read.contents
dest: "./src"
},
]
}
sonarscanner:
docker.#Build & {
steps: [
docker.#Pull & {
source: "index.docker.io/sonarsource/sonar-scanner-cli"
},
docker.#Copy & {
contents: client.filesystem."./".read.contents
dest: "/usr/src"
},
]
}
}
build: {
bash.#Run & {
workdir: "./src"
input: deps.node.output
script: contents: #"""
npm ci
"""#
}
}
staticAnalysis: {
lint:
bash.#Run & {
workdir: "./src"
input: build.output
script: contents: #"""
npx eslint --color .
"""#
}
sonarscanner:
docker.#Run & {
env: {
GITHUB_BRANCH_NAME: client.env.GITHUB_HEAD_REF
SONAR_LOGIN: client.env.SONAR_LOGIN
SONAR_HOST_URL: "https://sonarcloud.io"
}
workdir: "/usr/src"
input: deps.sonarscanner.output
}
}
test: {
integrationTest: {
workdir: "./src"
docker.#Run & {
input: build.output
command: {
name: "/bin/bash"
args: ["-c", "npm run test:ci"]
}
}
}
unitTest: {
workdir: "./src"
docker.#Run & {
input: build.output
command: {
name: "/bin/bash"
args: ["-c", "npm run test:unit"]
}
}
}
}
SCA: {
// Currently failing due to https://github.blog/2022-04-12-git-security-vulnerability-announced/ , the gitleaks container needs to be fixed
// secretDetection: {
// docker.#Run & {
// workdir: "./src"
// input: deps.gitleaks.output
// command: {
// name: "detect"
// }
// }
// }
dependencyScanning: {
docker.#Run & {
workdir: "./src"
input: build.output
command: {
name: "/bin/bash"
args: ["-c", "npx audit-ci --high"]
}
}
}
}
}
}