def get(self, jobname=''): goujian = Conlenct_jenkins().build_job(jobname) if goujian == True: flash('构建成功!', category="message") return redirect(url_for('home.jenkinsfirst')) else: flash('构建失败', category="message") return redirect(url_for('home.jenkinsfirst'))
def post(self): url = (request.get_data().decode('utf-8')) url_base = (url.split('&')[0]) jobname = url.split('&')[1] try: log = Conlenct_jenkins().job_bulid_log(url_base, jobname) return jsonify({"code": 200, 'data': str(log)}) except Exception as e: return jsonify({'code': 701, 'data': str(e)})
def get(self): # tasks=Task.query.filter_by(makeuser=current_user.id,status=False).all() jobs = Conlenct_jenkins().get_all_job() jenkis_task = [] for job in jobs: # for task in tasks: # if job['name']==task.taskname: jenkis_task.append({ 'name': job['name'], 'url': job['url'], 'color': job['color'] }) return render_template('home/jenkins.html', jobs=jenkis_task)
def get(self): try: # tasks=Task.query.filter_by(makeuser=current_user.id,status=False).all() jobs = Conlenct_jenkins().get_all_job() jenkis_task = [] for job in jobs: # for task in tasks: # if job['name']==task.taskname: jenkis_task.append({'name': job['name'], 'url': job['url'], 'color': job['color']}) return render_template('home/jenkins.html', jobs=jenkis_task) except Exception as e: flash("无法连接jenkins服务器", category="error") return redirect(url_for('home.index'))