Skip to content

Commit fe5227f

Browse files
authored
Lab title based on events - intergration tests for network collections (#150)
* Lab title based on events * Update settings.json * Change default title and sha value * fix conflict * change default title and sha * use HEAD instead of github.sha
1 parent 5022b03 commit fe5227f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/integration.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
required: false
77
type: string
88
default: ""
9+
lab_title:
10+
required: false
11+
type: string
12+
default: ${{ github.event.repository.name }}
913
cml_lab:
1014
default: tests/integration/labs/single.yaml
1115
required: false
@@ -104,6 +108,24 @@ jobs:
104108
VIRL_PASSWORD: ${{ secrets.virl_password }}
105109
VIRL_USERNAME: admin
106110

111+
- name: Create the lab title
112+
run: |
113+
if [[ "${{ github.event_name }}" == 'pull_request_target' ]]; then
114+
echo "CLABTITLE=${{ inputs.lab_title }}_PR${{ github.event.pull_request.number }}" >> $GITHUB_ENV
115+
elif [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
116+
shashort=$(git rev-parse --short HEAD)
117+
uuidval=$(uuidgen | cut -c 1-8)
118+
echo "CLABTITLE=${{ inputs.lab_title }}_${shashort}_${uuidval}" >> $GITHUB_ENV
119+
fi
120+
121+
- name: Print the lab title
122+
run: echo ${{ env.CLABTITLE }}
123+
124+
- name: Add Lab Title to the lab file
125+
run: >-
126+
sed -i "s/title: ${{ inputs.network_os }}/title: ${{ env.CLABTITLE }}/" ${{ inputs.cml_lab }}
127+
working-directory: ${{ steps.identify.outputs.collection_path }}
128+
107129
- name: Run integration tests
108130
run: >-
109131
python3 -m pytest tests/integration

0 commit comments

Comments
 (0)