4 changed files with 203 additions and 0 deletions
@ -0,0 +1,125 @@ |
|||||
|
apiVersion: tekton.dev/v1beta1 |
||||
|
kind: Pipeline |
||||
|
metadata: |
||||
|
name: nodejs-hello-world |
||||
|
spec: |
||||
|
|
||||
|
workspaces: |
||||
|
- name: sources |
||||
|
- name: oci-images |
||||
|
- name: registry-token |
||||
|
|
||||
|
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: npm-install-x86-64 |
||||
|
runAfter: ["clone-repo-x86-64"] |
||||
|
taskRef: |
||||
|
name: npm-install |
||||
|
params: |
||||
|
- name: context-dir |
||||
|
value: $(params.context-dir) |
||||
|
workspaces: |
||||
|
- name: source-workspace |
||||
|
workspace: sources |
||||
|
subPath: src-x86_64 |
||||
|
|
||||
|
- name: npm-install-aarch64 |
||||
|
runAfter: ["clone-repo-aarch64"] |
||||
|
taskRef: |
||||
|
name: npm-install |
||||
|
params: |
||||
|
- name: context-dir |
||||
|
value: $(params.context-dir) |
||||
|
workspaces: |
||||
|
- name: source-workspace |
||||
|
workspace: sources |
||||
|
subPath: src-aarch64 |
||||
|
|
||||
|
- name: build-x86-64 |
||||
|
runAfter: ["npm-install-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: ["npm-install-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 |
||||
@ -0,0 +1,57 @@ |
|||||
|
apiVersion: tekton.dev/v1 |
||||
|
kind: PipelineRun |
||||
|
metadata: |
||||
|
generateName: nodejs-hello-world- |
||||
|
spec: |
||||
|
pipelineRef: |
||||
|
name: nodejs-hello-world |
||||
|
params: |
||||
|
- name: git-url |
||||
|
value: https://github.com/nmasse-itix/tekton-pipeline-multiarch.git |
||||
|
- name: image-name |
||||
|
value: quay.io/nmasse_itix/nodejs-hello-world-multiarch |
||||
|
- name: context-dir |
||||
|
value: examples/nodejs/src |
||||
|
- name: containerfile-path |
||||
|
value: examples/nodejs/src/Containerfile |
||||
|
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: registry-token |
||||
|
secret: |
||||
|
secretName: quay-authentication |
||||
|
taskRunTemplate: |
||||
|
serviceAccountName: buildbot |
||||
|
taskRunSpecs: |
||||
|
- pipelineTaskName: npm-install-x86-64 |
||||
|
podTemplate: |
||||
|
nodeSelector: |
||||
|
beta.kubernetes.io/arch: amd64 |
||||
|
- pipelineTaskName: npm-install-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 |
||||
@ -0,0 +1,20 @@ |
|||||
|
apiVersion: tekton.dev/v1beta1 |
||||
|
kind: Task |
||||
|
metadata: |
||||
|
name: npm-install |
||||
|
spec: |
||||
|
params: |
||||
|
- name: context-dir |
||||
|
type: string |
||||
|
default: . |
||||
|
workspaces: |
||||
|
- name: source-workspace |
||||
|
description: Workspace containing source code |
||||
|
steps: |
||||
|
- name: npm-install |
||||
|
image: registry.access.redhat.com/ubi9/nodejs-20:latest |
||||
|
script: | |
||||
|
#!/bin/bash |
||||
|
set -Eeuo pipefail |
||||
|
cd $(workspaces.source-workspace.path)/$(params.context-dir) |
||||
|
npm install |
||||
Loading…
Reference in new issue