diff --git a/.github/workflows/ci_pr.yaml b/.github/workflows/ci_pr.yaml new file mode 100644 index 0000000..8295dab --- /dev/null +++ b/.github/workflows/ci_pr.yaml @@ -0,0 +1,95 @@ +name: LOS CSI PR checks + +on: + workflow_dispatch: + inputs: + manifest_name: + description: "Manifest name to run the PR checks with" + default: "duros.xml" + required: true + type: string + manifest_branch: + description: "Manifest branch to run the PR checks with" + default: "master" + required: true + type: string + ci_token: + description: "Token to use for CI" + required: true + type: string + +env: + BUILD_TYPE: "rel" + manifest_name: "duros.xml" + system_tests_type: "los-csi" + max_parallel: 3 + manifest_branch: "master" + +jobs: + populate_env_vars: + runs-on: [ self-hosted, public-pr-checks ] + name: populate_env_vars + outputs: + manifest_name: ${{ steps.set_manifest_name.outputs.manifest_name }} + system_tests_type: ${{ steps.set_system_tests_type.outputs.system_tests_type }} + max_parallel: ${{ steps.set_max_parallel.outputs.max_parallel }} + branch_name: ${{ steps.set_branch_name.outputs.branch_name }} + manifest_branch: ${{ steps.set_manifest_branch.outputs.manifest_branch }} + steps: + - id: set_manifest_name + name: set_manifest_name + run: | + manifest_name=${{ inputs.manifest_name }} + if [ ${manifest_name} ]; then + echo "manifest_name=$manifest_name" >> $GITHUB_OUTPUT + else + echo "manifest_name=${{ env.manifest_name }}" >> $GITHUB_OUTPUT + fi + + - id: set_system_tests_type + name: set_system_tests_type + run: | + system_tests_type=${{ env.system_tests_type }} + echo "system_tests_type=$system_tests_type" >> $GITHUB_OUTPUT + + - id: set_max_parallel + name: set_max_parallel + run: | + echo "max_parallel=${{ env.max_parallel }}" >> $GITHUB_OUTPUT + + - id: set_branch_name + name: set_branch_name + run: | + if [ -z "${GITHUB_HEAD_REF}" ]; then + branch_name=${GITHUB_REF_NAME} + else + branch_name=${GITHUB_HEAD_REF} + fi + echo "branch_name=$branch_name" >> $GITHUB_OUTPUT + + - id: set_manifest_branch + name: set_manifest_branch + run: | + manifest_name=${{ inputs.manifest_branch }} + if [ ${manifest_name} ]; then + echo "manifest_branch=${{ inputs.manifest_branch }}" >> $GITHUB_OUTPUT + else + echo "manifest_branch=${{ env.manifest_branch }}" >> $GITHUB_OUTPUT + fi + + trigger_ci_pr: + needs: populate_env_vars + name: "Trigger CI PR workflow" + runs-on: [ self-hosted, public-pr-checks ] + steps: + - name: Trigger CI PR workflow + uses: convictional/trigger-workflow-and-wait@v1.6.5 + with: + owner: lightbitslabs + repo: lbcitests + github_token: ${{ inputs.CI_TOKEN }} + workflow_file_name: ci_pr.yaml + ref: elad/LBM1-35481/add-los-csi-pr-checks + client_payload: '{"manifest_name":"${{ needs.populate_env_vars.outputs.manifest_name }}", "tests_type":"${{ needs.populate_env_vars.outputs.system_tests_type }}", "manifest_branch":"${{ needs.populate_env_vars.outputs.manifest_branch }}", "github_runner_label":"pr-checks", "run_name":"LOS CSI PR checks", "branch_name":"${{ needs.populate_env_vars.outputs.branch_name }}"}' + trigger_workflow: true + wait_workflow: true