Skip to content

Commit b8bb888

Browse files
committed
fix sample files check
1 parent 43e4965 commit b8bb888

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/check-sample-files.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@
33
for dir in ./samples/*/; do
44
# set variable pulumi to true if there is a Pulumi.yaml file in the directory, or there is a directory called pulumi
55
pulumi=false
6-
if [[ -f "${dir}Pulumi.yaml" ]]; then
6+
if find "${dir}" -name 'Pulumi.yaml' -exec true {} +; then
77
pulumi=true
88
elif [[ -d "${dir}pulumi" ]]; then
99
pulumi=true
1010
fi
1111

1212
if [[ ! -f "${dir}compose.yaml" ]]; then
13-
if find "${dir}" -name 'Pulumi.yaml' -exec false {} +; then
13+
if [[ "$pulumi" == "false" ]]; then
14+
# if not pulumi and no compose, tell user to add compose.yaml
1415
echo " - [ ] add compose.yaml to ${dir}"
1516
fi
17+
else
18+
# if there is a compose.yaml file, check if it is valid
19+
(
20+
cd $dir
21+
if ! defang compose config > /dev/null 2>/dev/null; then
22+
echo " - [ ] ${dir}compose.yaml contains errors"
23+
fi
24+
)
1625
fi
1726

1827
# Check that we have a .github/workflows/deploy.yaml file

0 commit comments

Comments
 (0)