mirror of
https://github.com/bvanroll/cicdTest.git
synced 2025-08-29 12:02:47 +00:00
pipeline now uses 2 git branches for same application
This commit is contained in:
@@ -27,7 +27,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: front-end
|
||||
image: beppev/server-a:latest
|
||||
image: beppev/server-a:master
|
||||
imagePullPolicy: "Always"
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
@@ -55,7 +55,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: front-end
|
||||
image: beppev/server-b:latest
|
||||
image: beppev/server-b:master
|
||||
imagePullPolicy: "Always"
|
||||
ports:
|
||||
- containerPort: 6000
|
||||
@@ -63,7 +63,7 @@ spec:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: server-c
|
||||
name: server-b-test
|
||||
namespace: istio-project-1
|
||||
spec:
|
||||
replicas: 1
|
||||
@@ -83,7 +83,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: front-end
|
||||
image: beppev/server-c:latest
|
||||
image: beppev/server-b:experimental
|
||||
imagePullPolicy: "Always"
|
||||
ports:
|
||||
- containerPort: 6000
|
||||
|
@@ -21,8 +21,19 @@ metadata:
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
- "apps"
|
||||
- "deploy"
|
||||
- "networking.istio.io"
|
||||
resources:
|
||||
- "*"
|
||||
- pods
|
||||
- serviceaccounts
|
||||
- namespaces
|
||||
- services
|
||||
- deployments
|
||||
- deployments.apps
|
||||
- destinationrules
|
||||
- gateways
|
||||
- virtualservices
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
@@ -48,7 +59,7 @@ subjects:
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: PipelineResource
|
||||
metadata:
|
||||
name: git
|
||||
name: git-master
|
||||
namespace: tekton-pipeline-istio-project-1
|
||||
spec:
|
||||
type: git
|
||||
@@ -59,6 +70,19 @@ spec:
|
||||
value: git://github.com/beppevanrolleghem/cicdTest
|
||||
---
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: PipelineResource
|
||||
metadata:
|
||||
name: git-experimental
|
||||
namespace: tekton-pipeline-istio-project-1
|
||||
spec:
|
||||
type: git
|
||||
params:
|
||||
- name: revision
|
||||
value: experimental
|
||||
- name: url
|
||||
value: git://github.com/beppevanrolleghem/cicdTest
|
||||
---
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: build-and-push
|
||||
@@ -69,14 +93,13 @@ spec:
|
||||
- name: git-source
|
||||
type: git
|
||||
params:
|
||||
- name: pathToContext
|
||||
- name: context
|
||||
description: The path to the build context, used by Kaniko - within the workspace
|
||||
default: .
|
||||
- name: pathToDockerfile
|
||||
description: self explanitory
|
||||
default: Dockerfile
|
||||
- name: imageUrl
|
||||
- name: image-name
|
||||
description: dockerhub url
|
||||
- name: version
|
||||
description: image-version (for instance latest or beta)
|
||||
steps:
|
||||
- name: build-and-push
|
||||
image: gcr.io/kaniko-project/executor
|
||||
@@ -86,29 +109,28 @@ spec:
|
||||
command:
|
||||
- /kaniko/executor
|
||||
args:
|
||||
- "--dockerfile=dockerfile"
|
||||
- "--destination=beppev/$(inputs.params.imageUrl):latest"
|
||||
- "--dockerfile=$(inputs.resources.git-source.path)/$(inputs.params.pathToContext)/dockerfile"
|
||||
- "--destination=beppev/$(inputs.params.image-name):$(inputs.params.version)"
|
||||
- "--context=$(inputs.resources.git-source.path)/$(inputs.params.pathToContext)/"
|
||||
---
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: deploy-application
|
||||
namespace: tekton-pipeline-istio-project-1
|
||||
spec:
|
||||
inputs:
|
||||
resources:
|
||||
- name: git-source
|
||||
type: git
|
||||
params:
|
||||
- name: pathToContext
|
||||
description: The path to the build context, used by Kaniko - within the workspace
|
||||
default: .
|
||||
- name: pathToYamlFile
|
||||
description: The path to the yaml file to deploy within the git source
|
||||
default: deploy.yaml
|
||||
steps:
|
||||
- name: deploy-app
|
||||
- name: delete-old-deployment
|
||||
image: lachlanevenson/k8s-kubectl
|
||||
command: ["kubectl"]
|
||||
args:
|
||||
- "delete"
|
||||
- "-f"
|
||||
- "$(inputs.resources.git-source.path)/deploy.yaml"
|
||||
- name: deploy-new-app
|
||||
image: lachlanevenson/k8s-kubectl
|
||||
command: ["kubectl"]
|
||||
args:
|
||||
@@ -116,7 +138,6 @@ spec:
|
||||
- "-f"
|
||||
- "$(inputs.resources.git-source.path)/deploy.yaml"
|
||||
---
|
||||
# TODO fix deze pipeline eerst
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
@@ -124,54 +145,62 @@ metadata:
|
||||
namespace: tekton-pipeline-istio-project-1
|
||||
spec:
|
||||
resources:
|
||||
- name: git-source
|
||||
- name: git-master
|
||||
type: git
|
||||
- name: git-experimental
|
||||
type: git
|
||||
tasks:
|
||||
- name: build-and-push-a
|
||||
taskRef:
|
||||
name: build-and-push
|
||||
params:
|
||||
- name: pathToContext
|
||||
- name: context
|
||||
value: "serverA"
|
||||
- name: imageUrl
|
||||
- name: image-name
|
||||
value: "server-a"
|
||||
- name: version
|
||||
value: "master"
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
||||
- name: build-and-push-b
|
||||
resource: git-master
|
||||
- name: build-and-push-b-stable
|
||||
taskRef:
|
||||
name: build-and-push
|
||||
runAfter:
|
||||
- build-and-push-a
|
||||
params:
|
||||
- name: pathToContext
|
||||
- name: context
|
||||
value: "serverB"
|
||||
- name: imageUrl
|
||||
- name: image-name
|
||||
value: "server-b"
|
||||
- name: version
|
||||
value: "master"
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
||||
- name: build-and-push-c
|
||||
resource: git-master
|
||||
- name: build-and-push-b-experimental
|
||||
taskRef:
|
||||
name: build-and-push
|
||||
runAfter:
|
||||
- build-and-push-b
|
||||
params:
|
||||
- name: pathToContext
|
||||
value: "serverC"
|
||||
- name: imageUrl
|
||||
value: "server-c"
|
||||
- name: context
|
||||
value: "serverB"
|
||||
- name: image-name
|
||||
value: "server-b"
|
||||
- name: version
|
||||
value: "experimental"
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
||||
resource: git-experimental
|
||||
- name: build-and-push-d
|
||||
taskRef:
|
||||
name: build-and-push
|
||||
runAfter:
|
||||
- build-and-push-c
|
||||
- build-and-push-b-experimental
|
||||
params:
|
||||
- name: pathToContext
|
||||
value: "serverD"
|
||||
@@ -180,7 +209,7 @@ spec:
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
||||
resource: git-master
|
||||
- name: deploy-application
|
||||
taskRef:
|
||||
name: deploy-application
|
||||
@@ -194,4 +223,4 @@ spec:
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
||||
resource: git-master
|
||||
|
Reference in New Issue
Block a user