前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【GitLab CI/CD】:一些有用的基础知识

【GitLab CI/CD】:一些有用的基础知识

作者头像
WEBJ2EE
发布2021-01-03 16:00:33
9260
发布2021-01-03 16:00:33
举报
文章被收录于专栏:WebJ2EE
代码语言:javascript
复制
目录1. Git strategy    1.1. 用途?    1.2. 机制?2. Packages & Registries    2.1. 用途?    2.2. 机制?3. Releases    3.1. 用途?    3.2. 机制?

1. Git strategy

1.1. 用途?

它能回答下面几个问题:

  • 需要自己写脚本 clone 仓库吗?
  • 脚本执行过程中产生的临时文件,怎么处理?
    • 在编写不同 job 的脚本时,需要考虑前面脚本产生的临时文件吗?

1.2. 机制?

You can set the GIT_STRATEGY used to fetch the repository content, either globally or per-job in the variables section:

代码语言:javascript
复制
variables:  GIT_STRATEGY: clone | fetch | none

There are three possible values: clone, fetch, and none. If left unspecified, jobs use the project’s pipeline setting.

  • clone is the slowest option. It clones the repository from scratch for every job, ensuring that the local working copy is always pristine. If an existing worktree is found, it is removed before cloning.
  • fetch is faster as it re-uses the local working copy (falling back to clone if it does not exist). git clean is used to undo any changes made by the last job, and git fetch is used to retrieve commits made after the last job ran.
    • git clean: Cleans the working tree by recursively removing files that are not under version control, starting from the current directory.
  • A Git strategy of none also re-uses the local working copy, but skips all Git operations normally done by GitLab. GitLab Runner pre-clone scripts are also skipped, if present. This strategy could mean you need to add fetch and checkout commands to your .gitlab-ci.yml script.
    • It can be used for jobs that operate exclusively on artifacts, like a deployment job. Git repository data may be present, but it’s likely out of date. You should only rely on files brought into the local working copy from cache or artifacts.

2. Packages & Registries

2.1. 用途?

  • GitLab 不仅是个仓库,它还有发布包托管技能。
    • 特别注意,13.5 版本以后,GitLab 可以托管 “Generic packages” 类型包,就是说什么都可以托管(war、zip、exe 等一切想对外发布、公开的发布包文件)。

2.2. 机制?

The GitLab Package Registry acts as a private or public registry for a variety of common package managers. You can publish and share packages, which can be easily consumed as a dependency in downstream projects.

The Package Registry supports the following formats:

3. Releases

3.1. 用途?

  • GitLab 同样具备版本发布技能,要合理利用。
    • GitLab 的 Releases 技能可以和 Packages & Registries 技能配合使用,体验更好。

3.2. 机制?

To introduce a checkpoint in your source code history, you can assign a Git tag at the moment of release. However, in most cases, your users need more than just the raw source code.They need compiled objects or other assets output by your CI/CD system.

A GitLab Release is a snapshot of the source, build output, artifacts, and other metadata associated with a released version of your code.

You can create a GitLab release on any branch. When you create a release:

  • GitLab automatically archives source code and associates it with the release.
  • GitLab automatically creates a JSON file that lists everything in the release, so you can compare and audit releases. This file is called release evidence.
  • You can add release notes and a message for the tag associated with the release.

After you create a release, you can associate milestones with it, and attach release assets, like runbooks or packages.

参考:

Releases: https://docs.gitlab.com/ee/user/project/releases/ Git strategy: https://docs.gitlab.com/ee/ci/runners/README.html#git-strategy

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-12-19,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WebJ2EE 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
对象存储
对象存储(Cloud Object Storage,COS)是由腾讯云推出的无目录层次结构、无数据格式限制,可容纳海量数据且支持 HTTP/HTTPS 协议访问的分布式存储服务。腾讯云 COS 的存储桶空间无容量上限,无需分区管理,适用于 CDN 数据分发、数据万象处理或大数据计算与分析的数据湖等多种场景。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档