openshift pipelines
openshift pipelines
1장. OPENSHIFT PIPELINES 이해 ( 한글 )
- 별거 없으니, skip
1.2. RED HAT OPENSHIFT PIPELINES 개념 ( 한글 )
1.2. Red Hat OpenShift Pipelines 개념 OpenShift Container Platform 4.6 | Red Hat Customer Portal
The Red Hat Customer Portal delivers the knowledge, expertise, and guidance available through your Red Hat subscription.
access.redhat.com
Pipeline = workflow
PipelineResources와 매개변수
Task = Job 과 유사
PipelineRun : 실행중인 instance
TaskRun = thread 와 비슷한가?
Workspace : task 에 필요한 스토리지 볼륨
- git clone 받고 빌드하는 곳?
Trigger
Condition : task 실행 조건 ( t/f ) \
1.3. 자세한 OPENSHIFT PIPELINE 개념
1.3. 자세한 OpenShift Pipeline 개념 OpenShift Container Platform 4.6 | Red Hat Customer Portal
The Red Hat Customer Portal delivers the knowledge, expertise, and guidance available through your Red Hat subscription.
access.redhat.com
1.3.1 Task
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: apply-manifests
spec:
params:
- default: k8s
description: The directory in source that contains yaml manifests
name: manifest_dir
type: string
steps:
- args:
- |-
echo Applying manifests in $(inputs.params.manifest_dir) directory
oc apply -f $(inputs.params.manifest_dir)
echo -----------------------------------
command:
- /bin/bash
- -c
image: quay.io/openshift/origin-cli:latest
name: apply
workingDir: /workspace/source
workspaces:
- name: source
Steps 는 Task pod 내 자체 컨테이너로 실행됨, config map 등 볼륨에 access 가능
openshift/origin-cli 이미지 이용 manifest 를 oc apply -f () 하는 예시
1.3.2 TaskRun
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: apply-manifests-taskrun
spec:
serviceAccountName: pipeline
taskRef:
kind: Task
name: apply-manifests
workspaces:
- name: source
persistentVolumeClaim:
claimName: source-pvc
위에서 등록한 Task 를 실행하는 TaskRun 인듯 싶다
taskRef:
name: apply-manifests
형태로 등록한다 또 workspaces 를 pvc 와 연결한다
1.3.3 Pipeline
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: build-and-deploy
spec:
workspaces:
- name: shared-workspace
params:
- name: deployment-name
type: string
description: name of the deployment to be patched
- name: git-url
type: string
description: url of the git repo for the code of deployment
- name: git-revision
type: string
description: revision to be used from repo of the code for deployment
default: "release-tech-preview-3"
- name: IMAGE
type: string
description: image to be built from the code
tasks:
- name: fetch-repository
taskRef:
name: git-clone
kind: ClusterTask
workspaces:
- name: output
workspace: shared-workspace
params:
- name: url
value: $(params.git-url)
- name: subdirectory
value: ""
- name: deleteExisting
value: "true"
- name: revision
value: $(params.git-revision)
- name: build-image
taskRef:
name: buildah
kind: ClusterTask
params:
- name: TLSVERIFY
value: "false"
- name: IMAGE
value: $(params.IMAGE)
workspaces:
- name: source
workspace: shared-workspace
runAfter:
- fetch-repository
- name: apply-manifests
taskRef:
name: apply-manifests
workspaces:
- name: source
workspace: shared-workspace
runAfter:
- build-image
- name: update-deployment
taskRef:
name: update-deployment
workspaces:
- name: source
workspace: shared-workspace
params:
- name: deployment
value: $(params.deployment-name)
- name: IMAGE
value: $(params.IMAGE)
runAfter:
- apply-manifests
완성된 pipleline 인듯한데 다소 복잡하다
tasks는
1. fetch-repository
2. build-image
3. apply-manifest. ??
4.update-deployment
4단계 구성되어있다. runfAfter: -featch-repository 를 이용해 순서를 지정한 듯 하다
1.3.4. PipelineRun
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: build-deploy-api-pipelinerun
spec:
pipelineRef:
name: build-and-deploy
params:
- name: deployment-name
value: vote-api
- name: git-url
value: http://github.com/openshift-pipelines/vote-api.git
- name: IMAGE
value: image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/vote-api
workspaces:
- name: shared-workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
사용하기 조금 쉬워진 형태다
1.3.5. Workspace
Task 입력 및 출력 저장
Task 간 데이터 공유
시크릿에 보관된 자격 증명의 마운트 지점으로 작업 공간 활용
ConfigMaps에 보관된 구성의 마운트 지점으로 작업 공간 활용
조직에서 공유하는 공통 도구의 마운트 지점으로 작업 공간 활용
작업 속도를 높이는 빌드 아티팩트 캐시 생성
1.3.6.Trigger
- skip
TriggerBiding
TriggerTemplate
EventListener
Reference
blog
https://cloud.redhat.com/blog/openshift-pipelines-and-openshift-gitops-are-now-generally-available
OpenShift Pipelines and OpenShift GitOps are now Generally Available
We are excited to announce the General Availability of OpenShift Pipelines and OpenShift GitOps as the foundation of cloud-native CI/CD and GitOps on Red Hat OpenShift Container Platform.
content.cloud.redhat.com