Gitlab CI中用于将文件(从生成)上载到当前项目版本(标记)的实用程序

gitlab-release的Python项目详细描述


此python实用程序用于上载特定版本 从gitlab ci构建到gitlab上的标记发布页面的文件。

这允许将具有任意结构的文件或(生成的)zip添加到 一个方便下载的版本,而不是那些 一定程度上被限制为总是压缩文件夹结构 直接从文件系统。

它可以在.gitlab-ci.yml阶段中使用,例如:

release:
  stage: release
  image: python3
  script:
    - pip3 install gitlab-release
    - gitlab-release *.zip
  only:
    - tags

或者,如果您想将一堆文件打包到一个zip中,并将其上载

release:
  stage: release
  image: python3
  script:
    - pip3 install gitlab-release
    - gitlab-release --zip "release-${CI_COMMIT_TAG}.zip" *
  only:
    - tags

或者,如果您只想将指向作业工件的链接添加到版本中:

release:
  stage: release
  image: python3
  script:
    - pip3 install gitlab-release
    - gitlab-release --link-artifact *.zip
  artifacts:
    paths:
      # Must include files passed to gitlab_release
      - ./*.zip
  only:
    - tags

在任何标记的版本中,命令行中指定的文件将 在项目的标记选项卡上提供。

gitlab版本需要python 3。

设置所需的专用令牌

此工具要求您将PRIVATE_TOKEN的副本放在 项目的机密CI变量,使其可以发布文件 回到项目上来。

为此,在 https://gitlab.com/profile/personal_access_tokens然后用这个。(你 也可以使用您的个人令牌 https://gitlab.com/profile/account,但这是不推荐的

确保在创建令牌时启用访问您的api。这个 令牌的名称只是为了让你记住它的用途,它不会 影响手术。

将其添加到名为PRIVATE_TOKEN的秘密变量中 在https://gitlab.com/<user>/<project>/settings/ci_cd>建造。

用法

usage: gitlab-release [-h] [--server SERVER] [--project_id PROJECT_ID]
                     [--release_tag RELEASE_TAG] [--timeout TIMEOUT]
                     [--ignore_cert] [--job-id JOB_ID] [--artifact-zip]
                     [--zip ZIP] [--description DESCRIPTION]
                     [--link-artifact] [--private-token PRIVATE_TOKEN]
                     [files [files ...]]
positional arguments
filesfile names and/or globs of files to upload
optional arguments
–description DESCRIPTIONRelease description to be put in front of the files
–timeout TIMEOUTTimeout for http requests
–ignore_certIgnore ssl certificate failures
–link-artifactLink files as artifact from the current job instead of uploading
–artifact-zipLink artifacts zip from current job
–job-id JOB_IDOverride the job number used for artifacts
–zip ZIPAdd all provided files to provided zip name and upload that
–server SERVERurl of gitlab server (default: $CI_PROJECT_URL)
–project_id PROJECT_IDUnique id of project, available in Project Settings/General (default: $CI_PROJECT_ID)
–release_tag RELEASE_TAGTag to upload files against (default: $CI_BUILD_TAG)
–private_tokenlogin token with permissions to commit to repo
-h, –helpshow this help message and exit

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java:数组大小的插入排序问题   javahibernate抛出com。mysql。jdbc。例外情况。jdbc4。MySQLSyntaxErrorException:查看手册,了解在“localTime”时间附近使用的正确语法   java Hibernate:org。冬眠UnUniqueObjectException:具有相同标识符值的不同对象已与会话关联   Gson无法用java解析我的json日期   JavaMaven使用JDK7为JVM5编译   java(播放2.1.3)@选择返回(字符串,字符串)对   java将画布拉伸到JFrame大小   来自JTextPane的java计算输入   java如何在使用Jenkins构建不稳定的情况下回滚Tomcat?   java是否可以获取包含类(CDI)的引用?   java“IllegalArgumentException:UNMAPPABLE[1]”,同时压缩带有希腊字符的文件   使用jtwitter和SignpostClient的java永久twitter oauth   java我需要对invokeAll调用的结果进行同步吗?   java Hibernate与jointable的关系   java Selenium断言搜索结果总计与正文中的实际结果   Java接口中的JLS8类只能位于最上面的类中   如果保证在收集时调用finalize(),java年轻一代仍然可以获得速度优势?   java集成OAuth帐户和本地帐户   java如何使用Jackson在对象中包含原始JSON?