Skip to content

Xinyan272/CICD-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CICD-demo

Introduction

The repo for Tekton pipeline yaml & Flux2 deploy yaml & test app example

  • fluxcd-manifests: Applying flux needs these yaml templates(automation deploy & automation image update included )
  • tekton-manifests: kaniko pipeline & 2 methods of monitoring git changes(cronjob for git pull, git webhook)

CICD structure:


Details

1. Flux2

  • Install flux to cluster installation doc

    Eg:

    flux bootstrap github \
      --owner=Xinyan272\
      --repository=test-flux \
      --branch=demo \
      --path=./cluster-env/demo1 \
      --personal \
      --read-write-key \
      --components-extra=image-reflector-controller,image-automation-controller    
  • Deploy a remote application from Git

    Git repo has in addition to source code and deploy yaml files, flux kustomization monitor these yaml files regularly and synchronize deploy.

    synchronize manual:

    flux reconcile kustomization flux-system --with-source
  • Image update automation

    1. imageRepository : The image repository that needs to be monitored (Eg: imageRepoUrl/xinyan/test)
    2. imagePolicy : The ImagePolicy type gives rules for selecting a “latest” image from a scanned ImageRepository. imagePolicy examples
    3. imageUpdateAutomation: An automation process that will update a git repository, based on image policiy objects in the same namespace.

    Attention:

    1. The automatic image update mechanism needs to comment imagePolicy after 'image' of deploy yaml file, otherwise it cannot be updated. Eg:
      - image: imageRepoUrl/xinyan/test # {"$imagepolicy": "namespace:imagePolicyName"}
    2. Every different image needs imageRepo & imagePolicy respective

2. Tekton

Using kaniko task & pipeline to build image and push to remote image repository.

2 methods of synchronizing git

  • git pull -> cronjob

    A timed job to periodically monitor whether git has changed, and trigger a new pipelineRun if there is a change, nothing do if not.

    reference: win5do/tekton-cicd-demo

  • git webhook -> tekton trigger

    The pipelineRun is triggered by git webhook. As soon as git is updated, a new pipelineRun will be created automatically.

About

Example git repo for CI&CD(Tekton&Flux2)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published