Fix race condition for plugin uploads 16/112716/1 3.3.1
authorJack Lucas <jflos@sonoris.net>
Tue, 15 Sep 2020 15:47:42 +0000 (11:47 -0400)
committerJack Lucas <jflos@sonoris.net>
Tue, 15 Sep 2020 18:53:54 +0000 (14:53 -0400)
Issue-ID: DCAEGEN2-2430
Signed-off-by: Jack Lucas <jflos@sonoris.net>
Change-Id: Id8809d7773d8e18d7106186a5772cb2709225fbb

cm-container/pom.xml
cm-container/scripts/load-plugins.sh

index 3adc2bf..ee28287 100644 (file)
@@ -27,7 +27,7 @@ limitations under the License.
   <groupId>org.onap.dcaegen2.deployments</groupId>
   <artifactId>cm-container</artifactId>
   <name>dcaegen2-deployments-cm-container</name>
-  <version>3.3.0</version>
+  <version>3.3.1</version>
   <url>http://maven.apache.org</url>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
index 5a342dd..c93f3d9 100755 (executable)
@@ -99,6 +99,22 @@ then
     install_plugin ${wagons[0]} ${types[0]}
   done
 
+  # The cfy plugin upload commands issued above will return
+  # before all of the processing is complete.  The processing
+  # occurs in what Cloudify calls "system workflows", and if a
+  # system workflow is pending or running, other operations such
+  # as uploading a blueprint will fail.  So we wait for any
+  # system workflows to finish before we create the PLUGINS_LOADED
+  # file and exit the script.   That way, the bootstrap container
+  # (which waits for k8s to declare the CM container to be ready)
+  # will not try to upload blueprints while a system execution is
+  # underway.  (See Jira DCAEGEN2-2430.)
+  while cm_hasany "executions?is_system_workflow=true&status=pending&status=started&status=queued&status=scheduled"
+  do
+    echo "Waiting for running system workflows to complete"
+    sleep 15
+  done
+
   touch ${PLUGINS_LOADED}
 else
   echo "Plugins already loaded"