Pass a command during automated tests run (#65)

This commit is contained in:
Slava 2023-09-19 17:53:15 +03:00 committed by GitHub
parent c2a84c7f0e
commit 2e13954152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 12 deletions

View File

@ -23,11 +23,15 @@ on:
required: false
type: string
nameprefix:
description: Runner prefix (cs-codex-dist-tests)
description: Runner prefix (codex-dist-tests)
required: false
type: string
namespace:
description: Runner namespace (cs-codex-dist-tests)
description: Runner namespace (default)
required: false
type: string
command:
description: Runner command (dotnet test Tests)
required: false
type: string
@ -35,8 +39,9 @@ on:
env:
BRANCH: ${{ github.ref_name }}
SOURCE: ${{ format('{0}/{1}', github.server_url, github.repository) }}
NAMEPREFIX: cs-codex-dist-tests
NAMESPACE: cs-codex-dist-tests
NAMEPREFIX: codex-dist-tests
NAMESPACE: default
COMMAND: dotnet test Tests
JOB_MANIFEST: docker/job.yaml
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
KUBE_VERSION: v1.26.1
@ -56,6 +61,8 @@ jobs:
[[ -n "${{ github.event.inputs.source }}" ]] && echo "SOURCE=${{ github.event.inputs.source }}" >>"$GITHUB_ENV" || echo "SOURCE=${{ env.SOURCE }}" >>"$GITHUB_ENV"
[[ -n "${{ github.event.inputs.nameprefix }}" ]] && echo "NAMEPREFIX=${{ github.event.inputs.nameprefix }}" >>"$GITHUB_ENV" || echo "NAMEPREFIX=${{ env.NAMEPREFIX }}" >>"$GITHUB_ENV"
[[ -n "${{ github.event.inputs.namespace }}" ]] && echo "NAMESPACE=${{ github.event.inputs.namespace }}" >>"$GITHUB_ENV" || echo "NAMESPACE=${{ env.NAMESPACE }}" >>"$GITHUB_ENV"
[[ -n "${{ github.event.inputs.command }}" ]] && COMMAND="${{ github.event.inputs.command }}" || COMMAND="${{ env.COMMAND }}"
echo "COMMAND=$(jq -c 'split(" ")' <<< '"'$COMMAND'"')" >>"$GITHUB_ENV"
echo "RUNID=$(date +%Y%m%d-%H%M%S)" >> $GITHUB_ENV
echo "TESTID=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

View File

@ -11,6 +11,10 @@ spec:
template:
metadata:
name: ${NAMEPREFIX}
labels:
app: dist-tests-runner
name: ${NAMEPREFIX}-${RUNID}
run-id: ${RUNID}
spec:
containers:
- name: ${NAMEPREFIX}-runner
@ -20,7 +24,7 @@ spec:
- name: KUBECONFIG
value: /opt/kubeconfig.yaml
- name: LOGPATH
value: /var/log/cs-codex-dist-tests
value: /var/log/codex-dist-tests
- name: NAMESPACE
value: ${NAMESPACE}
- name: BRANCH
@ -36,16 +40,13 @@ spec:
mountPath: /opt/kubeconfig.yaml
subPath: kubeconfig.yaml
- name: logs
mountPath: /var/log/cs-codex-dist-tests
# command:
# - "dotnet"
# - "test"
# - "Tests"
mountPath: /var/log/codex-dist-tests
args: ${COMMAND}
restartPolicy: Never
volumes:
- name: kubeconfig
secret:
secretName: cs-codex-dist-tests-app-kubeconfig
secretName: codex-dist-tests-app-kubeconfig
- name: logs
hostPath:
path: /var/log/cs-codex-dist-tests
path: /var/log/codex-dist-tests