-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i added tekton task for cleanup and unit test
- Loading branch information
1 parent
2dbed11
commit 35eb34a
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: cleanup | ||
spec: | ||
workspaces: | ||
- name: source | ||
steps: | ||
- name: remove | ||
image: alpine:3 | ||
env: | ||
- name: WORKSPACE_SOURCE_PATH | ||
value: $(workspaces.source.path) | ||
workingDir: $(workspaces.source.path) | ||
securityContext: | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
script: | | ||
#!/usr/bin/env sh | ||
set -eu | ||
echo "Removing all files from ${WORKSPACE_SOURCE_PATH} ..." | ||
# Delete any existing contents of the directory if it exists. | ||
# | ||
# We don't just "rm -rf ${WORKSPACE_SOURCE_PATH}" because ${WORKSPACE_SOURCE_PATH} might be "/" | ||
# or the root of a mounted volume. | ||
if [ -d "${WORKSPACE_SOURCE_PATH}" ] ; then | ||
# Delete non-hidden files and directories | ||
rm -rf "${WORKSPACE_SOURCE_PATH:?}"/* | ||
# Delete files and directories starting with . but excluding .. | ||
rm -rf "${WORKSPACE_SOURCE_PATH}"/.[!.]* | ||
# Delete files and directories starting with .. plus any other character | ||
rm -rf "${WORKSPACE_SOURCE_PATH}"/..?* | ||
fi | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: pytest | ||
spec: | ||
workspaces: | ||
- name: source | ||
params: | ||
- name: args | ||
description: Arguments to pass to pytest | ||
type: string | ||
default: '' | ||
steps: | ||
- name: pytest | ||
image: python:3.9-slim | ||
workingDir: $(workspaces.source.paths) | ||
script: | | ||
#!/bin/bash | ||
set -e | ||
python -m pip install --upgrade pip wheel | ||
pip install -r requirements.txt | ||
python -m pytest $(params.args) |