我在本地计算机上运行Jenkins docker和气流。旨在使用JenkinsJobTriggerOperator触发已经创建的Jenkins作业的气流任务失败,并显示“无屑”错误。 JenkinsJobTriggerOperator似乎正试图隐式获取面包屑并失败。
能够通过提供碎屑从本地触发上述工作。我检查了气流工作人员容器和Jenkins容器之间的连通性。我还通过打击气流工作人员而成功触发了这项工作。通过气流API调整了Jenkins连接配置。没有运气。
job_trigger_task = JenkinsJobTriggerOperator(
start_date=days_ago(1),
task_id="job_trigger_task",
job_name="my_jenkins_job",
parameters={'token':'xxxxxxxx',
'param_a':145754,
'param_b':'abc',
'param_c':'a12423'},
# Preconfigered connection
jenkins_connection_id="local_jenkins"
)
下面的气流日志:
{jenkins_job_trigger_operator.py:210} INFO - Triggering the job my_jenkins_job on the jenkins : local_jenkins with the parameters : {'param_a':145754, 'param_b':'abc','param_c':'a12423'}
{logging_mixin.py:95} INFO - {base_hook.py:83} INFO - Using connection to: id: local_jenkins. Host: jenkins_webserver, Port: 8080, Schema: None, Login: "myjenkinsuser", Password: XXXXXXXX, extra: {}
{jenkins_hook.py:44} INFO - Trying to connect to http://jenkins_webserver:8080
{models.py:1788} ERROR - Error in request. Possibly authentication failed [403]: No valid crumb was included in the request
注意::jenkins_webserver是Jenkins容器名称
我在配置连接时尝试了host_name的多个变体,例如:
主机:local_ip 主机:localhost 主持人:jenkins_container_name 主机:Jenkins容器的IP地址
在我的Jenkins部署中启用了CSRF保护。禁用它也不起作用。