From 67e45519714010d5eb524f8af5b17afd31741005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Hal=C3=A1sz?= Date: Tue, 22 Oct 2024 15:33:54 +0200 Subject: [PATCH] feat(CI): enable unit-tests for konflux builds --- .tekton/compliance-frontend-pull-request.yaml | 89 +++++++++-------- .tekton/compliance-frontend-push.yaml | 99 ++++++++++--------- 2 files changed, 101 insertions(+), 87 deletions(-) diff --git a/.tekton/compliance-frontend-pull-request.yaml b/.tekton/compliance-frontend-pull-request.yaml index 9988e2be7..d63c72152 100644 --- a/.tekton/compliance-frontend-pull-request.yaml +++ b/.tekton/compliance-frontend-pull-request.yaml @@ -301,48 +301,55 @@ spec: workspaces: - name: basic-auth workspace: git-auth - # - name: run-unit-tests - # description: Validates frontend unit tests - # params: - # - name: SOURCE_ARTIFACT - # value: $(tasks.clone-repository-oci-ta.results.SOURCE_ARTIFACT) - # runAfter: - # - clone-repository-oci-ta - # workspaces: - # - name: basic-auth - # workspace: git-auth - # taskSpec: - # params: - # - description: The Trusted Artifact URI pointing to the artifact with the application source code. - # name: SOURCE_ARTIFACT - # type: string - # volumes: - # # New volume to store a copy of the source code accessible only to this Task. - # - name: workdir - # emptyDir: {} - # stepTemplate: - # volumeMounts: - # - mountPath: /var/workdir - # name: workdir - # readOnly: false - # sidecars: - # steps: - # - name: use-trusted-artifact - # image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:8391272c4e5011120e9e7fee2c1f339e9405366110bf239dadcbc21e953ce099 - # args: - # - use - # - $(params.SOURCE_ARTIFACT)=/var/workdir - # - image: registry.access.redhat.com/ubi8/nodejs-20 - # workingDir: /var/workdir - # name: unit-tests - # securityContext: - # runAsUser: 0 - # script: | - # #!/bin/bash - # set -ex + - name: run-unit-tests + description: Validates frontend unit tests + params: + - name: SOURCE_ARTIFACT + value: $(tasks.clone-repository-oci-ta.results.SOURCE_ARTIFACT) + runAfter: + - clone-repository-oci-ta + workspaces: + - name: basic-auth + workspace: git-auth + taskSpec: + params: + - description: The Trusted Artifact URI pointing to the artifact with the application source code. + name: SOURCE_ARTIFACT + type: string + volumes: + # New volume to store a copy of the source code accessible only to this Task. + - name: workdir + emptyDir: {} + stepTemplate: + volumeMounts: + - mountPath: /var/workdir + name: workdir + readOnly: false + sidecars: + steps: + - name: use-trusted-artifact + image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:8391272c4e5011120e9e7fee2c1f339e9405366110bf239dadcbc21e953ce099 + args: + - use + - $(params.SOURCE_ARTIFACT)=/var/workdir + - image: registry.access.redhat.com/ubi8/nodejs-20 + workingDir: /var/workdir + name: unit-tests + computeResources: + requests: + memory: 7Gi + cpu: 1000m + limits: + memory: 14Gi + cpu: 2000m + securityContext: + runAsUser: 0 + script: | + #!/bin/bash + set -ex - # npm install - # npm test + npm install + npm test - name: build-container params: - name: IMAGE diff --git a/.tekton/compliance-frontend-push.yaml b/.tekton/compliance-frontend-push.yaml index 91c632121..9b564ade5 100644 --- a/.tekton/compliance-frontend-push.yaml +++ b/.tekton/compliance-frontend-push.yaml @@ -298,53 +298,60 @@ spec: workspaces: - name: basic-auth workspace: git-auth - # - name: run-unit-tests - # description: Validates frontend unit tests - # params: - # - name: SOURCE_ARTIFACT - # value: $(tasks.clone-repository-oci-ta.results.SOURCE_ARTIFACT) - # runAfter: - # - clone-repository-oci-ta - # computeResources: - # requests: - # memory: 1Gi - # requests: - # memory: 2Gi - # workspaces: - # - name: basic-auth - # workspace: git-auth - # taskSpec: - # params: - # - description: The Trusted Artifact URI pointing to the artifact with the application source code. - # name: SOURCE_ARTIFACT - # type: string - # volumes: - # # New volume to store a copy of the source code accessible only to this Task. - # - name: workdir - # emptyDir: {} - # stepTemplate: - # volumeMounts: - # - mountPath: /var/workdir - # name: workdir - # readOnly: false - # sidecars: - # steps: - # - name: use-trusted-artifact - # image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:8391272c4e5011120e9e7fee2c1f339e9405366110bf239dadcbc21e953ce099 - # args: - # - use - # - $(params.SOURCE_ARTIFACT)=/var/workdir - # - image: registry.access.redhat.com/ubi8/nodejs-20 - # workingDir: /var/workdir - # name: unit-tests - # securityContext: - # runAsUser: 0 - # script: | - # #!/bin/bash - # set -ex + - name: run-unit-tests + description: Validates frontend unit tests + params: + - name: SOURCE_ARTIFACT + value: $(tasks.clone-repository-oci-ta.results.SOURCE_ARTIFACT) + runAfter: + - clone-repository-oci-ta + computeResources: + requests: + memory: 1Gi + requests: + memory: 2Gi + workspaces: + - name: basic-auth + workspace: git-auth + taskSpec: + params: + - description: The Trusted Artifact URI pointing to the artifact with the application source code. + name: SOURCE_ARTIFACT + type: string + volumes: + # New volume to store a copy of the source code accessible only to this Task. + - name: workdir + emptyDir: {} + stepTemplate: + volumeMounts: + - mountPath: /var/workdir + name: workdir + readOnly: false + sidecars: + steps: + - name: use-trusted-artifact + image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:8391272c4e5011120e9e7fee2c1f339e9405366110bf239dadcbc21e953ce099 + args: + - use + - $(params.SOURCE_ARTIFACT)=/var/workdir + - image: registry.access.redhat.com/ubi8/nodejs-20 + workingDir: /var/workdir + name: unit-tests + computeResources: + requests: + memory: 7Gi + cpu: 1000m + limits: + memory: 14Gi + cpu: 2000m + securityContext: + runAsUser: 0 + script: | + #!/bin/bash + set -ex - # npm install - # npm test + npm install + npm test - name: build-container params: - name: IMAGE