File tree 2 files changed +31
-6
lines changed
2 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,41 @@ DIRS="testpmd-container-app trex-container-app cnf-app-mac-operator testpmd-lb-o
14
14
15
15
FILES=" $( git diff --name-only -r origin/${GITHUB_BASE_REF:- main} :) "
16
16
17
+ TESTPMD_APP=false
18
+ TREX_APP=false
19
+
17
20
echo " declare -A VERSIONS" > " $VERSIONS "
18
21
19
22
count=0
20
23
for d in $DIRS ; do
21
24
vers=" $( cd " $d " || exit 1; make -s version) "
25
+ # Force to build the operators if the corresponding app is built
26
+ force=false
27
+ case " $d " in
28
+ testpmd-lb-operator|testpmd-operator)
29
+ if [ " $TESTPMD_APP " == true ]; then
30
+ force=true
31
+ fi
32
+ ;;
33
+ trex-operator)
34
+ if [ " $TREX_APP " == true ]; then
35
+ force=true
36
+ fi
37
+ ;;
38
+ esac
22
39
# Force nfv-example-cnf-index to be displayed if at least one
23
40
# change to the subdirs has been detected. This will force the
24
- # index to be generated. TODO: force the operators to be rebuilt
25
- # if there is a change in the apps.
26
- if [ " $FORCE_BUILD " == true ] || grep -q " $d /" <<< " $FILES" || { [ " $d " == nfv-example-cnf-index ] && [ " $count " -gt 0 ]; }; then
41
+ # index to be generated.
42
+ if [ " $force " == true ] || [ " $FORCE_BUILD " == true ] || grep -q " $d /" <<< " $FILES" || { [ " $d " == nfv-example-cnf-index ] && [ " $count " -gt 0 ]; }; then
27
43
echo " VERSIONS[$d ]=$vers -$EXTRA " >> " $VERSIONS "
28
44
echo " $d "
29
45
count=$(( count + 1 ))
46
+ if [ " $d " == testpmd-container-app ]; then
47
+ TESTPMD_APP=true
48
+ fi
49
+ if [ " $d " == trex-container-app ]; then
50
+ TREX_APP=true
51
+ fi
30
52
else
31
53
echo " VERSIONS[$d ]=$vers " >> " $VERSIONS "
32
54
fi
Original file line number Diff line number Diff line change 30
30
# Build the index image
31
31
index-build : opm
32
32
@{ \
33
- set -ex ; \
33
+ set -e ; \
34
34
mkdir -p $(BUILD_PATH ) /$(INDEX_NAME ) ; \
35
35
rm -f $(BUILD_PATH ) /$(INDEX_NAME ) /index.yml ; \
36
36
cp " $( INDEX_NAME) .Dockerfile" $(BUILD_PATH ) / ; \
@@ -46,9 +46,12 @@ index-build: opm
46
46
bundle_digest=$(REGISTRY ) /$(ORG ) /$$ {operator_bundle}@$$ {operator_digest} ; \
47
47
echo " operator=$$ {operator_name} operator_version=$$ {operator_version} operator_digest=$$ {operator_digest}" ; \
48
48
default_channel=$$(jq -r '.Labels."operators.operatorframework.io.bundle.channel.default.v1"' <<< $${operator_manifest} ) ; \
49
- channel=" ---\nschema: olm.channel\npackage: $$ {operator_name}\nname: $$ {default_channel}\nentries:\n - name: $$ {operator_name}.$$ {operator_version}" ; \
50
49
$(OPM ) init $$ {operator_name} --default-channel=$$ {default_channel} --output=yaml >> $(BUILD_PATH ) /$(INDEX_NAME ) /index.yml ; \
51
- $(OPM ) render $$ {bundle_digest} --output=yaml >> $(BUILD_PATH ) /$(INDEX_NAME ) /index.yml ; \
50
+ rendered=$$($(OPM ) render $${bundle_digest} --output=yaml) ; \
51
+ echo " $$ {rendered}" >> $(BUILD_PATH ) /$(INDEX_NAME ) /index.yml ; \
52
+ operator_name_version=$$(sed -n -e 's/^name: //p'<<< "$$rendered" ) ; \
53
+ echo " $$ {operator_name_version}" ; \
54
+ channel=" ---\nschema: olm.channel\npackage: $$ {operator_name}\nname: $$ {default_channel}\nentries:\n - name: $$ {operator_name_version}" ; \
52
55
echo -e $$ {channel} >> $(BUILD_PATH ) /$(INDEX_NAME ) /index.yml ; \
53
56
done ; \
54
57
echo " validating the catalog" ; \
You can’t perform that action at this time.
0 commit comments