diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 78902df..3326a0b 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -6,6 +6,10 @@ on: required: false type: string default: "" + lab_title: + required: false + type: string + default: ${{ github.event.repository.name }} cml_lab: default: tests/integration/labs/single.yaml required: false @@ -104,6 +108,24 @@ jobs: VIRL_PASSWORD: ${{ secrets.virl_password }} VIRL_USERNAME: admin + - name: Create the lab title + run: | + if [[ "${{ github.event_name }}" == 'pull_request_target' ]]; then + echo "CLABTITLE=${{ inputs.lab_title }}_PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then + shashort=$(git rev-parse --short HEAD) + uuidval=$(uuidgen | cut -c 1-8) + echo "CLABTITLE=${{ inputs.lab_title }}_${shashort}_${uuidval}" >> $GITHUB_ENV + fi + + - name: Print the lab title + run: echo ${{ env.CLABTITLE }} + + - name: Add Lab Title to the lab file + run: >- + sed -i "s/title: ${{ inputs.network_os }}/title: ${{ env.CLABTITLE }}/" ${{ inputs.cml_lab }} + working-directory: ${{ steps.identify.outputs.collection_path }} + - name: Run integration tests run: >- python3 -m pytest tests/integration