-
Notifications
You must be signed in to change notification settings - Fork 131
/
service-pipeline.yaml
109 lines (108 loc) · 3.69 KB
/
service-pipeline.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: service-pipeline
annotations:
description: |
Build the artifacts for the Conference application's services
spec:
params:
- name: gitRepository
description: The git repository that hosts the source code of the service
default: https://github.com/salaboy/platforms-on-k8s/
- name: gitRevision
description: The git revision to build
default: main
- name: context
description: The path to the docker context in the sources workspace
default: "."
- name: target-registry
description: The target container registry and path where to build the image
default: docker.io/salaboy
- name: target-service
description: Name of the service that we want to build and publish
default: notifications-service
- name: target-version
description: the target version to build
default: 1.0.0-service-pipeline
workspaces:
- name: sources
description: Workspace where the git repo is prepared for building
- name: docker-credentials
description: Docker config secret
tasks:
- name: clone-repo
taskRef:
name: git-clone
params:
- name: url
value: $(params.gitRepository)
- name: revision
value: main
workspaces:
- name: output
workspace: sources
- name: build-publish
runAfter: [clone-repo]
workspaces:
- name: sources
workspace: sources
subPath: conference-application/$(params.target-service)
- name: dockerconfig
workspace: docker-credentials
params:
- name: target-version
value: $(params.target-version)
- name: target-service
value: $(params.target-service)
- name: context
value: $(params.context)
- name: target-registry
value: $(params.target-registry)
taskSpec:
params:
- name: target-version
description: the target version to build
default: 1.0.0-service-pipeline
- name: target-service
description: Name of the service that we want to build and publish
default: notifications-service
- name: context
description: The path to the docker context in the sources workspace
default: "."
- name: target-registry
description: The target container registry and path where to build the image
default: docker.io/salaboy
workspaces:
- name: sources
- name: dockerconfig
steps:
- name: package
image: ghcr.io/ko-build/ko:latest
script: |
#!/bin/sh
#set -ex
export KO_DOCKER_REPO=$(params.target-registry)
mkdir ~/.docker
cp $(workspaces.dockerconfig.path)/.dockerconfigjson ~/.docker/config.json
cd $(workspaces.sources.path)
cd $(params.context)
ko build -t $(params.target-version) .
# - name: build-publish #NOT WORKING -> ISSUE: https://github.com/tektoncd/catalog/issues/1192
# runAfter:
# - clone-repo
# taskRef:
# name: ko
# params:
# - name: KO_DOCKER_REPO
# value: $(params.target-registry)
# - name: main
# value: $(params.context)
# - name: extra-args
# value: ["-t", $(params.target-version)]
# workspaces:
# - name: source
# workspace: sources
# subPath: "conference-application/notifications-service/"
# - name: dockerconfig
# workspace: docker-credentials