码迷,mamicode.com
首页 > 其他好文 > 详细

Jenkins 任务

时间:2020-08-19 19:59:48      阅读:53      评论:0      收藏:0      [点我收藏+]

标签:artifact   oca   osi   sts   _for   token   command   企业微信   pre   

创建基本任务

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}

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%\npm-cache)

Build

PowerShell plugin

  • PowerShell

    • Command
    $env:Path+=";C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
    {build_script, .\build.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-12 新增了企业微信通知的配置说明

Jenkins 任务

标签:artifact   oca   osi   sts   _for   token   command   企业微信   pre   

原文地址:https://www.cnblogs.com/nehcdahc/p/13518234.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!