12 changed files with 191 additions and 13 deletions
@ -0,0 +1,18 @@ |
|||
apiVersion: tekton.dev/v1beta1 |
|||
kind: TaskRun |
|||
metadata: |
|||
generateName: buildah- |
|||
spec: |
|||
serviceAccountName: tekton-robot |
|||
taskRef: |
|||
name: buildah |
|||
params: |
|||
- name: outputContainerImage |
|||
value: image-registry.openshift-image-registry.svc:5000/demo-appdev/function |
|||
workspaces: |
|||
- emptyDir: {} |
|||
name: src |
|||
- emptyDir: {} |
|||
name: containers |
|||
debug: |
|||
breakpoint: ["onFailure"] |
|||
@ -0,0 +1,16 @@ |
|||
apiVersion: tekton.dev/v1beta1 |
|||
kind: TaskRun |
|||
metadata: |
|||
generateName: deploy- |
|||
spec: |
|||
serviceAccountName: tekton-robot |
|||
taskRef: |
|||
name: deploy |
|||
params: |
|||
- name: imageDigest |
|||
value: sha256:7977a31c6829d4629698ae5f3dcd5691e90f83bed1b336bff16d2afafa12cba4 |
|||
workspaces: |
|||
- emptyDir: {} |
|||
name: src |
|||
debug: |
|||
breakpoint: ["onFailure"] |
|||
@ -0,0 +1,5 @@ |
|||
images: |
|||
- path: spec/template/spec/containers/image |
|||
kind: Service |
|||
version: serving.knative.dev/v1 |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
apiVersion: serving.knative.dev/v1 |
|||
kind: Service |
|||
metadata: |
|||
name: function |
|||
spec: |
|||
template: |
|||
spec: |
|||
containers: |
|||
- image: image-registry.openshift-image-registry.svc:5000/demo-appdev/function |
|||
env: |
|||
- name: TODO |
|||
value: "TODO" |
|||
@ -0,0 +1,17 @@ |
|||
resources: |
|||
- imagestream.yaml |
|||
- pipeline.yaml |
|||
- rolebinding.yaml |
|||
- role.yaml |
|||
- serviceaccount.yaml |
|||
- task-buildah.yaml |
|||
- task-deploy.yaml |
|||
- task-git-clone.yaml |
|||
- task-maven-package.yaml |
|||
- knative-service.yaml |
|||
images: |
|||
- name: image-registry.openshift-image-registry.svc:5000/demo-appdev/function |
|||
configurations: |
|||
- knative-image-transformer.yaml |
|||
apiVersion: kustomize.config.k8s.io/v1beta1 |
|||
kind: Kustomization |
|||
@ -1,11 +1,23 @@ |
|||
apiVersion: rbac.authorization.k8s.io/v1 |
|||
kind: RoleBinding |
|||
metadata: |
|||
name: tekton-robot |
|||
name: tekton-robot-scc |
|||
subjects: |
|||
- kind: ServiceAccount |
|||
name: tekton-robot |
|||
roleRef: |
|||
apiGroup: rbac.authorization.k8s.io |
|||
kind: Role |
|||
name: tekton-robot-scc |
|||
--- |
|||
apiVersion: rbac.authorization.k8s.io/v1 |
|||
kind: RoleBinding |
|||
metadata: |
|||
name: tekton-robot-pusher |
|||
subjects: |
|||
- kind: ServiceAccount |
|||
name: tekton-robot |
|||
roleRef: |
|||
apiGroup: rbac.authorization.k8s.io |
|||
kind: ClusterRole |
|||
name: system:image-builder |
|||
|
|||
@ -0,0 +1,61 @@ |
|||
apiVersion: tekton.dev/v1beta1 |
|||
kind: Task |
|||
metadata: |
|||
name: deploy |
|||
spec: |
|||
params: |
|||
- name: kustomizeImage |
|||
type: string |
|||
default: k8s.gcr.io/kustomize/kustomize:v4.5.5 |
|||
- name: gitImage |
|||
type: string |
|||
default: docker.io/alpine/git:v2.26.2 |
|||
- name: imageDigest |
|||
description: The digest of the last built image |
|||
workspaces: |
|||
- name: src |
|||
mountPath: /src |
|||
steps: |
|||
- name: kustomize |
|||
image: $(params.kustomizeImage) |
|||
workingDir: /src/k8s |
|||
env: |
|||
- name: IMAGE_DIGEST |
|||
value: "$(params.imageDigest)" |
|||
script: | |
|||
#!/bin/bash |
|||
|
|||
set -Eeuo pipefail |
|||
|
|||
echo "=========================================================" |
|||
echo " kustomize edit set image" |
|||
echo "=========================================================" |
|||
echo |
|||
|
|||
echo "Setting image tag to digest $IMAGE_DIGEST..." |
|||
echo |
|||
|
|||
kustomize edit set image function@$IMAGE_DIGEST |
|||
|
|||
exit 0 |
|||
- name: git-push |
|||
image: $(params.gitImage) |
|||
workingDir: /src |
|||
env: |
|||
- name: IMAGE_DIGEST |
|||
value: "$(params.imageDigest)" |
|||
script: | |
|||
#!/bin/bash |
|||
|
|||
set -Eeuo pipefail |
|||
|
|||
echo "=========================================================" |
|||
echo " git push" |
|||
echo "=========================================================" |
|||
echo |
|||
|
|||
git add k8s/kustomization.yaml |
|||
git commit -m 'deploy image $IMAGE_DIGEST' |
|||
git push |
|||
|
|||
exit 0 |
|||
Loading…
Reference in new issue