You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.1 KiB
YAML

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: build-and-deploy-sakal-us
namespace: sakal-us
spec:
params:
- name: gitrevision
type: string
- name: gitrepositoryurl
type: string
workspaces:
- name: repo
tasks:
- name: git-clone
workspaces:
- name: repo
workspace: repo
params:
- name: gitrepositoryurl
value: "$(params.gitrepositoryurl)"
- name: gitrevision
value: "$(params.gitrevision)"
taskSpec:
workspaces:
- name: repo
params:
- name: gitrepositoryurl
type: string
- name: gitrevision
type: string
steps:
- name: git-clone
image: bitnami/git
workingDir: $(workspaces.repo.path)
script: |
#!/bin/sh
git fetch --all --tags
git checkout $(params.gitrevision)
- name: npm-build
runAfter:
- git-clone
workspaces:
- name: repo
workspace: repo
taskSpec:
workspaces:
- name: repo
steps:
- name: build
image: node:20
workingDir: $(workspaces.repo.path)
script: npm install && npm run build
- name: save-to-s3
runAfter:
- npm-build
workspaces:
- name: repo
workspace: repo
taskSpec:
workspaces:
- name: repo
steps:
- name: save-to-s3
image: bitnami/minio-client
workingDir: $(workspaces.repo.path)
env:
- name: MINIO_SERVER_HOST
value: minio.minio-dev.svc.cluster.local
- name: MINIO_SERVER_ACCESS_KEY
valueFrom:
secretKeyRef:
name: minio-dev
key: accessKey
- name: MINIO_SERVER_SECRET_KEY
valueFrom:
secretKeyRef:
name: minio-dev
key: secretKey
script: |
mc alias set minio http://${MINIO_SERVER_HOST}:9000 "${MINIO_SERVER_ACCESS_KEY}" "${MINIO_SERVER_SECRET_KEY}"
mc alias list
mc cp --recursive ./dist/ minio/sakal-us/
- name: build-image
runAfter:
- npm-build
workspaces:
- name: repo
workspace: repo
params:
- name: gitrevision
value: "$(params.gitrevision)"
taskSpec:
params:
- name: gitrevision
type: string
workspaces:
- name: repo
steps:
- name: build-image
image: gcr.io/kaniko-project/executor:v1.9.0-debug
workingDir: $(workspaces.repo.path)
env:
- name: REGISTRY_HOST
value: registry.docker-registry.svc.cluster.local
script: |
#!/bin/sh
/kaniko/executor \
--context "./dist" \
--dockerfile "./Dockerfile" \
--destination "${REGISTRY_HOST}:5000/sakal-us:$(params.gitrevision)"