云客户?
免费开始>
在MyJFrog >中升级
云有什么新>





概述

GoPublishModule本机步骤将GO (GoLang)模块发布到Artifactory存储库。


页面内容


YAML模式

DockerBuild原生步骤的YAML模式如下:

GoPublishModule
- name:  steps: - name:  type: gopubishmodule configuration: #从bash继承所有标签;//m.si-fil.com/confluence/display/JFROG/Bash forceXrayScan:  # optional failOnScan:  # default true autoPublishBuildInfo:  # optional # for payloadType module: sourceLocation:  # optional version:  # required targetRepository:  # required self:  # optional deps:  # optional resolverRepo:  # optional integrations: - name:  # required if autoPublishBuildInfo为false inputRes2022世界杯阿根廷预选赛赛程ources: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: - name: # required - name:  # optional outputResources: - n2022世界杯阿根廷预选赛赛程ame:  # required如果autopubishbuildinfo是真执行:onStart: - echo“准备工作…”onSuccess: - echo“工作做得好!”onFailure: - echo“呃哦,出错了”onComplete: #always - echo“清理一些东西”




标签

的名字

一个字母数字字符串(允许使用下划线),用于标识步骤。

类型

必须GoPublishModule对于这个步骤类型。

配置

指定步骤执行环境的所有配置选择。该步骤继承Bash/PowerShell步骤配置标签,包括这些相关的标签:

标签

使用说明

必需的/可选
集成

指定一个Artifactory集成.时需要autoPublishBuildInfo设置为.方法中指定的Artifactory集成BuildInfo资源将被使用。

可能需要
input2022世界杯阿根廷预选赛赛程Resources

必须指定GitRepo资源发布命令将在Git存储库上运行sourceLocation

也可以指定一个可选的文件规范资源,指定要复制到的文件sourceLocation

要求

可选

output2022世界杯阿根廷预选赛赛程Resources

必须指定BuildInfo资源autoPublishBuildInfo设置为真正的

如果JFROG_CLI_BUILD_NAMEJFROG_CLI_BUILD_NUMBER设置为管道或步骤的环境变量,则该名称和/或数字将用于输出BuildInfo。否则,默认buildName而且buildNumberpipeline_name美元而且run_number美元分别。

可能需要


此外,可以定义这些标记来支持该步骤的本机操作:

从Bash派生的标记

所有本机步骤都派生自Bash的一步。这意味着所有步骤共享来自Bash的相同基本标记集,而本机步骤也有自己的附加标记,这些标记支持该步骤的特定功能。所以熟悉这个很重要Bash步骤定义,因为它是所有其他步骤定义的核心。

标签

使用说明

必需的/可选
sourceLocation Go源文件相对于输入GitRepo存储库根的位置.如果没有指定,默认是GitRepo存储库的根。 可选
版本 要构建的模块的版本。 要求
targetRepository 模块将在Artifactory中的存储库中发布。 要求
resolverRepo 用于解析依赖项的Artifactory存储库的名称。 可选
自我 真正的,使用——自我选项,将项目发布到Artifactory。有关更多信息,请参见JFrog Artifactory文档的CLI.JFrog CLI v2不支持。 可选
deps

指定时,使用——deps选项指定Artifactory的项目依赖项列表。有关更多信息,请参见JFrog Artifactory文档的CLI.JFrog CLI v2不支持。

可选
forceXrayScan

当设置为true时,在发布到Artifactory后强制进行x射线扫描。

默认为false。

可选
failOnScan

当设置为真正的,w当x光片策略规则失败的构建复选框,则x射线扫描失败将导致该步骤失败。

默认为true。

可选
autoPublishBuildInfo

当设置为true时,自动发布隐式创建的BuildInfo。

默认为false。

可选


执行

声明在执行前和执行后阶段执行的shell命令序列集合:
标签 使用说明 必需的/可选
onStart 在本机操作之前执行的命令 可选
调用onSuccess 成功完成后执行的命令 可选
onFailure 在完成失败时执行的命令 可选
onComplete 在任何补全时执行的命令 可选


对象执行的操作onExecute阶段是此步骤类型固有的,不能被覆盖。

例子

下面的例子展示了如何配置一个gopubishmodule步骤。

全管道示例

#这个配置文件是模板化的,这样可以很容易地自定义。值可以用值来提供。yml文件。模板:true #需要本地模板yml资2022世界杯阿根廷预选赛赛程源:# GitRepo中的示例Go应用程序-名称:go_repo类型:GitRepo配置:路径:{{. values。repoPath}}分支:包括:main gitProvider: {{. values。gitProvider}} #发布的Go应用程序的构建信息- name: go_buildinfo类型:BuildInfo配置:sourceArtifactory: {{. values。- name: go_publish_binary_example步骤:#从GitRepo构建Go示例应用程序。文档在//m.si-fil.com/confluence/display/JFROG/GoBuild -名称:build_go类型:GoBuild配置:sourceLocation:。resolverRepo: go-virtual noRegistry: true input2022世界杯阿根廷预选赛赛程Resources:—name: go_repo integrations:—name: {{. values。artifactory}} #发布Go示例应用二进制到artifactory - name: cicd_go_publish_binary类型:gopubishbinary配置:# forceXrayScan: true # failOnScan: false autopubishbuildinfo: true inputSteps: - name: build_go targetRepository: Go -local integrations: - name: myArtifactory outputResources: - name: go_buildinfo2022世界杯阿根廷预选赛赛程

使用默认位置

使用默认位置的gopubishmodule步骤,并将v0.0.0版本发布到名为go-repo的Artifactory存储库。

GoPublishModule
管道:—名称:goPublishModulePipeline步骤:—名称:goPublishModuleStep类型:GoPublishModule配置:版本:“v0.0.0”targetRepository: go-repo inputResources:—名称:gitRepoResource集成:—名称:artifacto2022世界杯阿根廷预选赛赛程ry_integration

GitRepo中不同的源位置

goppublishmodule步骤指定了GitRepo中的不同源位置,并将项目和依赖项发布到名为go-repo的Artifactory存储库中。

GoPublishModule
管道:—名称:goPublishModulePipeline步骤:—名称:goPublishModuleStep类型:GoPublishModule配置:版本:“v0.0”。${run_number}" targetRepository: go-repo resolverRepo: go-virtual self: true deps: ALL input2022世界杯阿根廷预选赛赛程Resources: - name: gitRepoResource integrations: - name: artifactory_integration

发布构建信息和触发x射线扫描

发布构建信息并触发x射线扫描的gopubishmodule步骤。

GoPublishModule
管道:—名称:goPublishModulePipeline步骤:—名称:goPublishModuleStep类型:GoPublishModule配置:版本:“v0.0”。${run_number}" targetRepository: go-repo autopubishbuildinfo: true forceXrayScan: true inputR2022世界杯阿根廷预选赛赛程esources: - name: gitRepoResource outputResources: - name: outputBuildInfo integrations: - name: artifactory_integration

工作原理

当你使用GoPublishModule管道中的本机步骤,它在后台执行以下功能:

  • jfrog config add(如果有一个输出的BuildInfo资源,配置jfrog CLI使用该资源中的Artifactory凭证)
  • jfrog config use(设置当前Artifactory的默认配置
  • cp(如果有一个输入FileSpec,将这些文件复制到克隆的GitRepo的根目录)
  • Jfrog rt go-config(配置存储库以解析依赖项)
  • Jfrog rt go-publish(发布)
  • Add_run_variables(为以后的步骤保存关于此步骤的信息)
  • 收集环境变量
  • jfrog rt build-publish(如果autopubishbuildinfo为true,则发布构建信息)
  • write_output(如果autopubishbuildinfo为真,更新输出资源)
  • jfrog rt build-scan(如果forceXrayScan为true,触发扫描)
  • Add_run_files(将构建信息保存在运行状态,以便以后发布步骤)
  • 没有标签
版权所有©2023 JFrog Ltd。