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 required: false
type: string type: string
nameprefix: nameprefix:
description: Runner prefix (cs-codex-dist-tests) description: Runner prefix (codex-dist-tests)
required: false required: false
type: string type: string
namespace: 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 required: false
type: string type: string
@ -35,8 +39,9 @@ on:
env: env:
BRANCH: ${{ github.ref_name }} BRANCH: ${{ github.ref_name }}
SOURCE: ${{ format('{0}/{1}', github.server_url, github.repository) }} SOURCE: ${{ format('{0}/{1}', github.server_url, github.repository) }}
NAMEPREFIX: cs-codex-dist-tests NAMEPREFIX: codex-dist-tests
NAMESPACE: cs-codex-dist-tests NAMESPACE: default
COMMAND: dotnet test Tests
JOB_MANIFEST: docker/job.yaml JOB_MANIFEST: docker/job.yaml
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
KUBE_VERSION: v1.26.1 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.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.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.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 "RUNID=$(date +%Y%m%d-%H%M%S)" >> $GITHUB_ENV
echo "TESTID=$(git rev-parse --short HEAD)" >> $GITHUB_ENV echo "TESTID=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

View File

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