From c7058cb980061982bfbae35fe695e7f24d9733d1 Mon Sep 17 00:00:00 2001 From: Trystan Schneider Date: Tue, 29 Oct 2024 18:51:22 +0100 Subject: [PATCH] feat: add bench action --- bench/action.yml | 67 ++++++++++++++++++++++++++++++++++++++++++++++ htcmock/action.yml | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 bench/action.yml diff --git a/bench/action.yml b/bench/action.yml new file mode 100644 index 0000000..bb4aed7 --- /dev/null +++ b/bench/action.yml @@ -0,0 +1,67 @@ +name: "Run Bench session" +description: "Action running a Bench session from a Kubernetes Job" +inputs: + type: + description: 'Type of deployment (either "aws" or "localhost")' + required: true + armonik-core-version: + description: "Version of ArmoniK.Core to use" + required: true + ntasks: + description: "Number of tasks to be created" + default: "100" + required: false + grpc-client-endpoint: + description: "External IP address of ArmoniK's API" + required: true + working-directory: + description: "Working directory (should be the ArmoniK repo root folder)" + required: false + default: ${{ github.workspace }} + session-name: + description: "A name that is provided as the value for key 'SessionName' for the 'Bench__Options' option" + required: false + default: "cicd" + timeout: + description: "Time in seconds to wait for job to enter 'Complete' status in Kubernetes" + required: false + default: "600" +outputs: + session-name: + description: "Name of the Bench session to help retrieve its id" + value: ${{ steps.run.outputs.session-name }} +runs: + using: composite + steps: + - if: inputs.type == 'aws' + id: kubeconfig + name: Load kubeconfig + working-directory: ${{ inputs.working-directory }} + shell: bash + env: + TYPE: ${{ inputs.type }} + run : | + set -ex + export KUBECONFIG="infrastructure/quick-deploy/$TYPE/generated/kubeconfig" + echo "kubeconfig=infrastructure/quick-deploy/$TYPE/generated/kubeconfig" >> $GITHUB_ENV + + - id: run + name: Bench Client running + working-directory: ${{ inputs.working-directory }} + shell: bash + env: + TIMEOUT: ${{ inputs.timeout }} + KUBECONFIG: ${{ env.kubeconfig || '' }} + ARMONIK_CORE_VERSION: ${{ inputs.armonik-core-version }} + NTASKS: ${{ inputs.ntasks }} + SESSION_NAME: ${{ inputs.session-name }} + GRPC_CLIENT_ENDPOINT: ${{ inputs.grpc-client-endpoint }} + run: | + set -ex + export KUBECONFIG="$KUBECONFIG" + sed "s/@@ARMONIK_CORE_VERSION@@/$ARMONIK_CORE_VERSION/g; s/@@NTASKS@@/$NTASKS/g; s/@@SESSION_NAME@@/$SESSION_NAME/g; s/@@GRPC_CLIENT_ENDPOINT@@/$GRPC_CLIENT_ENDPOINT/g" \ + ${{ inputs.working-directory }}/tools/ci/bench-job-template.yml | + kubectl apply -f - --validate=ignore + sleep 5 + kubectl -n armonik wait --for=condition=Complete --timeout="${TIMEOUT}s" job/bench-session + echo "session-name=$SESSION_NAME" >> "$GITHUB_OUTPUT" diff --git a/htcmock/action.yml b/htcmock/action.yml index 722860b..d60f554 100644 --- a/htcmock/action.yml +++ b/htcmock/action.yml @@ -50,5 +50,5 @@ runs: cd tools/ci echo "session-name=$SESSION_NAME" >> "$GITHUB_OUTPUT" sed "s/@@ARMONIK_CORE_VERSION@@/$ARMONIK_CORE_VERSION/g; s/@@NTASKS@@/$NTASKS/g; s/@@SUBTASKS_LEVELS@@/$SUBTASKS_LEVELS/g; s/@@SESSION_NAME@@/$SESSION_NAME/g; s/@@GRPC_CLIENT_ENDPOINT@@/$GRPC_CLIENT_ENDPOINT/g; s/@@PURGE_DATA@@/$PURGE_DATA/g" \ - ${{ inputs.working-directory }}/tools/ci/htcmock-job-template.yml | + tools/ci/htcmock-job-template.yml | kubectl apply -f -