From 90ba77364375508d111acf725efdaee361dbb085 Mon Sep 17 00:00:00 2001 From: Laa7ad <104000077+Laa7ad@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:14:25 +0100 Subject: [PATCH] first task.yml commit --- .tekton/tasks.yml | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/.tekton/tasks.yml b/.tekton/tasks.yml index e69de29..f41fc16 100644 --- a/.tekton/tasks.yml +++ b/.tekton/tasks.yml @@ -0,0 +1,59 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: cleanup +spec: + description: This task will clean up a workspace by deleting all the files. + 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: nose +spec: + workspaces: + - name: source + params: + - name: args + description: Arguments to pass to nose + type: string + default: "-v" + steps: + - name: nosetests + image: python:3.9-slim + workingDir: $(workspaces.source.path) + script: | + #!/bin/bash + set -e + python -m pip install --upgrade pip wheel + pip install -r requirements.txt + nosetests $(params.args)