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 2022/03/21 13:17:10 UTC
[GitHub] [airflow] stephenoken opened a new issue #22398: CloudBuildRunBuildTriggerOPerator: 'property' object has no attribute 'build'
stephenoken opened a new issue #22398:
URL: https://github.com/apache/airflow/issues/22398
### Apache Airflow Provider(s)
google
### Versions of Apache Airflow Providers
apache-airflow-providers-google==6.6.0
### Apache Airflow version
2.2.4 (latest released)
### Operating System
GCP Cloud Composer 2
### Deployment
Composer
### Deployment details
We're currently using the default set up of cloud composer 2 on GCP.
### What happened
When trying to trigger cloud build trigger using the `CloudBuildRunBuildTriggerOperator` We receive the following error:
```
[2022-03-21, 12:28:57 UTC] {credentials_provider.py:312} INFO - Getting connection using `google.auth.default()` since no key file is defined for hook.
[2022-03-21, 12:28:58 UTC] {cloud_build.py:503} INFO - Start running build trigger: <TRIGGER ID>.
[2022-03-21, 12:29:00 UTC] {taskinstance.py:1702} ERROR - Task failed with exception
Traceback (most recent call last):
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/cloud/hooks/cloud_build.py", line 75, in _get_build_id_from_operation
return operation.metadata.build.id
AttributeError: 'property' object has no attribute 'build'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/python3.8/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1330, in _run_raw_task
self._execute_task_with_callbacks(context)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1457, in _execute_task_with_callbacks
result = self._execute_task(context, self.task)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1513, in _execute_task
result = execute_callable(context=context)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/cloud/operators/cloud_build.py", line 739, in execute
result = hook.run_build_trigger(
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/common/hooks/base_google.py", line 433, in inner_wrapper
return func(self, *args, **kwargs)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/cloud/hooks/cloud_build.py", line 512, in run_build_trigger
id_ = self._get_build_id_from_operation(Operation)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/cloud/hooks/cloud_build.py", line 77, in _get_build_id_from_operation
raise AirflowException("Could not retrieve Build ID from Operation.")
airflow.exceptions.AirflowException: Could not retrieve Build ID from Operation.
[2022-03-21, 12:29:00 UTC] {taskinstance.py:1268} INFO - Marking task as FAILED. dag_id=deploy_index, task_id=trigger_build, execution_date=20220321T122848, start_date=20220321T122856, end_date=20220321T122900
[2022-03-21, 12:29:00 UTC] {standard_task_runner.py:89} ERROR - Failed to execute job 1003 for task trigger_build
Traceback (most recent call last):
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/cloud/hooks/cloud_build.py", line 75, in _get_build_id_from_operation
return operation.metadata.build.id
AttributeError: 'property' object has no attribute 'build'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/python3.8/lib/python3.8/site-packages/airflow/task/task_runner/standard_task_runner.py", line 85, in _start_by_fork
args.func(args, dag=self.dag)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/cli/cli_parser.py", line 48, in command
return func(*args, **kwargs)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/utils/cli.py", line 94, in wrapper
return f(*args, **kwargs)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/cli/commands/task_command.py", line 302, in task_run
_run_task_by_selected_method(args, dag, ti)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/cli/commands/task_command.py", line 107, in _run_task_by_selected_method
_run_raw_task(args, ti)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/cli/commands/task_command.py", line 180, in _run_raw_task
ti._run_raw_task(
File "/opt/python3.8/lib/python3.8/site-packages/airflow/utils/session.py", line 70, in wrapper
return func(*args, session=session, **kwargs)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1330, in _run_raw_task
self._execute_task_with_callbacks(context)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1457, in _execute_task_with_callbacks
result = self._execute_task(context, self.task)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1513, in _execute_task
result = execute_callable(context=context)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/cloud/operators/cloud_build.py", line 739, in execute
result = hook.run_build_trigger(
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/common/hooks/base_google.py", line 433, in inner_wrapper
return func(self, *args, **kwargs)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/cloud/hooks/cloud_build.py", line 512, in run_build_trigger
id_ = self._get_build_id_from_operation(Operation)
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/cloud/hooks/cloud_build.py", line 77, in _get_build_id_from_operation
raise AirflowException("Could not retrieve Build ID from Operation.")
airflow.exceptions.AirflowException: Could not retrieve Build ID from Operation.
[2022-03-21, 12:29:00 UTC] {local_task_job.py:154} INFO - Task exited with return code 1
[2022-03-21, 12:29:01 UTC] {local_task_job.py:264} INFO - 0 downstream tasks scheduled from follow-on schedule check
```
Below is the code snippet that's causing the above error.
```
trigger_deploy = CloudBuildRunBuildTriggerOperator(
task_id="trigger_deploy",
trigger_id="TRIGGER_ID",
project_id="PROEJCT_ID",
source=RepoSource({"project_id": "PROJECT_ID",
"repo_name": "REPO_NAME",
"branch_name": "BRANCH",
}),
wait=True,
do_xcom_push=True
)
```
### What you think should happen instead
_No response_
### How to reproduce
_No response_
### Anything else
We reckon the source of the bug is [here](https://github.com/apache/airflow/blob/71c980a8ffb3563bf16d8a23a58de54c9e8cf556/airflow/providers/google/cloud/hooks/cloud_build.py#L165).
``` python
id_ = self._get_build_id_from_operation(Operation)
```
Since the function signature is looking for an instance of Operation instead of the class itself.
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal commented on issue #22398: CloudBuildRunBuildTriggerOPerator: 'property' object has no attribute 'build'
Posted by GitBox <gi...@apache.org>.
eladkal commented on issue #22398:
URL: https://github.com/apache/airflow/issues/22398#issuecomment-1073951480
feel free to submit a PR
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] eladkal closed issue #22398: CloudBuildRunBuildTriggerOPerator: 'property' object has no attribute 'build'
Posted by GitBox <gi...@apache.org>.
eladkal closed issue #22398:
URL: https://github.com/apache/airflow/issues/22398
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on issue #22398: CloudBuildRunBuildTriggerOPerator: 'property' object has no attribute 'build'
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #22398:
URL: https://github.com/apache/airflow/issues/22398#issuecomment-1073885186
Thanks for opening your first issue here! Be sure to follow the issue template!
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org