zoukankan      html  css  js  c++  java
  • webhook配置项目代码自动化部署

    1. 在webHook上配置,监听当有Push操作事件时,请求调用指定的URL(以上是coding.net上的操作)

    2.配置项目的URL,对应操作是执行git pull 部署操作。

    $token = env('WEBHOOK_TOKEN', '');
    // 从请求头中获取签名
    $signature = $request->header('X-Coding-Signature');
    $json_post = file_get_contents('php://input');
    // 进行签名解析
    $sha1 = hash_hmac("sha1", $json_post, $token);
    $calculate_signature = 'sha1='. $sha1;
    // 进行身份验证
    if ($calculate_signature !== $signature) {
    abort(403);
    }
    $shell_cmd1 = ['cd /home/cyq/project', 'git pull origin'];
    foreach ($shell_cmd1 as $cmd) {
    shell_exec($cmd);
    }
    http_response_code(200);
  • 相关阅读:
    Oracle Golden Gate
    DNS
    RMAN 管理
    黄伟-RAC生产库现场调整本分策略实战
    Linux下RAID技术
    OCP之黄伟 2
    About NULL Value
    OCP之黄伟
    Table
    Perl的简单变量
  • 原文地址:https://www.cnblogs.com/cyq632694540/p/11927793.html
Copyright © 2011-2022 走看看