-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Describe the bug
This is a spinoff from #5011
Given a job name that has characters that aren't allowed in file paths, gh run view --log will not display logs for that job.
Steps to reproduce the behavior
Taking inspiration from @ryan-williams comment, here is a workflow definition that contains many (but not an exhaustive list of) job names containing invalid characters.
Running gh run view 5414944521 --log returns only the logs for the one job that doesn't contain any special characters:
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5119275Z Current runner version: '2.305.0'
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5152926Z ##[group]Operating System
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5153638Z Ubuntu
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5153956Z 22.04.2
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5154337Z LTS
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5154718Z ##[endgroup]
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5155127Z ##[group]Runner Image
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5155573Z Image: ubuntu-22.04
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5156009Z Version: 20230625.1.0
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5156639Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20230625.1.0/images/linux/Ubuntu2204-Readme.md
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5157501Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230625.1.0
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5158131Z ##[endgroup]
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5158575Z ##[group]Runner Image Provisioner
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5158981Z 2.0.238.1
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5159349Z ##[endgroup]
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5160231Z ##[group]GITHUB_TOKEN Permissions
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5160933Z Contents: read
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5161393Z Metadata: read
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5162149Z Packages: read
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5162569Z ##[endgroup]
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5166802Z Secret source: Actions
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.5167392Z Prepare workflow directory
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.6039674Z Prepare all required actions
Test matrix colon text (job param doesn't contain any funny characters) Set up job 2023-06-29T17:11:37.6725015Z Complete job name: Test matrix colon text (job param doesn't contain any funny characters)
Test matrix colon text (job param doesn't contain any funny characters) Run echo "Text: job param doesn't contain any funny characters" 2023-06-29T17:11:37.7838615Z ##[group]Run echo "Text: job param doesn't contain any funny characters"
Test matrix colon text (job param doesn't contain any funny characters) Run echo "Text: job param doesn't contain any funny characters" 2023-06-29T17:11:37.7839495Z echo "Text: job param doesn't contain any funny characters"
Test matrix colon text (job param doesn't contain any funny characters) Run echo "Text: job param doesn't contain any funny characters" 2023-06-29T17:11:37.8574661Z shell: /usr/bin/bash -e {0}
Test matrix colon text (job param doesn't contain any funny characters) Run echo "Text: job param doesn't contain any funny characters" 2023-06-29T17:11:37.8575232Z ##[endgroup]
Test matrix colon text (job param doesn't contain any funny characters) Run echo "Text: job param doesn't contain any funny characters" 2023-06-29T17:11:37.9240121Z Text: job param doesn't contain any funny characters
Test matrix colon text (job param doesn't contain any funny characters) Complete job 2023-06-29T17:11:37.9576250Z Cleaning up orphan processes
Expected vs actual behavior
I would expect to see logs for all the jobs.
Why does this happen?
As described in my comment when the .zip file is produced, file names are santitized, removing disallowed path characters. Our regexp matching logic does not apply the same behaviour, resulting in us not matching file names to their jobs.
See the following terminal output showing the missing : chars in the dir and file names:
➜ run-log-5414944521-1688058682 ls -lah
total 72
-rw-r--r-- 1 williammartin staff 2.2K Jun 29 18:27 1_Test matrix colon text (job param contains a colon).txt
-rw-r--r-- 1 williammartin staff 2.4K Jun 29 18:27 1_Test matrix colon text.txt
-rw-r--r-- 1 williammartin staff 2.2K Jun 29 18:27 2_Test matrix colon text (job param contains a question mar.txt
-rw-r--r-- 1 williammartin staff 2.2K Jun 29 18:27 3_Test matrix colon text (job param contains a asterisk).txt
-rw-r--r-- 1 williammartin staff 2.2K Jun 29 18:27 4_Test matrix colon text (job param contains a pipe).txt
-rw-r--r-- 1 williammartin staff 2.2K Jun 29 18:27 5_Test matrix colon text (job param contains a greater than.txt
-rw-r--r-- 1 williammartin staff 2.2K Jun 29 18:27 6_Test matrix colon text (job param contains a less than).txt
-rw-r--r-- 1 williammartin staff 2.2K Jun 29 18:27 7_Test matrix colon text (job param contains an asertisk).txt
-rw-r--r-- 1 williammartin staff 2.2K Jun 29 18:27 8_Test matrix colon text (job param doesn't contain any funn.txt
drwxr-xr-x 5 williammartin staff 160B Jun 29 20:27 Test matrix colon text (job param contains a asterisk)
drwxr-xr-x 5 williammartin staff 160B Jun 29 20:27 Test matrix colon text (job param contains a colon)
drwxr-xr-x 5 williammartin staff 160B Jun 29 20:27 Test matrix colon text (job param contains a greater than)
drwxr-xr-x 5 williammartin staff 160B Jun 29 20:27 Test matrix colon text (job param contains a less than)
drwxr-xr-x 5 williammartin staff 160B Jun 29 18:27 Test matrix colon text (job param contains a pipe)
drwxr-xr-x 5 williammartin staff 160B Jun 29 20:27 Test matrix colon text (job param contains a question mark)
drwxr-xr-x 5 williammartin staff 160B Jun 29 20:27 Test matrix colon text (job param contains an asertisk)
drwxr-xr-x 5 williammartin staff 160B Jun 29 18:27 Test matrix colon text (job param doesn't contain any funny characters)
Notes
I previously merged #7526 which special cased / as it was unavoidably added to job names by GitHub when using composite actions.