You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/11 03:15:19 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #8808: Support YAML input for CloudBuildCreateOperator

mik-laj commented on a change in pull request #8808:
URL: https://github.com/apache/airflow/pull/8808#discussion_r422757102



##########
File path: airflow/providers/google/cloud/operators/cloud_build.py
##########
@@ -83,13 +85,29 @@ def _reformat_storage_source(self):
 
         self.body["source"]["storageSource"] = self._convert_storage_url_to_dict(source)
 
+    def _load_body_to_dict(self):
+        """
+        :param file:
+            file path to YAML build config
+        :return: dict
+        """
+        try:
+            with open(self.body, 'r') as f:

Review comment:
       I think, we should use [template_ext](https://airflow.readthedocs.io/en/latest/_api/airflow/models/baseoperator/index.html?highlight=BaseOperator#airflow.models.baseoperator.BaseOperator.template_ext) to load file. This will cause us to still have text instead of the dictionary, so we need to overwrite the [prepare_template method](https://airflow.readthedocs.io/en/latest/_api/airflow/models/baseoperator/index.html?highlight=BaseOperator#airflow.models.baseoperator.BaseOperator.prepare_template) to convert the string to a dictionary




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org