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