蛮子哥 蛮子哥
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • ArgoCD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

蛮子哥

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • ArgoCD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • ansible系列文章

  • Kubernetes笔记

  • elk

  • jenkins

  • GitLabCI_CD

    • Gitlab ci与Jenkins对比
    • GitLabRunner简介
    • GitLabRunner安装
    • GitLabRunner注册
    • Runner-命令
    • 运行流水线任务
    • 集成构建工具
    • 制品库集成
    • 按时间统计GitLab所有用户代码提交量
    • gitlab ci部署web程序示例
    • Untitled
    • gitlab部署

  • AI编程

  • 提示词

  • ArgoCD

  • 专题
  • GitLabCI_CD
蛮子哥
2026-05-04

Untitled

# 打包镜像并修改镜像tag

variables:
  IMAGE_NAME: "docker.cnb.cool/zzppjj/docker-images/litghtpicture"
  IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
  CONFIG_REPO: "git@192.168.51.50:root/argo-demo.git"

stages:
  - build
  - deploy

build:
  stage: build
  image: docker:24.0
  services:
    - docker.cnb.cool/zzppjj/docker-images/docker:24.0-dind
  script:
    - docker login -u cnb docker.cnb.cool -p 01d21Lwxp6gMZBcf0o7BnPeaNgM
    - docker build -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:latest .
    - docker push $IMAGE_NAME:$IMAGE_TAG
    - docker push $IMAGE_NAME:latest
  only:
    - main

update-manifests:
  stage: deploy
  image: docker.cnb.cool/zzppjj/docker-images/git  # 留着没事,等以后换了 Docker Executor 会自动生效
  needs: ["build"]
  script:
    # 1. 删掉了 apk add --no-cache git openssh-client (因为宿主机已经装好了)
    - git config --global user.email "ci@gitlab.com"
    - git config --global user.name "GitLab CI"
    
    - git clone $CONFIG_REPO
    - cd argo-demo
    
    - cd manifests
    - |
        find . -type f \( -name "*.yaml" -o -name "*.yml" \) | xargs sed -i "s|image: .*picture:[^[:space:]]*|image: $IMAGE_NAME:$IMAGE_TAG|g"
    
    - git add .
    - |
        git diff --cached --quiet || git commit -m "chore: update image $IMAGE_NAME to $IMAGE_TAG [skip ci]"
    - git push origin main
  only:
    - main
  environment: production

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
微信 支付宝
上次更新: 2026/06/04, 16:55:11

← gitlab ci部署web程序示例 docker部署gitlab→

最近更新
01
victorialogs配置关键字告警
06-03
02
kubernetes部署jaeger
05-30
03
grafana高可用部署
05-26
更多文章>
Theme by Vdoing | Copyright © 2019-2026 | 点击查看十年之约 | 鄂ICP备2024072800号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式