Skip to content

Commit

Permalink
chore: Join Kaniko task for ECR and Harbor into one (#47)
Browse files Browse the repository at this point in the history
Jira EPMDEDP-12618
Related #47

Change-Id: I2174845e6c8351e891c451f25213a1a873c55aba
  • Loading branch information
Mykola Serdiuk committed Oct 12, 2023
1 parent b37b165 commit 2d1d4c0
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 3,232 deletions.
34 changes: 3 additions & 31 deletions charts/pipelines-library/templates/pipelines/_common_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,4 @@
{{- define "build-pipeline-docker-image-build-push-common" -}}
{{- if eq .Values.global.dockerRegistry.type "ecr" }}
- name: create-ecr-repository
taskRef:
kind: Task
name: create-ecr-repository
runAfter:
- dockerfile-lint
params:
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- create-ecr-repository
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
- name: IMAGE_TAR
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}

{{- if or (eq .Values.global.dockerRegistry.type "harbor") (eq .Values.global.dockerRegistry.type "dockerhub") }}
- name: kaniko-build
taskRef:
kind: Task
Expand All @@ -42,8 +12,10 @@
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

workspaces:
- name: source
workspace: shared-workspace
{{- end }}
{{- end -}}
33 changes: 2 additions & 31 deletions charts/pipelines-library/templates/pipelines/_common_dotnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -382,36 +382,6 @@
{{- end -}}

{{- define "build-pipeline-dotnet-image-build-push-common" -}}
{{- if eq .Values.global.dockerRegistry.type "ecr" }}
- name: create-ecr-repository
taskRef:
kind: Task
name: create-ecr-repository
runAfter:
- dotnet-publish
params:
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- create-ecr-repository
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
- name: IMAGE_TAR
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}

{{- if or (eq .Values.global.dockerRegistry.type "harbor") (eq .Values.global.dockerRegistry.type "dockerhub") }}
- name: kaniko-build
taskRef:
kind: Task
Expand All @@ -425,8 +395,9 @@
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}
{{- end -}}
33 changes: 2 additions & 31 deletions charts/pipelines-library/templates/pipelines/_common_go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,36 +64,6 @@
{{- end -}}

{{- define "build-pipeline-golang-image-build-push-common" -}}
{{- if eq .Values.global.dockerRegistry.type "ecr" }}
- name: create-ecr-repository
taskRef:
kind: Task
name: create-ecr-repository
runAfter:
- build
params:
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- create-ecr-repository
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
- name: IMAGE_TAR
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}

{{- if or (eq .Values.global.dockerRegistry.type "harbor") (eq .Values.global.dockerRegistry.type "dockerhub") }}
- name: kaniko-build
taskRef:
kind: Task
Expand All @@ -107,10 +77,11 @@
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}
{{- end -}}

{{- define "golang-review-common" -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,36 +191,6 @@
{{- end -}}

{{- define "build-pipeline-java-gradle-image-build-push-common" -}}
{{- if eq .Values.global.dockerRegistry.type "ecr" }}
- name: create-ecr-repository
taskRef:
kind: Task
name: create-ecr-repository
runAfter:
- push
params:
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- create-ecr-repository
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
- name: IMAGE_TAR
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}

{{- if or (eq .Values.global.dockerRegistry.type "harbor") (eq .Values.global.dockerRegistry.type "dockerhub") }}
- name: kaniko-build
taskRef:
kind: Task
Expand All @@ -234,8 +204,9 @@
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -259,46 +259,13 @@
{{- end -}}

{{- define "build-pipeline-java-maven-image-build-push-common" -}}
{{- if eq .Values.global.dockerRegistry.type "ecr" }}
- name: create-ecr-repository
taskRef:
kind: Task
name: create-ecr-repository
runAfter:
- push
params:
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- get-maven-module
- create-ecr-repository
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
- name: IMAGE_TAR
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
- name: CONTEXT
value: "$(tasks.get-maven-module.results.DEPLOYABLE_MODULE_DIR)"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}

{{- if or (eq .Values.global.dockerRegistry.type "harbor") (eq .Values.global.dockerRegistry.type "dockerhub") }}
- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- push
- get-maven-module
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
Expand All @@ -308,8 +275,9 @@
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
- name: CONTEXT
value: "$(tasks.get-maven-module.results.DEPLOYABLE_MODULE_DIR)"
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}
{{- end -}}
64 changes: 2 additions & 62 deletions charts/pipelines-library/templates/pipelines/_common_js_npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,36 +239,6 @@
{{- end -}}

{{- define "build-pipeline-js-image-build-push-common" -}}
{{- if eq .Values.global.dockerRegistry.type "ecr" }}
- name: create-ecr-repository
taskRef:
kind: Task
name: create-ecr-repository
runAfter:
- push
params:
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- create-ecr-repository
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
- name: IMAGE_TAR
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}

{{- if or (eq .Values.global.dockerRegistry.type "harbor") (eq .Values.global.dockerRegistry.type "dockerhub") }}
- name: kaniko-build
taskRef:
kind: Task
Expand All @@ -285,40 +255,9 @@
workspaces:
- name: source
workspace: shared-workspace
{{- end }}
{{- end -}}

{{- define "build-pipeline-antora-image-build-push-common" -}}
{{- if eq .Values.global.dockerRegistry.type "ecr" }}
- name: create-ecr-repository
taskRef:
kind: Task
name: create-ecr-repository
runAfter:
- build
params:
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- create-ecr-repository
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
- name: IMAGE_TAR
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}

{{- if or (eq .Values.global.dockerRegistry.type "harbor") (eq .Values.global.dockerRegistry.type "dockerhub") }}
- name: kaniko-build
taskRef:
kind: Task
Expand All @@ -332,8 +271,9 @@
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}
{{- end -}}
33 changes: 2 additions & 31 deletions charts/pipelines-library/templates/pipelines/_common_python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,36 +162,6 @@
{{- end -}}

{{- define "build-pipeline-python-image-build-push-common" -}}
{{- if eq .Values.global.dockerRegistry.type "ecr" }}
- name: create-ecr-repository
taskRef:
kind: Task
name: create-ecr-repository
runAfter:
- push
params:
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"

- name: kaniko-build
taskRef:
kind: Task
name: kaniko
runAfter:
- create-ecr-repository
params:
- name: IMAGE
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME):$(tasks.get-version.results.IS_TAG)"
- name: IMAGE_TAR
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}

{{- if or (eq .Values.global.dockerRegistry.type "harbor") (eq .Values.global.dockerRegistry.type "dockerhub") }}
- name: kaniko-build
taskRef:
kind: Task
Expand All @@ -205,8 +175,9 @@
value: "$(params.CODEBASE_NAME)_$(tasks.get-version.results.IS_TAG)"
- name: KANIKO_CACHE_REPO
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/kaniko-cache"
- name: REPO_NAME
value: "$(tasks.init-values.results.DOCKER_REGISTRY_HOST)/$(params.CODEBASE_NAME)"
workspaces:
- name: source
workspace: shared-workspace
{{- end }}
{{- end -}}
Loading

0 comments on commit 2d1d4c0

Please sign in to comment.