当前位置: 首页 > news >正文

建网站权威机构网站建设与推广

建网站权威机构,网站建设与推广,足球比赛直播免费观看,ui界面设计作品模板场景介绍 我们在上一篇文章中构建了一个最简单的ci#xff0c;接下来我们对我们的github的项目构建一个较标准的ci。 Tekton简介#xff0c;安装和构建最简单ci/cd-CSDN博客文章浏览阅读239次#xff0c;点赞2次#xff0c;收藏2次。本文介绍了tekton是什么#xff0c;如…场景介绍 我们在上一篇文章中构建了一个最简单的ci接下来我们对我们的github的项目构建一个较标准的ci。 Tekton简介安装和构建最简单ci/cd-CSDN博客文章浏览阅读239次点赞2次收藏2次。本文介绍了tekton是什么如何安装以及实践了下task和task runhttps://blog.csdn.net/solinger/article/details/141898338?csdn_share_tail%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22141898338%22%2C%22source%22%3A%22solinger%22%7D ci是持续集成我们只需要考虑部署前的事情: pipeline: - clone repo - run test - build image - push image 有了这个思路我们就把它们实现。 我们按照最简单ci/cd的步骤先写task, taskrun,然后写pipeline, pipelinerun。 构建ci task git-clone # task-clone.yaml apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: git-clonelabels:app.kubernetes.io/version: 0.8 spec:workspaces:- name: outputdescription: The git repo will be cloned into the dirparams:- name: urldescription: Repository URL to clone from.type: string- name: revisiondescription: which commit you would like to get, master or otherstype: string- name: base_imagedescription: base_image for git unit testingtype: stringsteps:- name: cloneimage: $(params.base_image)env:- name: WORKSPACE_OUTPUT_PATHvalue: $(workspaces.output.path)- name: GIT_REPO_URLvalue: $(params.url)- name: GIT_REPO_REVISIONvalue: $(params.revision)script: |#!/usr/bin/env shset -euwhoamipwdcd ${WORKSPACE_OUTPUT_PATH}pwdrm -rf *git clone ${GIT_REPO_URL}repo_dir$(echo $GIT_REPO_URL | rev | cut -d / -f 1 | rev | sed s/.git//g)cd ${repo_dir}pwdgit checkout ${GIT_REPO_REVISION}ls -al pipeline pipelinerun for git-clone # pipeline.yaml apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata:name: pipeline spec:workspaces:- name: git-repo-pvcparams:- name: git_urltype: string- name: revisiontype: stringdefault: main- name: git_base_imagetype: stringtasks:- name: clonetaskRef:name: git-cloneworkspaces:- name: outputworkspace: git-repo-pvcparams:- name: urlvalue: $(params.git_url)- name: revisionvalue: $(params.revision)- name: base_imagevalue: $(params.git_base_image) # pipelinerun.yaml apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata:name: pipelinerun spec:pipelineRef:name: pipelineworkspaces:- name: git-repo-pvcpersistentVolumeClaim:claimName: git-repo-pvcparams:- name: git_urlvalue: https://github.com/testcara/tekton_triggers_learning.git- name: git_base_imagevalue: docker.io/cara/cara-pipeline-base:V1 现在让我们测试执行 kubectl apply -f task-clone.yaml kubectl pipeline.yaml kubectl pipelinerun.yaml 查看结果 kubectl get pods # 当查看到pipelinerun-clone-pod status 为completed时 # 查看pipelinerun logs tkn pipelinerun logs pipelinerun 可以看到我的输出表明其是正常完成的 carawangci %tkn pipelinerun logs pipelinerun [clone : clone] root [clone : clone] / [clone : clone] /workspace/output [clone : clone] Cloning into tekton_triggers_learning... [clone : clone] /workspace/output/tekton_triggers_learning [clone : clone] Already on main [clone : clone] total 28 [clone : clone] drwxr-xr-x 4 root root 4096 Sep 6 02:40 . [clone : clone] drwxrwxrwx 3 root root 4096 Sep 6 02:40 .. [clone : clone] drwxr-xr-x 8 root root 4096 Sep 6 02:40 .git [clone : clone] -rw-r--r-- 1 root root 67 Sep 6 02:40 Dockerfile [clone : clone] -rw-r--r-- 1 root root 77 Sep 6 02:40 README.md [clone : clone] -rw-r--r-- 1 root root 496 Sep 6 02:40 index.html [clone : clone] drwxr-xr-x 2 root root 4096 Sep 6 02:40 nginx task test 我们就简单的fake个test # task-test.yaml apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: test spec:workspaces:- name: outputdescription: The git repo will be cloned into the dirparams:- name: base_imagedescription: base_image for git unit testingtype: stringsteps:- name: testimage: $(params.base_image)env:- name: WORKSPACE_OUTPUT_PATHvalue: $(workspaces.output.path)script: |#!/usr/bin/env shset -euwhoamipwdcd ${WORKSPACE_OUTPUT_PATH}pwdls -alif [ -e tekton_triggers_learning/Dockerfile ]thenecho fake test passedelseexit 1fi pipeline pipelinerun for test 我们仅列出新编写的代码 # pipeline.yaml apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata:name: pipeline spec:params:- name: test_base_imagetype: stringtasks:- name: testtaskRef:name: testrunAfter:- cloneworkspaces:- name: outputworkspace: git-repo-pvcparams:- name: base_imagevalue: $(params.test_base_image) # pipelinerun.yaml apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata:name: pipelinerun spec:params:- name: test_base_imagevalue: centos:7 我们安装这些yaml然后观察pod查看pipelinerun logs. 通过我的log, 可以看到pipelinerun顺利完成。 carawangtekton_trigger_learning %tkn pipelinerun logs pipelinerun [clone : clone] root [clone : clone] / [clone : clone] /workspace/output [clone : clone] Cloning into tekton_triggers_learning... [clone : clone] /workspace/output/tekton_triggers_learning [clone : clone] Already on main [clone : clone] total 28 [clone : clone] drwxr-xr-x 4 root root 4096 Sep 6 04:10 . [clone : clone] drwxrwxrwx 3 root root 4096 Sep 6 04:10 .. [clone : clone] drwxr-xr-x 8 root root 4096 Sep 6 04:10 .git [clone : clone] -rw-r--r-- 1 root root 67 Sep 6 04:10 Dockerfile [clone : clone] -rw-r--r-- 1 root root 77 Sep 6 04:10 README.md [clone : clone] -rw-r--r-- 1 root root 496 Sep 6 04:10 index.html [clone : clone] drwxr-xr-x 2 root root 4096 Sep 6 04:10 nginx[test : test] root [test : test] / [test : test] /workspace/output [test : test] total 12 [test : test] drwxrwxrwx 3 root root 4096 Sep 6 04:10 . [test : test] drwxrwxrwx 3 root root 4096 Sep 6 04:10 .. [test : test] drwxr-xr-x 4 root root 4096 Sep 6 04:10 tekton_triggers_learning [test : test] fake test passed task build 我们仅列出新编写的代码 # task-build.yaml apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: buildlabels:app.kubernetes.io/version: 0.8 spec:workspaces:- name: outputparams:- name: base_imagedescription: base_image for docker buildtype: stringsteps:- name: buildimage: $(params.base_image)volumeMounts:- name: docker-socketmountPath: /var/run/docker.sockenv:- name: WORKSPACE_OUTPUT_PATHvalue: $(workspaces.output.path)script: |#!/usr/bin/env shset -euwhoamipwdcd ${WORKSPACE_OUTPUT_PATH}cd tekton_triggers_learningpwddocker versiondocker build . -t cara/cara-hello-nginx:latestvolumes:- name: docker-sockethostPath:path: /var/run/docker.socktype: Socket pipeline pipelinerun for build 我们仅列出新编写的代码 # pipeline.yaml spec:params:- name: docker_build_base_imagetype: stringtasks:- name: buildtaskRef:name: buildrunAfter:- testworkspaces:- name: outputworkspace: git-repo-pvcparams:- name: base_imagevalue: $(params.docker_build_base_image) # pipelinerun.yaml apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata:name: pipelinerun spec:params:- name: docker_build_base_imagevalue: docker.io/cara/my-dind-docker:latest 我们安装这些yaml然后观察pod查看pipelinerun logs. 通过我的pod status, 可以看到pipelinerun顺利完成。logs太长这里不再列出。 carawangci %kubectl get pods NAME READY STATUS RESTARTS AGE hello-nginx-b786f45d4-7lndt 1/1 Running 3 (50m ago) 20h hello-nginx-b786f45d4-cpj2g 1/1 Running 3 (50m ago) 20h hello-nginx-b786f45d4-rv7ch 1/1 Running 3 (50m ago) 20h pipelinerun-build-pod 0/1 Completed 0 74s pipelinerun-clone-pod 0/1 Completed 0 90s pipelinerun-test-pod 0/1 Completed 0 81s project-ci-cd-pipeline-run-fake-ci-cd-pod 0/1 Completed 0 45h task push 为了简便我们之间登陆而不用credentials secrect的方式。这种方式仅作为自己测试和学习使用。不能用于生产。 # task-build.yaml apiVersion: tekton.dev/v1beta1 kind: Task metadata:name: pushlabels:app.kubernetes.io/version: 0.8 spec:params:- name: base_imagedescription: base_image for docker buildtype: stringsteps:- name: pushimage: $(params.base_image)volumeMounts:- name: docker-socketmountPath: /var/run/docker.sockenv:script: |#!/usr/bin/env shset -euecho mypassword | docker login --username myname --password-stdindocker push cara/cara-hello-nginx:latestvolumes:- name: docker-sockethostPath:path: /var/run/docker.socktype: Socket pipeline pipelinerun for push 我们仅列出新编写的代码 # pipeline.yaml apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata:name: pipeline spec:tasks:- name: pushtaskRef:name: pushrunAfter:- buildparams:- name: base_imagevalue: $(params.docker_build_base_image) pipeline run没有任何变化这里不列出。 我们安装这些yaml然后观察pod查看pipelinerun logs. 通过我的pod status, 可以看到pipelinerun顺利完成。logs太长这里不再列出。 carawangci %kubectl get pods NAME READY STATUS RESTARTS AGE hello-nginx-b786f45d4-7lndt 1/1 Running 3 (120m ago) 21h hello-nginx-b786f45d4-cpj2g 1/1 Running 3 (120m ago) 21h hello-nginx-b786f45d4-rv7ch 1/1 Running 3 (120m ago) 21h pipelinerun-build-pod 0/1 Completed 0 7m32s pipelinerun-clone-pod 0/1 Completed 0 7m47s pipelinerun-push-pod 0/1 Completed 0 7m25s pipelinerun-test-pod 0/1 Completed 0 7m38s project-ci-cd-pipeline-run-fake-ci-cd-pod 0/1 Completed 0 46h 结语 这里我们的tekton ci已经构建完成。我们将在接下文的文章中介绍用tekton进行部署和用argocd进行部署。这两种部署都是比较流行的cd的形式。
http://www.hkea.cn/news/14310109/

相关文章:

  • 做优惠券网站东莞网站快速排名
  • 网站开发报告样式网站建设分哪些类别
  • 微网站医院策划案wordpress少女祈祷
  • 保定网站建设方法优秀的外贸网站案例
  • 济南做网站互联网公司网站建设与管理
  • 龙华做网站哪家好游戏网站建设策划书
  • 网站建设 工作室网络服务商简称
  • 唯品会购物网站开发项目开发公司项目部人员配置
  • 网站备案期间可以建站search everything wordpress
  • 订单拆单在电商网站建设qt做网站
  • 建设个人网站的参考网站及文献个人展示网站模板
  • 成都网站网站建设泰安市卓创网络科技有限公司
  • 网站快速搭建平台2024最火的十大新闻
  • 我的世界做弊端网站网站建设软件开发工作室整站模板
  • 坪地网站建设价格android网站开发视频
  • 青岛php网站建设莱州信息网电话
  • 优惠券网站开发公司网站制作公司
  • 逐鹿网站建设如何增加网站内链建设
  • 婚纱制作网站网页端
  • 设计网站手机app客户端企业网站的运营如何做
  • 网站内容很少如何做seo聊城开发网站建设
  • 一个网站大概多少钱有个找人做任务赚返佣的网站
  • 镇江网站建设找思创网络陕西百威建设监理有限司网站
  • 网站系统排名wordpress 博客模板
  • 昌吉哪个公司做网站新品发布会发言稿
  • 电子商务网站建设试卷及答案贵阳做网络平台的公司
  • 温州网站推广价钱网络舆情监测中心
  • 代做网站公司哪家好人工智能网页设计
  • python做网站快吗成都商报官方网站
  • 广州做网站代理商沂源县建设局网站