Skip to content

Commit

Permalink
add unit test task (redhat-cop#5469)
Browse files Browse the repository at this point in the history
  • Loading branch information
treddy08 authored Sep 25, 2022
1 parent b5d12bc commit 852c270
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: unit-test
namespace: "{{ ocp4_workload_coolstore_apac_summit_coolstore_namespace }}"
spec:
params:
- default: 'docker.io/sonarsource/sonar-scanner-cli:latest'
name: scanImage
type: string
- default: >-
https://gitea.apps.cluster-hlw9j.sandbox2180.opentlc.com/dev-user/coolstore-microservice
name: gitRepositoryUrl
type: string
- default: main
name: gitRepositoryRevision
type: string
- default: 'true'
name: verbose
type: string
steps:
- image: 'alpine/git:v2.26.2'
name: git-checkout
resources: {}
script: |
#!/usr/bin/env sh

set -eu -o pipefail

if [[ "$(params.verbose)" == "true" ]] ; then
set -x
echo "**** Cloning $(params.gitRepositoryUrl) into $(pwd)/repository"
fi

git clone "$(params.gitRepositoryUrl)" $(pwd)/repository
cd repository
git checkout "$(params.gitRepositoryRevision)"
volumeMounts:
- mountPath: /workspace/repository
name: repository
workingDir: /workspace
- name: unit-test
image: docker.io/node:current-alpine
script: |
set -x
npm i [email protected]
npm i [email protected]
cd coolstore-ui
npm test
volumeMounts:
- mountPath: /workspace/repository
name: repository
workingDir: /workspace/repository
volumes:
- emptyDir: {}
name: repository
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
kind: ClusterTask
name: openshift-client
runAfter:
- scan-code
- unit-test
- name: generate-tag
runAfter:
- image-check
Expand Down Expand Up @@ -122,6 +122,17 @@ spec:
taskRef:
kind: Task
name: scan-code
- name: unit-test
params:
- name: gitRepositoryUrl
value: $(params.GIT_MICROSERVICES_REPO_URL)
- name: gitRepositoryRevision
value: $(params.GIT_REPO_REVISION)
taskRef:
kind: Task
name: unit-test
runAfter:
- scan-code
workspaces:
- name: workspace

0 comments on commit 852c270

Please sign in to comment.