46
46
- name : Run unit tests
47
47
run : mvn -B test -q --file tomcat/pom.xml
48
48
49
+ - name : Get webapps
50
+ if : ${{ failure() }}
51
+ run : |
52
+ kubectl get tomcats,webapps -A -o yaml | tee -a debug
53
+ kubectl logs
54
+
49
55
tomcat_local_apply_setup_test :
50
56
runs-on : ubuntu-latest
51
57
steps :
@@ -63,20 +69,22 @@ jobs:
63
69
mkdir -p /etc/docker
64
70
echo -n "{\"exec-opts\": [\"native.cgroupdriver=systemd\"],\"log-driver\": \"json-file\",\"log-opts\": {\"max-size\": \"100m\"},\"storage-driver\": \"overlay2\"}" > /etc/docker/daemon.json
65
71
cat /etc/docker/daemon.json
66
- sudo service docker status
72
+ # sudo service docker status
67
10000
73
68
74
- name : Create Kubernetes KinD Cluster
69
75
uses : container-tools/kind-action@v1.5.0
76
+ if : ${{ !env.ACT }}
70
77
with :
71
78
cluster_name : tomcat-local-apply
72
79
registry : true
73
80
74
- # - name: Create kind cluster
75
- # uses: helm/kind-action@v1.2.0
76
- # with:
77
- # cluster_name: tomcat-local-apply #${{ job.name }}
78
- # registry: true
79
- # # docker stop tomcat-local-apply-control-plane ; docker rm tomcat-local-apply-control-plane ; sleep 1
81
+ - name : Create kind cluster without registry
82
+ uses : helm/kind-action@v1.2.0
83
+ if : ${{ env.ACT }}
84
+ with :
85
+ cluster_name : tomcat-local-apply # ${{ job.name }}
86
+ registry : false
87
+ # for DIMG in "tomcat-local-apply-control-plane kind-registry tomcat_local_apply_setup_test "; do docker stop $DIMG ; docker rm $DIMG ; done ; sleep 1
80
88
81
89
- name : Set up Java and Maven
82
90
uses : actions/setup-java@v2
@@ -99,11 +107,6 @@ jobs:
99
107
if : ${{ env.ACT }}
100
108
with :
101
109
maven-version : 3.8.1
102
-
103
- - name : check that kube is empty
104
- if : ${{ env.ACT }}
105
- run : kubectl get tomcats,webapps,po
106
-
107
110
108
111
- name : test local registry
109
112
if : ${{ env.ACT }}
@@ -114,28 +117,50 @@ jobs:
114
117
fi
115
118
116
119
- name : build jib
120
+ if : ${{ !env.ACT }}
117
121
run : |
118
122
mvn -B install jib:dockerBuild jib:build -Djib.allowInsecureRegistries=true \
119
123
-Djib.to.image=$KIND_REGISTRY/io.javaoperatorsdk/sample:1.7.1-SNAPSHOT \
120
124
--file tomcat/pom.xml -DskipTests
121
125
126
+ - name : build jib
127
+ if : ${{ env.ACT }}
128
+ run : |
129
+ mvn -B install jib:dockerBuild \
130
+ -Djib.to.image=sample:1.7.1-SNAPSHOT --file tomcat/pom.xml -DskipTests
131
+ kind load docker-image sample:1.7.1-SNAPSHOT --name=tomcat-local-apply
132
+
122
133
- name : Apply CRDs
123
134
run : kubectl apply -f tomcat/k8s/crd.yaml
124
135
125
136
- name : install tomcat operator
126
- run : kubectl apply -f tomcat/k8s/operator.yaml
137
+ if : ${{ !env.ACT }}
138
+ run : |
139
+ sed 's@image\: tomcat-operator@image\: kind-registry\:5000/io.javaoperatorsdk/sample\:1.7.1-SNAPSHOT@g' tomcat/k8s/operator.yaml > tomcat/target/operator.yaml
140
+ kubectl apply -f tomcat/target/operator.yaml
141
+
142
+ - name : install tomcat operator
143
+ if : ${{ env.ACT }}
144
+ run : |
145
+ sed 's@image\: tomcat-operator@image\: sample\:1.7.1-SNAPSHOT@g' tomcat/k8s/operator.yaml > tomcat/target/operator.yaml
146
+ kubectl apply -f tomcat/target/operator.yaml
127
147
128
148
- name : create ns tomcatoperator-sample
129
149
run : kubectl create ns tomcatoperator-sample
130
150
151
+ - name : debug local kind
152
+ if : ${{ env.ACT }}
153
+ run : |
154
+ kubectl get pods -n tomcat-operator -l app=tomcat-operator -o yaml | tee -a debug.log
155
+
131
156
- name : wait for operators ready
132
157
run : |
133
158
LOOP=0 &&\
134
159
while [[ $(kubectl get pods -n tomcat-operator -l app=tomcat-operator -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do \
135
160
echo "waiting for pod" &&\
136
161
kubectl logs -n tomcat-operator -l app=tomcat-operator &&\
137
162
(( LOOP++ )) &&\
138
- if [[ $LOOP -gt 10 ]]; then break ; fi &&\
163
+ if [[ $LOOP -gt 10 ]]; then exit 1 ; fi &&\
139
164
echo "loop number $LOOP" &&\
140
165
sleep 5; \
141
166
done
@@ -146,7 +171,6 @@ jobs:
146
171
kubectl -n tomcatoperator-sample apply -f $sample;
147
172
done
148
173
149
-
150
174
- name : check pod correctly started
151
175
run : |
152
176
LOOP=0 &&\
@@ -158,4 +182,5 @@ jobs:
158
182
echo "loop number $LOOP" &&\
159
183
sleep 5; \
160
184
done
161
-
185
+
186
+
0 commit comments