Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tisutisu committed Nov 12, 2024
1 parent f93dad2 commit 1f9905d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/run-task-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ jobs:
- name: Wait for the dependencies to be ready
if: steps.changed-files.outputs.any_changed == 'true'
run: |
#cd $GITHUB_WORKSPACE/konflux-ci
cd $GITHUB_WORKSPACE/konflux-ci
./wait-for-all.sh
- name: Deploying Konflux
if: steps.changed-files.outputs.any_changed == 'true'
run: |
#cd $GITHUB_WORKSPACE/konflux-ci
cd $GITHUB_WORKSPACE/konflux-ci
./deploy-konflux.sh
- name: List namespaces
Expand All @@ -85,7 +85,7 @@ jobs:
- name: Deploy test resources
if: steps.changed-files.outputs.any_changed == 'true'
run: |
#cd $GITHUB_WORKSPACE/konflux-ci
cd $GITHUB_WORKSPACE/konflux-ci
./deploy-test-resources.sh
- name: Run the task tests
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,35 @@ Specify the Quay repository using the `QUAY_NAMESPACE` environment variable in t
./hack/test-shellspec.sh`
```
## Testing Tasks
Tasks can be validated in the GithubActions CI setup with this repository.
If you have a directory called `tests/` inside the task directory, CI will create a random `Namespace`, validate the task using [tektor](https://github.com/lcarva/tektor), apply the task first in the namespace and then all the test yaml files (containing TaskRun or PipelineRun) inside the `tests` directory.
We can use the functionality of running scripts before applying the tested task or the other yaml files. There are two different scripts that are automatically applied if present. These are applied using the `source` bash script:
- `pre-apply-task-hook.sh`: Script to run before applying the task, it can include `kubectl` commands to apply any kubernetes resources in the cluster
- `pre-apply-taskrun-hook.sh`: Script to run before applying the task run or pipeline run yaml files, it can also include `kubectl` commands to apply any kubernetes resources in the cluster
For example refer: Git Clone task [tests](./task/git-clone/0.1/tests/run.yaml)
### Running Task tests locally
Prerequisites: Deploy [upstream konflux](https://github.com/konflux-ci/konflux-ci?tab=readme-ov-file#bootstrapping-the-cluster) locally.
A helper script called `run-test.sh` is present inside `test` directory to help the developer run the test. Just specify resource type as first argument, resource name as second argument and the version as third argument i.e:
```
./test/run-test.sh task git-clone 0.1
```
and it will use your current kubernetes context to run the test and show you the outputs similar to the CI.
To run your task tests locally
### Prerequisites
- Deployed Konflux on the cluster (see [infra-deployments](https://github.com/redhat-appstudio/infra-deployments))
### Compliance
Task definitions must comply with the [Enterprise Contract](https://enterprisecontract.dev/) policies.
Expand Down

0 comments on commit 1f9905d

Please sign in to comment.