oas-workflow.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. apiVersion: argoproj.io/v1alpha1
  2. kind: Workflow
  3. metadata:
  4. generateName: oas-image-
  5. spec:
  6. arguments:
  7. parameters:
  8. - name: repo
  9. value: ssh://git@git.cestong.com.cn:8162/cecf/ob-agent-stream.git
  10. - name: branch
  11. value: master
  12. - name: path
  13. value: test/e2e/images/argosay/v2
  14. - name: image
  15. value: reg.cestong.com.cn/cecf/ob-agent-stream:test
  16. entrypoint: main
  17. volumeClaimTemplates:
  18. - metadata:
  19. name: work
  20. spec:
  21. accessModes: [ "ReadWriteOnce" ]
  22. resources:
  23. requests:
  24. storage: 64Mi
  25. templates:
  26. - name: main
  27. dag:
  28. tasks:
  29. - name: clone
  30. template: clone
  31. arguments:
  32. parameters:
  33. - name: repo
  34. value: "{{workflow.parameters.repo}}"
  35. - name: branch
  36. value: "{{workflow.parameters.branch}}"
  37. - name: build
  38. template: build
  39. arguments:
  40. parameters:
  41. - name: path
  42. value: "{{workflow.parameters.path}}"
  43. depends: "clone"
  44. - name: image
  45. template: image
  46. arguments:
  47. parameters:
  48. - name: path
  49. value: "{{workflow.parameters.path}}"
  50. - name: image
  51. value: "{{workflow.parameters.image}}"
  52. depends: "build"
  53. - name: clone
  54. inputs:
  55. parameters:
  56. - name: repo
  57. - name: branch
  58. container:
  59. volumeMounts:
  60. - mountPath: /work
  61. name: work
  62. image: reg.cestong.com.cn/cecf/cibuilder
  63. workingDir: /work
  64. args:
  65. - clone
  66. - --depth
  67. - "1"
  68. - --branch
  69. - "{{inputs.parameters.branch}}"
  70. - --single-branch
  71. - "{{inputs.parameters.repo}}"
  72. - .
  73. - name: build
  74. inputs:
  75. parameters:
  76. - name: path
  77. container:
  78. image: reg.cestong.com.cn/cecf/cibuilder
  79. volumeMounts:
  80. - mountPath: /work
  81. name: work
  82. workingDir: /work/{{inputs.parameters.path}}
  83. env:
  84. # Because this is not a Gomodule, we must turn modules off.
  85. - name: GO111MODULE
  86. value: "on"
  87. command:
  88. - go
  89. args:
  90. - build
  91. - -v
  92. - -o
  93. - argosay
  94. - ./...
  95. - name: image
  96. inputs:
  97. parameters:
  98. - name: path
  99. - name: image
  100. volumes:
  101. - name: docker-config
  102. secret:
  103. secretName: docker-config
  104. container:
  105. readinessProbe:
  106. exec:
  107. command: [ sh, -c, "buildctl debug workers" ]
  108. image: reg.cestong.com.cn/cecf/cibuilder
  109. volumeMounts:
  110. - name: work
  111. mountPath: /work
  112. #- name: docker-config
  113. # mountPath: /.docker
  114. workingDir: /work/{{inputs.parameters.path}}
  115. env:
  116. - name: BUILDKITD_FLAGS
  117. value: --oci-worker-no-process-sandbox
  118. #- name: DOCKER_CONFIG
  119. # value: /.docker
  120. command:
  121. - buildctl-daemonless.sh
  122. args:
  123. - build
  124. - --frontend
  125. - dockerfile.v0
  126. - --local
  127. - context=.
  128. - --local
  129. - dockerfile=.
  130. - --output
  131. - type=image,name={{inputs.parameters.image}},push=true