Skip to content

Commit 6403bf3

Browse files
authored
Flatten stacks with parent in non-terminating-image checks (#574)
* Add non-terminating parent flatten support Signed-off-by: thepetk <thepetk@gmail.com> * Update workflow Signed-off-by: thepetk <thepetk@gmail.com> * Update script Signed-off-by: thepetk <thepetk@gmail.com> * Update bin name Signed-off-by: thepetk <thepetk@gmail.com> --------- Signed-off-by: thepetk <thepetk@gmail.com>
1 parent 10dd618 commit 6403bf3

File tree

5 files changed

+804
-1
lines changed

5 files changed

+804
-1
lines changed

.github/workflows/validate-stacks.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ jobs:
8181
run: echo "TEST_DELTA=true" >> $GITHUB_ENV
8282

8383
- name: Check that containers components are non terminating
84-
run: bash tests/check_non_terminating.sh
84+
run: |
85+
go build -C tests/check_non_terminating -o flatten-parent
86+
bash tests/check_non_terminating.sh
8587
8688
odov2:
8789
name: with odo v2

tests/check_non_terminating.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ DEVFILES_DIR="$(pwd)/stacks"
77
# The stacks to test as a string separated by spaces
88
STACKS=$(bash "$(pwd)/tests/get_stacks.sh")
99

10+
# Path to the check_non_terminating go package
11+
BIN_NAME=${BIN_NAME:-"flatten-parent"}
12+
NON_TERMINATING_MODULE_BIN="$(pwd)/tests/check_non_terminating/$BIN_NAME"
13+
1014
replaceVariables() {
1115
image=$1
1216
VAR_KEYS=(liberty-version)
@@ -136,6 +140,12 @@ fi
136140
for stack in $STACKS; do
137141
devfile_path="$DEVFILES_DIR/$stack/devfile.yaml"
138142

143+
# if devfile in path has a parent flatten it
144+
if $YQ_PATH eval 'has("parent")' "$devfile_path" -r | grep -q "true"; then
145+
echo "INFO:: Found parent for $devfile_path"
146+
"$NON_TERMINATING_MODULE_BIN" "$devfile_path"
147+
fi
148+
139149
if [ ! -f "$devfile_path" ]; then
140150
echo "WARN: Devfile not found at path $devfile_path"
141151
continue

tests/check_non_terminating/go.mod

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
module github.com/devfile/registry/tests/check_non_terminating
2+
3+
go 1.21
4+
5+
require github.com/devfile/library/v2 v2.3.0
6+
7+
require (
8+
dario.cat/mergo v1.0.0 // indirect
9+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
10+
github.com/Microsoft/go-winio v0.6.1 // indirect
11+
github.com/Microsoft/hcsshim v0.11.4 // indirect
12+
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
13+
github.com/beorn7/perks v1.0.1 // indirect
14+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
15+
github.com/cloudflare/circl v1.3.7 // indirect
16+
github.com/containerd/containerd v1.7.13 // indirect
17+
github.com/containerd/log v0.1.0 // indirect
18+
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
19+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
20+
github.com/devfile/api/v2 v2.3.0 // indirect
21+
github.com/devfile/registry-support/index/generator v0.0.0-20240419194226-cca4c9a81f8d // indirect
22+
github.com/devfile/registry-support/registry-library v0.0.0-20240521161747-89fc566cb024 // indirect
23+
github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 // indirect
24+
github.com/distribution/reference v0.5.0 // indirect
25+
github.com/docker/cli v25.0.1+incompatible // indirect
26+
github.com/docker/distribution v2.8.3+incompatible // indirect
27+
github.com/docker/docker v25.0.6+incompatible // indirect
28+
github.com/docker/docker-credential-helpers v0.7.0 // indirect
29+
github.com/docker/go-connections v0.5.0 // indirect
30+
github.com/docker/go-metrics v0.0.1 // indirect
31+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
32+
github.com/emirpasic/gods v1.18.1 // indirect
33+
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
34+
github.com/fatih/color v1.14.1 // indirect
35+
github.com/felixge/httpsnoop v1.0.4 // indirect
36+
github.com/fsnotify/fsnotify v1.7.0 // indirect
37+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
38+
github.com/go-git/go-billy/v5 v5.5.0 // indirect
39+
github.com/go-git/go-git/v5 v5.11.0 // indirect
40+
github.com/go-logr/logr v1.4.1 // indirect
41+
github.com/go-logr/stdr v1.2.2 // indirect
42+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
43+
github.com/go-openapi/jsonreference v0.20.2 // indirect
44+
github.com/go-openapi/swag v0.22.3 // indirect
45+
github.com/gobwas/glob v0.2.3 // indirect
46+
github.com/gogo/protobuf v1.3.2 // indirect
47+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
48+
github.com/golang/mock v1.6.0 // indirect
49+
github.com/golang/protobuf v1.5.4 // indirect
50+
github.com/google/btree v1.0.1 // indirect
51+
github.com/google/gnostic-models v0.6.8 // indirect
52+
github.com/google/gofuzz v1.2.0 // indirect
53+
github.com/google/uuid v1.6.0 // indirect
54+
github.com/gorilla/mux v1.8.0 // indirect
55+
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
56+
github.com/hashicorp/errwrap v1.1.0 // indirect
57+
github.com/hashicorp/go-multierror v1.1.1 // indirect
58+
github.com/hashicorp/go-version v1.4.0 // indirect
59+
github.com/imdario/mergo v0.3.12 // indirect
60+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
61+
github.com/josharian/intern v1.0.0 // indirect
62+
github.com/json-iterator/go v1.1.12 // indirect
63+
github.com/kevinburke/ssh_config v1.2.0 // indirect
64+
github.com/klauspost/compress v1.17.7 // indirect
65+
github.com/mailru/easyjson v0.7.7 // indirect
66+
github.com/mattn/go-colorable v0.1.13 // indirect
67+
github.com/mattn/go-isatty v0.0.17 // indirect
68+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
69+
github.com/mitchellh/reflectwalk v1.0.1 // indirect
70+
github.com/moby/locker v1.0.1 // indirect
71+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
72+
github.com/modern-go/reflect2 v1.0.2 // indirect
73+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
74+
github.com/opencontainers/go-digest v1.0.0 // indirect
75+
github.com/opencontainers/image-spec v1.1.0 // indirect
76+
github.com/openshift/api v0.0.0-20200930075302-db52bc4ef99f // indirect
77+
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
78+
github.com/pjbgf/sha1cd v0.3.0 // indirect
79+
github.com/pkg/errors v0.9.1 // indirect
80+
github.com/prometheus/client_golang v1.16.0 // indirect
81+
github.com/prometheus/client_model v0.4.0 // indirect
82+
github.com/prometheus/common v0.44.0 // indirect
83+
github.com/prometheus/procfs v0.10.1 // indirect
84+
github.com/sergi/go-diff v1.1.0 // indirect
85+
github.com/sirupsen/logrus v1.9.3 // indirect
86+
github.com/skeema/knownhosts v1.2.1 // indirect
87+
github.com/spf13/afero v1.11.0 // indirect
88+
github.com/spf13/pflag v1.0.5 // indirect
89+
github.com/xanzy/ssh-agent v0.3.3 // indirect
90+
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
91+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
92+
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
93+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
94+
go.opentelemetry.io/otel v1.24.0 // indirect
95+
go.opentelemetry.io/otel/metric v1.24.0 // indirect
96+
go.opentelemetry.io/otel/trace v1.24.0 // indirect
97+
golang.org/x/crypto v0.21.0 // indirect
98+
golang.org/x/mod v0.16.0 // indirect
99+
golang.org/x/net v0.22.0 // indirect
100+
golang.org/x/oauth2 v0.16.0 // indirect
101+
golang.org/x/sync v0.6.0 // indirect
102+
golang.org/x/sys v0.18.0 // indirect
103+
golang.org/x/term v0.18.0 // indirect
104+
golang.org/x/text v0.14.0 // indirect
105+
golang.org/x/time v0.5.0 // indirect
106+
golang.org/x/tools v0.19.0 // indirect
107+
google.golang.org/appengine v1.6.8 // indirect
108+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 // indirect
109+
google.golang.org/grpc v1.62.1 // indirect
110+
google.golang.org/protobuf v1.33.0 // indirect
111+
gopkg.in/inf.v0 v0.9.1 // indirect
112+
gopkg.in/warnings.v0 v0.1.2 // indirect
113+
gopkg.in/yaml.v2 v2.4.0 // indirect
114+
gopkg.in/yaml.v3 v3.0.1 // indirect
115+
k8s.io/api v0.29.2 // indirect
116+
k8s.io/apiextensions-apiserver v0.29.2 // indirect
117+
k8s.io/apimachinery v0.29.2 // indirect
118+
k8s.io/client-go v0.29.2 // indirect
119+
k8s.io/klog v1.0.0 // indirect
120+
k8s.io/klog/v2 v2.110.1 // indirect
121+
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
122+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
123+
oras.land/oras-go v1.2.5 // indirect
124+
sigs.k8s.io/controller-runtime v0.14.7 // indirect
125+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
126+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
127+
sigs.k8s.io/yaml v1.3.0 // indirect
128+
)

0 commit comments

Comments
 (0)