diff --git a/charts/pipelines-library/templates/pipelines/_common_java_gradle.yaml b/charts/pipelines-library/templates/pipelines/_common_java_gradle.yaml index b5ce133f..bb57cf6d 100644 --- a/charts/pipelines-library/templates/pipelines/_common_java_gradle.yaml +++ b/charts/pipelines-library/templates/pipelines/_common_java_gradle.yaml @@ -1,29 +1,24 @@ {{- define "java-gradle-build-common" -}} -- name: test +- name: build taskRef: kind: Task - name: gradle + name: edp-gradle runAfter: - - compile + - get-cache + - update-build-number params: - name: BASE_IMAGE value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - test \ - jacocoTestReport workspaces: - name: source workspace: shared-workspace - subPath: source - name: sonar taskRef: kind: Task name: gradle runAfter: - - test + - build params: - name: BASE_IMAGE value: $(params.sonar_image) @@ -40,24 +35,6 @@ workspace: shared-workspace subPath: source -- name: build - taskRef: - kind: Task - name: gradle - runAfter: - - sonar - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - build -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - - name: get-nexus-repository-url taskRef: kind: Task @@ -75,7 +52,7 @@ kind: Task name: gradle runAfter: - - build + - sonar - get-nexus-repository-url params: - name: BASE_IMAGE @@ -92,44 +69,18 @@ {{- end -}} {{- define "java-gradle-review-common" -}} -- name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - init-values - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - -- name: test +- name: build taskRef: kind: Task - name: gradle + name: edp-gradle runAfter: - - compile + - get-cache params: - name: BASE_IMAGE value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - test \ - jacocoTestReport workspaces: - name: source workspace: shared-workspace - subPath: source # The fetch-target-branch Task will fetch the target branch during the code-review pipeline # because the fetch-repository Task fetches only user changes. @@ -138,7 +89,7 @@ kind: Task name: git-cli runAfter: - - test + - build params: - name: GIT_USER_EMAIL value: edp-ci@edp.ci-user diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-default.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-default.yaml index f9b89d10..9a669d72 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-default.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-default.yaml @@ -79,6 +79,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -99,30 +101,12 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} {{- include "build-pipeline-java-gradle-image-build-push-common" $ | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-end" . | nindent 4 }} {{ include "finally-block-default" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-edp.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-edp.yaml index c1dc3e71..187ced74 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-edp.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-edp.yaml @@ -73,6 +73,8 @@ spec: - name: CODEBASEBRANCH_NAME value: $(params.CODEBASEBRANCH_NAME) +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -97,30 +99,12 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} {{- include "build-pipeline-java-gradle-image-build-push-common" $ | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-end" . | nindent 4 }} {{ include "finally-block-edp" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-lib-default.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-lib-default.yaml index 2abebc2b..4db5f4f7 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-lib-default.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-lib-default.yaml @@ -79,6 +79,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -99,28 +101,10 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-lib-end" . | nindent 4 }} {{ include "finally-block-default" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-lib-edp.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-lib-edp.yaml index 5d705742..66f0b440 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-lib-edp.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-build-lib-edp.yaml @@ -73,6 +73,8 @@ spec: - name: CODEBASEBRANCH_NAME value: $(params.CODEBASEBRANCH_NAME) +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -97,28 +99,10 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-lib-end" . | nindent 4 }} {{ include "finally-block-edp" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-review-lib.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-review-lib.yaml index cbd6e511..6a13c818 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-review-lib.yaml @@ -51,8 +51,12 @@ spec: {{- include "gerrit-review-start" $ | nindent 4 }} +{{- include "get-cache" $ | nindent 4 }} + {{ include "java-gradle-review-common" . | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "gerrit-review-vote" $ | nindent 2 }} --- diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-review.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-review.yaml index 125375ad..c98efd75 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-review.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gerrit-review.yaml @@ -59,25 +59,9 @@ spec: {{- include "helm-docs" $ | nindent 4 }} -{{ include "java-gradle-review-common" . | nindent 4 }} +{{- include "get-cache" $ | nindent 4 }} - - name: build - taskRef: - kind: Task - name: gradle - runAfter: - - sonar - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - build -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source +{{ include "java-gradle-review-common" . | nindent 4 }} - name: dockerfile-lint taskRef: @@ -108,6 +92,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "save-cache" $ | nindent 4 }} + {{ include "gerrit-review-vote" $ | nindent 2 }} --- diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/github-build-default.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/github-build-default.yaml index 0f79de0a..a57627dd 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/github-build-default.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/github-build-default.yaml @@ -75,6 +75,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -93,30 +95,12 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} {{- include "build-pipeline-java-gradle-image-build-push-common" $ | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-end" . | nindent 4 }} {{ include "finally-block-default" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/github-build-edp.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/github-build-edp.yaml index ebe304d1..97660333 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/github-build-edp.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/github-build-edp.yaml @@ -69,6 +69,8 @@ spec: - name: CODEBASEBRANCH_NAME value: $(params.CODEBASEBRANCH_NAME) +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -91,30 +93,12 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} {{- include "build-pipeline-java-gradle-image-build-push-common" $ | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-end" . | nindent 4 }} {{ include "finally-block-edp" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/github-build-lib-default.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/github-build-lib-default.yaml index 15239eb2..5435e684 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/github-build-lib-default.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/github-build-lib-default.yaml @@ -75,6 +75,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -93,28 +95,10 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-lib-end" . | nindent 4 }} {{ include "finally-block-default" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/github-build-lib-edp.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/github-build-lib-edp.yaml index 27ee5b28..6c3751c8 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/github-build-lib-edp.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/github-build-lib-edp.yaml @@ -69,6 +69,8 @@ spec: - name: CODEBASEBRANCH_NAME value: $(params.CODEBASEBRANCH_NAME) +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -91,28 +93,10 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-lib-end" . | nindent 4 }} {{ include "finally-block-edp" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/github-review-lib.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/github-review-lib.yaml index 22eebe41..fe1aec55 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/github-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/github-review-lib.yaml @@ -54,51 +54,27 @@ spec: {{- include "github-review-start" $ | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - init-values - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source +{{- include "get-cache" $ | nindent 4 }} - - name: test + - name: build taskRef: kind: Task - name: gradle + name: edp-gradle runAfter: - - compile + - get-cache params: - name: BASE_IMAGE value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - test \ - jacocoTestReport workspaces: - name: source workspace: shared-workspace - subPath: source - name: sonar taskRef: kind: Task name: gradle runAfter: - - test + - build params: - name: BASE_IMAGE value: $(params.sonar_image) @@ -115,6 +91,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "save-cache" $ | nindent 4 }} + {{ include "github-review-vote" $ | nindent 2 }} --- diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/github-review.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/github-review.yaml index 8799a2ec..7c1dfcc3 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/github-review.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/github-review.yaml @@ -62,51 +62,27 @@ spec: {{- include "helm-docs" $ | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - init-values - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source +{{- include "get-cache" $ | nindent 4 }} - - name: test + - name: build taskRef: kind: Task - name: gradle + name: edp-gradle runAfter: - - compile + - get-cache params: - name: BASE_IMAGE value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - test \ - jacocoTestReport workspaces: - name: source workspace: shared-workspace - subPath: source - name: sonar taskRef: kind: Task name: gradle runAfter: - - test + - build params: - name: BASE_IMAGE value: $(params.sonar_image) @@ -123,24 +99,6 @@ spec: workspace: shared-workspace subPath: source - - name: build - taskRef: - kind: Task - name: gradle - runAfter: - - sonar - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - build -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - - name: dockerfile-lint taskRef: kind: Task @@ -170,6 +128,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "save-cache" $ | nindent 4 }} + {{ include "github-review-vote" $ | nindent 2 }} --- diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-default.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-default.yaml index 7115449e..06edee6e 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-default.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-default.yaml @@ -75,6 +75,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -93,30 +95,12 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} {{- include "build-pipeline-java-gradle-image-build-push-common" $ | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-end" . | nindent 4 }} {{ include "finally-block-default" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-edp.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-edp.yaml index 9355f190..5b96012b 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-edp.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-edp.yaml @@ -69,6 +69,8 @@ spec: - name: CODEBASEBRANCH_NAME value: $(params.CODEBASEBRANCH_NAME) +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -91,30 +93,12 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} {{- include "build-pipeline-java-gradle-image-build-push-common" $ | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-end" . | nindent 4 }} {{ include "finally-block-edp" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-lib-default.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-lib-default.yaml index 8a88c4dc..6c549e0d 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-lib-default.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-lib-default.yaml @@ -75,6 +75,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -93,28 +95,10 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-lib-end" . | nindent 4 }} {{ include "finally-block-default" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-lib-edp.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-lib-edp.yaml index 022f58f6..09648592 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-lib-edp.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-build-lib-edp.yaml @@ -69,6 +69,8 @@ spec: - name: CODEBASEBRANCH_NAME value: $(params.CODEBASEBRANCH_NAME) +{{- include "get-cache" $ | nindent 4 }} + - name: update-build-number taskRef: kind: Task @@ -91,28 +93,10 @@ spec: {{ include "security-edp" . | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - security - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - {{ include "java-gradle-build-common" . | nindent 4 }} +{{- include "save-cache" $ | nindent 4 }} + {{ include "build-pipeline-lib-end" . | nindent 4 }} {{ include "finally-block-edp" . | nindent 2 }} diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-review-lib.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-review-lib.yaml index 25dd1e10..56fadaff 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-review-lib.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-review-lib.yaml @@ -51,51 +51,27 @@ spec: {{- include "gitlab-review-start" $ | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - init-values - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source +{{- include "get-cache" $ | nindent 4 }} - - name: test + - name: build taskRef: kind: Task - name: gradle + name: edp-gradle runAfter: - - compile + - get-cache params: - name: BASE_IMAGE value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - test \ - jacocoTestReport workspaces: - name: source workspace: shared-workspace - subPath: source - name: sonar taskRef: kind: Task name: gradle runAfter: - - test + - build params: - name: BASE_IMAGE value: $(params.sonar_image) @@ -112,6 +88,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "save-cache" $ | nindent 4 }} + {{ include "gitlab-review-vote" $ | nindent 2 }} --- diff --git a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-review.yaml b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-review.yaml index 77e932ee..b4ff4fcc 100644 --- a/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-review.yaml +++ b/charts/pipelines-library/templates/pipelines/java/gradle/gitlab-review.yaml @@ -59,51 +59,27 @@ spec: {{- include "helm-docs" $ | nindent 4 }} - - name: compile - taskRef: - kind: Task - name: gradle - runAfter: - - init-values - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - clean \ - compileJava \ - -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source +{{- include "get-cache" $ | nindent 4 }} - - name: test + - name: build taskRef: kind: Task - name: gradle + name: edp-gradle runAfter: - - compile + - get-cache params: - name: BASE_IMAGE value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - test \ - jacocoTestReport workspaces: - name: source workspace: shared-workspace - subPath: source - name: sonar taskRef: kind: Task name: gradle runAfter: - - test + - build params: - name: BASE_IMAGE value: $(params.sonar_image) @@ -120,24 +96,6 @@ spec: workspace: shared-workspace subPath: source - - name: build - taskRef: - kind: Task - name: gradle - runAfter: - - sonar - params: - - name: BASE_IMAGE - value: $(params.image) - - name: EXTRA_ARGS - value: | - -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ - build -x test - workspaces: - - name: source - workspace: shared-workspace - subPath: source - - name: dockerfile-lint taskRef: kind: Task @@ -167,6 +125,8 @@ spec: workspace: shared-workspace subPath: source +{{- include "save-cache" $ | nindent 4 }} + {{ include "gitlab-review-vote" $ | nindent 2 }} --- diff --git a/charts/pipelines-library/templates/tasks/edp-gradle.yaml b/charts/pipelines-library/templates/tasks/edp-gradle.yaml new file mode 100644 index 00000000..05d8ffdd --- /dev/null +++ b/charts/pipelines-library/templates/tasks/edp-gradle.yaml @@ -0,0 +1,169 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: edp-gradle + labels: + app.kubernetes.io/version: "0.2" + annotations: + tekton.dev/pipelines.minVersion: "0.12.1" + tekton.dev/displayName: Gradle + tekton.dev/categories: Build Tools + tekton.dev/tags: build-tool + tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le" +spec: + description: >- + This Task can be used to run a Gradle build. + + workspaces: + - name: source + description: The workspace consisting of the gradle project. + params: + - name: BASE_IMAGE + description: Gradle base image. + type: string + default: gradle:7.5.1-jdk11 + - name: PROJECT_DIR + description: The directory containing build.gradle + type: string + default: "source" + - name: TASKS + description: 'The gradle tasks to run (default: build)' + type: array + default: + - build + - name: ci-nexus + type: string + description: name of the secret for the Nexus integration + default: ci-nexus + - name: ci-sonarqube + type: string + description: name of the secret for the Sonarqube integration + default: "ci-sonarqube" + - name: EXTRA_ARGS + description: Extra arguments to add to the gradle build + default: | + -Dorg.gradle.internal.publish.checksums.insecure=true \ + publish + - name: GRADLE_USER_CACHE + description: Gradle user cache directory + default: /workspace/source/cache + volumes: + - name: settings-gradle + configMap: + name: custom-gradle-settings + steps: + - name: compile + image: $(params.BASE_IMAGE) + volumeMounts: + - name: settings-gradle + mountPath: /var/configmap + workingDir: $(workspaces.source.path)/$(params.PROJECT_DIR) + script: | + #!/bin/bash + set -e + + gradle \ + -I \ + /var/configmap/init.gradle \ + -PnexusLogin=${CI_USERNAME} \ + -PnexusPassword=${CI_PASSWORD} \ + -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ + clean \ + compileJava \ + -x test + env: + - name: XDG_CONFIG_HOME + value: $(workspaces.source.path)/$(params.PROJECT_DIR) + - name: GRADLE_USER_HOME + value: $(params.GRADLE_USER_CACHE) + - name: CI_USERNAME + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: username + - name: CI_PASSWORD + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: password + - name: NEXUS_HOST_URL + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: url + - name: test + image: $(params.BASE_IMAGE) + volumeMounts: + - name: settings-gradle + mountPath: /var/configmap + workingDir: $(workspaces.source.path)/$(params.PROJECT_DIR) + script: | + #!/bin/bash + set -e + + gradle \ + -I \ + /var/configmap/init.gradle \ + -PnexusLogin=${CI_USERNAME} \ + -PnexusPassword=${CI_PASSWORD} \ + -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ + test \ + jacocoTestReport + env: + - name: XDG_CONFIG_HOME + value: $(workspaces.source.path)/$(params.PROJECT_DIR) + - name: GRADLE_USER_HOME + value: $(params.GRADLE_USER_CACHE) + - name: CI_USERNAME + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: username + - name: CI_PASSWORD + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: password + - name: NEXUS_HOST_URL + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: url + - name: build + image: $(params.BASE_IMAGE) + volumeMounts: + - name: settings-gradle + mountPath: /var/configmap + workingDir: $(workspaces.source.path)/$(params.PROJECT_DIR) + script: | + #!/bin/bash + set -e + + gradle \ + -I \ + /var/configmap/init.gradle \ + -PnexusLogin=${CI_USERNAME} \ + -PnexusPassword=${CI_PASSWORD} \ + -PnexusMavenRepositoryUrl=${NEXUS_HOST_URL}/repository/edp-maven-group \ + build -x test + env: + - name: XDG_CONFIG_HOME + value: $(workspaces.source.path)/$(params.PROJECT_DIR) + - name: GRADLE_USER_HOME + value: $(params.GRADLE_USER_CACHE) + - name: CI_USERNAME + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: username + - name: CI_PASSWORD + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: password + - name: NEXUS_HOST_URL + valueFrom: + secretKeyRef: + name: $(params.ci-nexus) + key: url +{{- include "resources" . | nindent 6 }} diff --git a/charts/pipelines-library/tests/test_java_gradle_pipelines.py b/charts/pipelines-library/tests/test_java_gradle_pipelines.py index a93daaae..ad8b591d 100644 --- a/charts/pipelines-library/tests/test_java_gradle_pipelines.py +++ b/charts/pipelines-library/tests/test_java_gradle_pipelines.py @@ -27,27 +27,28 @@ def test_java_gradle_pipelines_harbor_gerrit(): assert "fetch-repository" in rt[0]["name"] assert "gerrit-notify" in rt[1]["name"] assert "init-values" in rt[2]["name"] - assert "compile" in rt[3]["name"] - assert "test" in rt[4]["name"] + assert "get-cache" in rt[3]["name"] + assert "build" in rt[4]["name"] assert "fetch-target-branch" in rt[5]["name"] assert "sonar-prepare-files" in rt[6]["name"] assert f"sonar-prepare-files-{buildtool}" == rt[6]["taskRef"]["name"] assert "sonar" in rt[7]["name"] + assert "save-cache" in rt[8]["name"] if cbtype == "app": assert "fetch-repository" in rt[0]["name"] assert "gerrit-notify" in rt[1]["name"] assert "init-values" in rt[2]["name"] assert "helm-docs" in rt[3]["name"] - assert "compile" in rt[4]["name"] - assert "test" in rt[5]["name"] + assert "get-cache" in rt[4]["name"] + assert "build" in rt[5]["name"] assert "fetch-target-branch" in rt[6]["name"] assert "sonar-prepare-files" in rt[7]["name"] assert f"sonar-prepare-files-{buildtool}" == rt[7]["taskRef"]["name"] assert "sonar" in rt[8]["name"] - assert "build" in rt[9]["name"] - assert "dockerfile-lint" in rt[10]["name"] - assert "dockerbuild-verify" in rt[11]["name"] - assert "helm-lint" in rt[12]["name"] + assert "dockerfile-lint" in rt[9]["name"] + assert "dockerbuild-verify" in rt[10]["name"] + assert "helm-lint" in rt[11]["name"] + assert "save-cache" in rt[12]["name"] assert "gerrit-vote-success" in r["pipeline"][gerrit_review_pipeline]["spec"]["finally"][0]["name"] assert "gerrit-vote-failure" in r["pipeline"][gerrit_review_pipeline]["spec"]["finally"][1]["name"] @@ -60,25 +61,23 @@ def test_java_gradle_pipelines_harbor_gerrit(): assert "get-version" in btd[3]["name"] # ensure we have default versioning assert f"get-version-default" == btd[3]["taskRef"]["name"] - assert "update-build-number" in btd[4]["name"] - assert "sonar-cleanup" in btd[5]["name"] - assert "security" in btd[6]["name"] - assert "compile" in btd[7]["name"] - assert buildtool == btd[7]["taskRef"]["name"] - assert "test" in btd[8]["name"] - assert buildtool == btd[8]["taskRef"]["name"] + assert "get-cache" in btd[4]["name"] + assert "update-build-number" in btd[5]["name"] + assert "sonar-cleanup" in btd[6]["name"] + assert "security" in btd[7]["name"] + assert "build" in btd[8]["name"] assert "sonar" in btd[9]["name"] assert buildtool == btd[9]["taskRef"]["name"] - assert "build" in btd[10]["name"] - assert buildtool == btd[10]["taskRef"]["name"] - assert "get-nexus-repository-url" in btd[11]["name"] - assert "push" in btd[12]["name"] - assert buildtool == btd[12]["taskRef"]["name"] + assert "get-nexus-repository-url" in btd[10]["name"] + assert "push" in btd[11]["name"] + assert buildtool == btd[11]["taskRef"]["name"] if cbtype == "app": - assert "kaniko-build" in btd[13]["name"] + assert "kaniko-build" in btd[12]["name"] + assert "save-cache" in btd[13]["name"] assert "git-tag" in btd[14]["name"] assert "update-cbis" in btd[15]["name"] else: + assert "save-cache" in btd[12]["name"] assert "git-tag" in btd[13]["name"] assert "push-to-jira" in r["pipeline"][gerrit_build_pipeline_def]["spec"]["finally"][0]["name"] @@ -89,32 +88,25 @@ def test_java_gradle_pipelines_harbor_gerrit(): assert "init-values" in btedp[2]["name"] assert "get-version" in btedp[3]["name"] assert "get-version-edp" == btedp[3]["taskRef"]["name"] - idx = 3 - # we have update-build-number only for gradle - if buildtool == "gradle": - assert "update-build-number" in btedp[4]["taskRef"]["name"] - assert f"update-build-number-{buildtool}" == btedp[4]["taskRef"]["name"] - idx = 4 - - assert "sonar-cleanup" in btedp[idx+1]["name"] - assert "security" in btedp[idx+2]["name"] - assert "compile" in btedp[idx+3]["name"] - assert buildtool == btedp[idx+3]["taskRef"]["name"] - assert "test" in btedp[idx+4]["name"] - assert buildtool == btedp[idx+4]["taskRef"]["name"] - assert "sonar" in btedp[idx+5]["name"] - assert buildtool == btedp[idx+5]["taskRef"]["name"] - assert "build" in btedp[idx+6]["name"] - assert buildtool == btedp[idx+6]["taskRef"]["name"] - assert "get-nexus-repository-url" in btedp[idx+7]["name"] - assert "push" in btedp[idx+8]["name"] - assert buildtool == btedp[idx+8]["taskRef"]["name"] + assert "get-cache" == btedp[4]["taskRef"]["name"] + assert "update-build-number" in btedp[5]["taskRef"]["name"] + assert f"update-build-number-{buildtool}" == btedp[5]["taskRef"]["name"] + assert "sonar-cleanup" in btedp[6]["name"] + assert "security" in btedp[7]["name"] + assert "build" in btedp[8]["name"] + assert "sonar" in btedp[9]["name"] + assert buildtool == btedp[9]["taskRef"]["name"] + assert "get-nexus-repository-url" in btedp[10]["name"] + assert "push" in btedp[11]["name"] + assert buildtool == btedp[11]["taskRef"]["name"] if cbtype == "app": - assert "kaniko-build" in btedp[idx+9]["name"] - assert "git-tag" in btedp[idx+10]["name"] - assert "update-cbis" in btedp[idx+11]["name"] + assert "kaniko-build" in btedp[12]["name"] + assert "save-cache" in btedp[13]["name"] + assert "git-tag" in btedp[14]["name"] + assert "update-cbis" in btedp[15]["name"] else: - assert "git-tag" in btedp[idx+9]["name"] + assert "save-cache" in btedp[12]["name"] + assert "git-tag" in btedp[13]["name"] assert "update-cbb" in r["pipeline"][gerrit_build_pipeline_edp]["spec"]["finally"][0]["name"] assert "push-to-jira" in r["pipeline"][gerrit_build_pipeline_edp]["spec"]["finally"][1]["name"] @@ -145,21 +137,22 @@ def test_java_gradle_pipelines_harbor_github(): assert "github-set-pending-status" in rt[0]["name"] assert "fetch-repository" in rt[1]["name"] assert "init-values" in rt[2]["name"] - assert "compile" in rt[3]["name"] - assert "test" in rt[4]["name"] + assert "get-cache" in rt[3]["name"] + assert "build" in rt[4]["name"] assert "sonar" in rt[5]["name"] + assert "save-cache" in rt[6]["name"] if cbtype == "app": assert "github-set-pending-status" in rt[0]["name"] assert "fetch-repository" in rt[1]["name"] assert "init-values" in rt[2]["name"] assert "helm-docs" in rt[3]["name"] - assert "compile" in rt[4]["name"] - assert "test" in rt[5]["name"] + assert "get-cache" in rt[4]["name"] + assert "build" in rt[5]["name"] assert "sonar" in rt[6]["name"] - assert "build" in rt[7]["name"] - assert "dockerfile-lint" in rt[8]["name"] - assert "dockerbuild-verify" in rt[9]["name"] - assert "helm-lint" in rt[10]["name"] + assert "dockerfile-lint" in rt[7]["name"] + assert "dockerbuild-verify" in rt[8]["name"] + assert "helm-lint" in rt[9]["name"] + assert "save-cache" in rt[10]["name"] assert "github-set-success-status" in r["pipeline"][github_review_pipeline]["spec"]["finally"][0]["name"] assert "github-set-failure-status" in r["pipeline"][github_review_pipeline]["spec"]["finally"][1]["name"] @@ -171,24 +164,22 @@ def test_java_gradle_pipelines_harbor_github(): assert "get-version" in btd[2]["name"] # ensure we have default versioning assert f"get-version-default" == btd[2]["taskRef"]["name"] - assert "update-build-number" in btd[3]["name"] - assert "security" in btd[4]["name"] - assert "compile" in btd[5]["name"] - assert buildtool == btd[5]["taskRef"]["name"] - assert "test" in btd[6]["name"] - assert buildtool == btd[6]["taskRef"]["name"] + assert "get-cache" in btd[3]["name"] + assert "update-build-number" in btd[4]["name"] + assert "security" in btd[5]["name"] + assert "build" in btd[6]["name"] assert "sonar" in btd[7]["name"] assert buildtool == btd[7]["taskRef"]["name"] - assert "build" in btd[8]["name"] - assert buildtool == btd[8]["taskRef"]["name"] - assert "get-nexus-repository-url" in btd[9]["name"] - assert "push" in btd[10]["name"] - assert buildtool == btd[10]["taskRef"]["name"] + assert "get-nexus-repository-url" in btd[8]["name"] + assert "push" in btd[9]["name"] + assert buildtool == btd[9]["taskRef"]["name"] if cbtype == "app": - assert "kaniko-build" in btd[11]["name"] + assert "kaniko-build" in btd[10]["name"] + assert "save-cache" in btd[11]["name"] assert "git-tag" in btd[12]["name"] assert "update-cbis" in btd[13]["name"] if cbtype == "lib": + assert "save-cache" in btd[10]["name"] assert "git-tag" in btd[11]["name"] assert "push-to-jira" in r["pipeline"][github_build_pipeline_def]["spec"]["finally"][0]["name"] @@ -198,24 +189,22 @@ def test_java_gradle_pipelines_harbor_github(): assert "init-values" in btedp[1]["name"] assert "get-version" in btedp[2]["name"] assert "get-version-edp" == btedp[2]["taskRef"]["name"] - assert "update-build-number" in btedp[3]["name"] - assert "security" in btedp[4]["name"] - assert "compile" in btedp[5]["name"] - assert buildtool == btedp[5]["taskRef"]["name"] - assert "test" in btedp[6]["name"] - assert buildtool == btedp[6]["taskRef"]["name"] + assert "get-cache" in btedp[3]["name"] + assert "update-build-number" in btedp[4]["name"] + assert "security" in btedp[5]["name"] + assert "build" in btedp[6]["name"] assert "sonar" in btedp[7]["name"] assert buildtool == btedp[7]["taskRef"]["name"] - assert "build" in btedp[8]["name"] - assert buildtool == btedp[8]["taskRef"]["name"] - assert "get-nexus-repository-url" in btedp[9]["name"] - assert "push" in btedp[10]["name"] - assert buildtool == btedp[10]["taskRef"]["name"] + assert "get-nexus-repository-url" in btedp[8]["name"] + assert "push" in btedp[9]["name"] + assert buildtool == btedp[9]["taskRef"]["name"] if cbtype == "app": - assert "kaniko-build" in btedp[11]["name"] + assert "kaniko-build" in btedp[10]["name"] + assert "save-cache" in btedp[11]["name"] assert "git-tag" in btedp[12]["name"] assert "update-cbis" in btedp[13]["name"] if cbtype == "lib": + assert "save-cache" in btedp[10]["name"] assert "git-tag" in btedp[11]["name"] assert "update-cbb" in r["pipeline"][github_build_pipeline_edp]["spec"]["finally"][0]["name"] assert "push-to-jira" in r["pipeline"][github_build_pipeline_edp]["spec"]["finally"][1]["name"] @@ -242,21 +231,22 @@ def test_java_gradle_pipelines_harbor_gitlab(): assert "report-pipeline-start-to-gitlab" in rt[0]["name"] assert "fetch-repository" in rt[1]["name"] assert "init-values" in rt[2]["name"] - assert "compile" in rt[3]["name"] - assert "test" in rt[4]["name"] + assert "get-cache" in rt[3]["name"] + assert "build" in rt[4]["name"] assert "sonar" in rt[5]["name"] + assert "save-cache" in rt[6]["name"] if cbtype == "app": assert "report-pipeline-start-to-gitlab" in rt[0]["name"] assert "fetch-repository" in rt[1]["name"] assert "init-values" in rt[2]["name"] assert "helm-docs" in rt[3]["name"] - assert "compile" in rt[4]["name"] - assert "test" in rt[5]["name"] + assert "get-cache" in rt[4]["name"] + assert "build" in rt[5]["name"] assert "sonar" in rt[6]["name"] - assert "build" in rt[7]["name"] - assert "dockerfile-lint" in rt[8]["name"] - assert "dockerbuild-verify" in rt[9]["name"] - assert "helm-lint" in rt[10]["name"] + assert "dockerfile-lint" in rt[7]["name"] + assert "dockerbuild-verify" in rt[8]["name"] + assert "helm-lint" in rt[9]["name"] + assert "save-cache" in rt[10]["name"] assert "gitlab-set-success-status" in r["pipeline"][gitlab_review_pipeline]["spec"]["finally"][0]["name"] assert "gitlab-set-failure-status" in r["pipeline"][gitlab_review_pipeline]["spec"]["finally"][1]["name"] @@ -267,24 +257,22 @@ def test_java_gradle_pipelines_harbor_gitlab(): assert "get-version" in btd[2]["name"] # ensure we have default versioning assert f"get-version-default" == btd[2]["taskRef"]["name"] - assert "update-build-number" in btd[3]["name"] - assert "security" in btd[4]["name"] - assert "compile" in btd[5]["name"] - assert buildtool == btd[5]["taskRef"]["name"] - assert "test" in btd[6]["name"] - assert buildtool == btd[6]["taskRef"]["name"] + assert "get-cache" in btd[3]["name"] + assert "update-build-number" in btd[4]["name"] + assert "security" in btd[5]["name"] + assert "build" in btd[6]["name"] assert "sonar" in btd[7]["name"] assert buildtool == btd[7]["taskRef"]["name"] - assert "build" in btd[8]["name"] - assert buildtool == btd[8]["taskRef"]["name"] - assert "get-nexus-repository-url" in btd[9]["name"] - assert "push" in btd[10]["name"] - assert buildtool == btd[10]["taskRef"]["name"] + assert "get-nexus-repository-url" in btd[8]["name"] + assert "push" in btd[9]["name"] + assert buildtool == btd[9]["taskRef"]["name"] if cbtype == "app": - assert "kaniko-build" in btd[11]["name"] + assert "kaniko-build" in btd[10]["name"] + assert "save-cache" in btd[11]["name"] assert "git-tag" in btd[12]["name"] assert "update-cbis" in btd[13]["name"] if cbtype == "lib": + assert "save-cache" in btd[10]["name"] assert "git-tag" in btd[11]["name"] assert "push-to-jira" in r["pipeline"][gitlab_build_pipeline_def]["spec"]["finally"][0]["name"] @@ -294,24 +282,22 @@ def test_java_gradle_pipelines_harbor_gitlab(): assert "init-values" in btedp[1]["name"] assert "get-version" in btedp[2]["name"] assert "get-version-edp" == btedp[2]["taskRef"]["name"] - assert "update-build-number" in btedp[3]["name"] - assert "security" in btedp[4]["name"] - assert "compile" in btedp[5]["name"] - assert buildtool == btedp[5]["taskRef"]["name"] - assert "test" in btedp[6]["name"] - assert buildtool == btedp[6]["taskRef"]["name"] + assert "get-cache" in btedp[3]["name"] + assert "update-build-number" in btedp[4]["name"] + assert "security" in btedp[5]["name"] + assert "build" in btedp[6]["name"] assert "sonar" in btedp[7]["name"] assert buildtool == btedp[7]["taskRef"]["name"] - assert "build" in btedp[8]["name"] - assert buildtool == btedp[8]["taskRef"]["name"] - assert "get-nexus-repository-url" in btedp[9]["name"] - assert "push" in btedp[10]["name"] - assert buildtool == btedp[10]["taskRef"]["name"] + assert "get-nexus-repository-url" in btedp[8]["name"] + assert "push" in btedp[9]["name"] + assert buildtool == btedp[9]["taskRef"]["name"] if cbtype == "app": - assert "kaniko-build" in btedp[11]["name"] + assert "kaniko-build" in btedp[10]["name"] + assert "save-cache" in btedp[11]["name"] assert "git-tag" in btedp[12]["name"] assert "update-cbis" in btedp[13]["name"] if cbtype == "lib": + assert "save-cache" in btedp[10]["name"] assert "git-tag" in btedp[11]["name"] assert "update-cbb" in r["pipeline"][gitlab_build_pipeline_edp]["spec"]["finally"][0]["name"] assert "push-to-jira" in r["pipeline"][gitlab_build_pipeline_edp]["spec"]["finally"][1]["name"]