zoukankan      html  css  js  c++  java
  • Jenkins 任务

    创建基本任务

    General

    • Use custom workspace > Directory: {directory, d:github}

    Source Code Management

    Git plugin

    • Git > Repositories > Repository URL: {repository_url, https://xxx.xxx.xxx.xxx/xxx.git}
    • Git > Repositories > Credentials: {credentials}
    • Git > Branches to build > Branch Specifier (blank for 'any'): {branch_specifier, 10.29}
    • Git > Additional Behaviours > Check out to specific local branch > Branch name: {branch_name, 10.29}
    • Git > Additional Behaviours > Advanced clone behaviours > Timeout (in minutes) for clone and fetch operations: {30}

    Build Triggers

    • Build when a change is pushed to GitLab. GitLab webhook URL: ... > Enabled GitLab triggers > Push Events: {checked}
    • Build when a change is pushed to GitLab. GitLab webhook URL: ... > Enabled GitLab triggers > Accepted Merge Request Events: {checked}
    • Build when a change is pushed to GitLab. GitLab webhook URL: ... > Enabled GitLab triggers > Approved Merge Requests (EE-only): {checked}
    • Build when a change is pushed to GitLab. GitLab webhook URL: ... > Secret token > {secret_token,如果这个不设置 GitLab 的 Webhooks 配置会报 403 错误}

    参考

    Build Environment

    Version Number Plug-In

    • Create a formatted version number > Environment Variable Name: BUILD_VERSION
    • Create a formatted version number > Environment Variable Name: Version Number Format String: {branch_name, 10.29}.${BUILD_DATE_FORMATTED, "yyyyMMdd"}.${BUILDS_TODAY}
    • Create a formatted version number > Inject environment variables to the build process: {checked}
    参考

    NodeJS Plugin

    • Provide Node & npm bin/ folder to PATH > NodeJS Installation: NodeJS12
    • Provide Node & npm bin/ folder to PATH > npmrc file: - use system default -
    • Provide Node & npm bin/ folder to PATH > Cache location: Default(~/.npm or %APP_DATA% pm-cache)

    Build

    PowerShell plugin

    • PowerShell

      • Command
      $env:Path+=";C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildCurrentBin"
      {build_script, .uild.ps1 -r}
      

    Post-build Actions

    Artifact Deployer Plug-in

    • Post-build Actions > [ArtifactDeployer] - Deploy the artifacts from build workspace to remote locations > Artifacts to deploy: {artifacts_to_deploy, **}
    • Post-build Actions > [ArtifactDeployer] - Deploy the artifacts from build workspace to remote locations > Basedir: {dist_directory, dist/}
    • Post-build Actions > [ArtifactDeployer] - Deploy the artifacts from build workspace to remote locations > Remote File Location: {remote_file_location, f:/artifacts/${BUILD_VERSION}}

    企业微信通知,需要安装插件 qy-wechat-notification 才能使用

    基于模板创建任务

    修改记录

    • 2020-08-20 添加 git clone 超时时间设置
    • 2020-08-12 新增了企业微信通知的配置说明
  • 相关阅读:
    springAOP实现原理
    cglib用法
    git 用法
    java基础算法之快速排序
    记一次与a标签相遇的小事
    java设计模式之建造者模式
    HashMap源码分析
    Linux下安装nginx
    java设计模式之策略模式
    java设计模式之中介者模式
  • 原文地址:https://www.cnblogs.com/nehcdahc/p/13518234.html
Copyright © 2011-2022 走看看