Bootstrap

云原生CI/CD框架Tekton国内部署方式

e3d33b964eb1db75ba0369e7dce5ae74.png

Tekton 是一款功能非常强大而灵活的 CI/CD 开源的云原生框架。致力于提供全功能、标准化的云原生 CI/CD 解决方案。【本文主要是通过流水线自动化的将tekton镜像同步到腾讯云仓库,并部署tekton】

应用镜像

阿里云镜像仓库居然有限制...这次转到腾讯云镜像仓库了;ccr.ccs.tencentyun.com/tektons/dashboard

c4c42212694ebb2e84a94c4cf94b1610.png


Pipeline

借助GitHub Actions:

  1. 同步镜像并生成镜像映射文件(json):

  2. 收集镜像映射文件为制品;

This is a basic workflow to help you get started with Actions

name: Get Tekton Images
env:
  VERSION: v0.29.0

on:
  push:
    paths:
      - '.github/workflows/tekton.yaml'
      - 'tekton/**'

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@v2
    - name: build
      run: |
      
        curl https://storage.googleapis.com/tekton-releases/pipeline/previous/${
   { env.VERSION }}/release.yaml -o release.yaml
        grep  -v "#" release.yaml | grep -v "^$"  > release1.yaml  ; sed -i 's/\-\-\-/###/g' release1.yaml
        python3  tekton/get_tekton_images.py ${
   { secrets.DOCKER_USER}} ${
   { secrets.DOCKER_PASSWD}}
    - uses: actions/upload-artifact@v2
      with: 
        name: ${
   { env.VERSION }}-tekton-images
        path: tekton_images.json


364fe540b498d2c10b854bd9762a5c07.png


部署文件解析

  1. 下载release部署yaml;

  2. 解析Deployments对象中的images;

    1. tekton-pipelines-controller

    2. tekton-pipelines-webhook

    3. tekton-dashboard(最新tag)

gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller:v0.29.0@sha256:72f79471f06d096cc53e51385017c9f0f7edbc87379bf415f99d4bd11cf7bc2b
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter:v0.29.0@sha256:6d058f2203b9ab66f538cb586c7dc3b7cc31ae958a4135dd99e51799f24b06c9
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.29.0@sha256:c0b0ed1cd81090ce8eecf60b936e9345089d9dfdb6ebdd2fd7b4a0341ef4f2b9
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint:v0.29.0@sha256:66958b78766741c25e31954f47bc9fd53eaa28263506b262bf2cc6df04f18561
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.29.0@sha256:6a037d5ba27d9c6be32a9038bfe676fb67d2e4145b4f53e9c61fb3e69f06e816
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/imagedigestexporter:v0.29.0@sha256:e38dd0d32253fce5aaf1e501c0bc71facc3720564b7e97055921cc5390d612e0
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/pullrequest-init:v0.29.0@sha256:d28202fb8b33a1d4c05f261ef8dcbcdcf3b469887d4dad256ce91f73c917420e
gcr.io/google.com/cloudsdktool/cloud-sdk@sha256:27b2c22bf259d9bc1a291e99c63791ba0c27a04d2db0a43241ba0f1f20f4067f
gcr.io/distroless/base@sha256:aa4fd987555ea10e1a4ec876
;