Browse Source

new example pipeline

main
Nicolas Massé 2 years ago
parent
commit
e327ed8d6d
  1. 3
      examples/htop/tekton/pipeline.yaml
  2. 132
      examples/quarkus/tekton/pipeline.yaml
  3. 59
      examples/quarkus/tekton/pipelinerun.yaml
  4. 7
      tekton/task-buildah-build.yaml
  5. 2
      tekton/task-buildah-push.yaml

3
examples/htop/tekton/pipeline.yaml

@ -14,9 +14,6 @@ spec:
type: string type: string
- name: image-name - name: image-name
type: string type: string
- name: manifest-name
type: string
default: "tekton"
- name: context-dir - name: context-dir
type: string type: string
default: "." default: "."

132
examples/quarkus/tekton/pipeline.yaml

@ -0,0 +1,132 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: quarkus-getting-started
spec:
workspaces:
- name: sources
- name: oci-images
- name: registry-token
- name: maven-settings
params:
- name: git-url
type: string
- name: image-name
type: string
- name: context-dir
type: string
default: "."
- name: containerfile-path
type: string
default: "Containerfile"
tasks:
- name: clone-repo-x86-64
taskRef:
kind: ClusterTask
name: git-clone
params:
- name: url
value: $(params.git-url)
- name: revision
value: "main"
workspaces:
- name: output
workspace: sources
subPath: src-x86_64
- name: clone-repo-aarch64
taskRef:
kind: ClusterTask
name: git-clone
params:
- name: url
value: $(params.git-url)
- name: revision
value: "main"
workspaces:
- name: output
workspace: sources
subPath: src-aarch64
- name: maven-package-x86-64
runAfter: ["clone-repo-x86-64"]
taskRef:
kind: ClusterTask
name: maven
params:
- name: CONTEXT_DIR
value: $(params.context-dir)
workspaces:
- name: source
workspace: sources
subPath: src-x86_64
- name: maven-settings
workspace: maven-settings
- name: maven-package-aarch64
runAfter: ["clone-repo-aarch64"]
taskRef:
kind: ClusterTask
name: maven
params:
- name: CONTEXT_DIR
value: $(params.context-dir)
workspaces:
- name: source
workspace: sources
subPath: src-aarch64
- name: maven-settings
workspace: maven-settings
- name: build-x86-64
runAfter: ["maven-package-x86-64"]
taskRef:
name: buildah-build
params:
- name: context-dir
value: $(params.context-dir)
- name: containerfile-path
value: $(params.containerfile-path)
workspaces:
- name: source-workspace
workspace: sources
subPath: src-aarch64
- name: oci-images
workspace: oci-images
- name: build-aarch64
runAfter: ["maven-package-aarch64"]
taskRef:
name: buildah-build
params:
- name: context-dir
value: $(params.context-dir)
- name: containerfile-path
value: $(params.containerfile-path)
workspaces:
- name: source-workspace
workspace: sources
subPath: src-aarch64
- name: oci-images
workspace: oci-images
- name: push-image
runAfter: ["build-x86-64", "build-aarch64"]
taskRef:
name: buildah-push
params:
- name: image-name
value: $(params.image-name)
- name: architectures
value:
- x86_64
- aarch64
workspaces:
- name: oci-images
workspace: oci-images
- name: dockerconfig
workspace: registry-token

59
examples/quarkus/tekton/pipelinerun.yaml

@ -0,0 +1,59 @@
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
generateName: quarkus-getting-started-
spec:
pipelineRef:
name: quarkus-getting-started
params:
- name: git-url
value: https://github.com/nmasse-itix/tekton-pipeline-multiarch.git
- name: image-name
value: quay.io/nmasse_itix/quarkus-getting-started-multiarch
- name: context-dir
value: examples/quarkus/src
- name: containerfile-path
value: examples/quarkus/src/src/main/docker/Dockerfile.jvm
workspaces:
- name: oci-images
volumeClaimTemplate:
spec:
storageClassName: efs-csi
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
- name: sources
volumeClaimTemplate:
spec:
storageClassName: efs-csi
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
- name: maven-settings
emptyDir: {}
- name: registry-token
secret:
secretName: quay-authentication
taskRunTemplate:
serviceAccountName: buildbot
taskRunSpecs:
- pipelineTaskName: maven-package-x86-64
podTemplate:
nodeSelector:
beta.kubernetes.io/arch: amd64
- pipelineTaskName: maven-package-aarch64
podTemplate:
nodeSelector:
beta.kubernetes.io/arch: arm64
- pipelineTaskName: build-x86-64
podTemplate:
nodeSelector:
beta.kubernetes.io/arch: amd64
- pipelineTaskName: build-aarch64
podTemplate:
nodeSelector:
beta.kubernetes.io/arch: arm64

7
tekton/task-buildah-build.yaml

@ -7,6 +7,9 @@ spec:
- name: context-dir - name: context-dir
type: string type: string
default: . default: .
- name: containerfile-path
type: string
default: Containerfile
workspaces: workspaces:
- name: source-workspace - name: source-workspace
description: Workspace containing source code description: Workspace containing source code
@ -17,14 +20,14 @@ spec:
emptyDir: {} emptyDir: {}
steps: steps:
- name: build - name: build
image: registry.redhat.io/rhel8/buildah@sha256:b48f410efa0ff8ab0db6ead420a5d8d866d64af846fece5efb185230d7ecf591 image: registry.redhat.io/rhel8/buildah:8.9
env: env:
- name: STORAGE_DRIVER - name: STORAGE_DRIVER
value: vfs value: vfs
script: | script: |
#!/bin/bash #!/bin/bash
set -Eeuo pipefail set -Eeuo pipefail
buildah bud -t localhost/image:$(uname -m) $(workspaces.source-workspace.path)/$(params.context-dir) buildah bud -t localhost/image:$(uname -m) -f $(workspaces.source-workspace.path)/$(params.containerfile-path) $(workspaces.source-workspace.path)/$(params.context-dir)
buildah push localhost/image:$(uname -m) oci-archive:/srv/oci-images/$(uname -m).tar buildah push localhost/image:$(uname -m) oci-archive:/srv/oci-images/$(uname -m).tar
securityContext: securityContext:
capabilities: capabilities:

2
tekton/task-buildah-push.yaml

@ -19,7 +19,7 @@ spec:
emptyDir: {} emptyDir: {}
steps: steps:
- name: push - name: push
image: registry.redhat.io/rhel8/buildah@sha256:b48f410efa0ff8ab0db6ead420a5d8d866d64af846fece5efb185230d7ecf591 image: registry.redhat.io/rhel8/buildah:8.9
env: env:
- name: STORAGE_DRIVER - name: STORAGE_DRIVER
value: vfs value: vfs

Loading…
Cancel
Save