我试图通过github-webhook触发jenkins管道。我已在github存储库中将from tkinter import *
from tkinter import messagebox as ms
from PIL import Image, ImageTk
import os
import time
import pymysql
root = Tk()
root.title('Sistema de Senhas')
root.configure(background='white')
class main:
def __init__(self,master):
self.master = master
self.username = StringVar()
self.password = StringVar()
self.logf = Frame(self.master,padx =10,pady = 10, bg='white')
Label(self.logf,text = 'Utilizador: ',font = ('Corbel bold',13), bg= 'white',pady=5,padx=5).grid(sticky = W)
Entry(self.logf,textvariable = self.username,bd = 2,font = ('Corbel bold',11)).grid(row=0,column=1)
Label(self.logf,text = 'Palavra-passe: ',font = ('Corbel bold',13), bg= 'white',pady=5,padx=5).grid(sticky = W)
Entry(self.logf,textvariable = self.password,bd = 2,font = ('Corbel bold',11),show = '*').grid(row=1,column=1)
self.logf.pack()
self.button = Button(self.master,text = 'Entrar',bd = 2 ,font = ('Corbel bold',12), relief='groove', bg= 'white',padx=5,pady=2,command=self.login)
self.button.pack()
def login(self):
utilizador=self.username.get()
password=self.password.get()
self.connection = pymysql.connect(host="localhost", user="root", passwd="", database="sistemasenhas")
self.cur = self.connection.cursor()
query="SELECT * FROM utilizadores WHERE nome=%s AND password=%s"
data=self.cur.execute(query,(utilizador,password))
if(len(self.cur.fetchall())>0):
query="SELECT * FROM utilizadores WHERE nome=%s AND password=%s AND acesso=0"
data=self.cur.execute(query,(utilizador,password))
if(len(self.cur.fetchall())>0):
master.destroy() # It's here
self.janela()
else:
master.destroy() It's here
self.admin()
else:
ms.showerror('Oops','Utilizador ou palavra-passe incorretos!')
配置为内容类型http://jenkins.local.net:8080/generic-webhook-trigger/invoke?token=Client-iOS-App
,并且github显示交付状态为绿色。在詹金斯安装了generic-webhook-trigger。以下是管道
application/json
我想基于webhook触发器读取分支名称,然后根据它是哪个分支来运行特定任务。
此管道未从github触发。当我手动运行它时,它失败并显示以下消息
pipeline {
agent { label 'ios' }
triggers {
GenericTrigger(
genericVariables: [
[key: 'ref', value: '$.ref']
],
causeString: 'Triggered on $ref',
token: 'Client-iOS-App',
printContributedVariables: true,
printPostContent: true,
silentResponse: false,
regexpFilterText: '$ref',
regexpFilterExpression: 'refs/heads/' + '$ref'
)
}
stages {
stage ('Build') {
steps {
echo $ref
}
}
}
}
这里有帮助吗?