Bash string substitution in artifact name causes segmentation violation
Summary
When using bash substitution to replace slashes with dashes I reproducibly see segfaults at the end of my CI jobs.
Steps to reproduce
When I have
artifacts:
name: ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME////-}
the job segfaults (see 1), but when I have
artifacts:
name: ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}
it doesn't (see 2). Notably the bash substitution itself is fine, at least it doesn't cause any issues when used within the script part of the job (see 3).
.gitlab-ci.yml
workflow:
rules:
- if: '$CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS'
when: never # Do not run branch (push) pipelines when an MR is open on the branch
- when: always
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
.quick-check:
stage: check
image: gitlab-registry.cern.ch/cms-cactus/phase2/firmware/docker/fw-builder:${BUILD_IMAGE_TAG}
before_script:
- source ${VIVADO_PATH}/settings64.sh
script:
- ./scripts/${SETUP_SCRIPT}
- cd ${BUILD_DIR}
- pushd scouting/proj/scouting_build/
- ipbb vivado project # Build the project
- ipbb vivado check-syntax
artifacts:
name: ${CI_JOB_NAME}_${CI_COMMIT_REF_NAME////-}
paths:
- $BUILD_DIR
- boards/${BOARD}/firmware/hdl/decoder_constants_${BOARD}.vhd
tags:
- vivado
- docker
variables:
BUILD_DIR: "build/"
VIVADO_PATH: /opt/Xilinx/Vivado/2022.2
BUILD_IMAGE_TAG: 2022-05-11__ipbb2022c
MP7FW_TAG: v3.2.2
scout-kcu1500-ugmt-quick-check:
extends: .quick-check
variables:
SETUP_SCRIPT: kcu1500/makeScoutUgmtProject.sh
BOARD: kcu1500
INPUT_SYSTEM: ugmt
stages:
- check
Actual behavior
Job crashes at artifact upload.
Expected behavior
Artifacts are uploaded with filename that is made of job name and branch name where potential slashes are replaced by dashes.
Environment description
Using our own runners (version 16.5.0) in docker (version 24.0.6, build ed223bc) with the docker executor.
config.toml contents
concurrent = 10
check_interval = 0
log_level = "debug"
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "daqlab40-skylake16"
limit = 1
output_limit = 4096000
url = "https://gitlab.cern.ch/"
id = 0
token = ""
token_obtained_at = 0001-01-01T00:00:00Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "shell"
[runners.custom_build_dir]
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[[runners]]
name = "daqlab40-skylake16-docker"
limit = 1
output_limit = 4096000
url = "https://gitlab.cern.ch/"
id = 0
token = ""
token_obtained_at = 0001-01-01T00:00:00Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "gitlab-registry.cern.ch/cms-cactus/phase2/firmware/gt-algorithm/cc7-ipbb-legacybuild:v1.0.0"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache", "/opt/XilinxRemote:/opt/Xilinx:ro", "/opt/mentor:/opt/mentor:ro", "/home/scratch/xilinx-simlibs:/scratch/xilinx-simlibs:rw"]
shm_size = 0
[runners.custom]
run_exec = ""
[[runners]]
name = "daqlab40-skylake16-simjobs-docker"
output_limit = 4096000
url = "https://gitlab.cern.ch/"
id = 0
token = ""
token_obtained_at = 0001-01-01T00:00:00Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "gitlab-registry.cern.ch/cms-cactus/phase2/firmware/gt-algorithm/cc7-ipbb-legacybuild:v1.0.0"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache", "/opt/XilinxRemote:/opt/Xilinx:ro", "/opt/mentor:/opt/mentor:ro", "/home/scratch/xilinx-simlibs:/scratch/xilinx-simlibs:rw"]
shm_size = 0
[runners.custom]
run_exec = ""
[[runners]]
name = "daqlab40-skylake16"
url = "https://gitlab.cern.ch/"
id = 29615
token = ""
token_obtained_at = 2023-02-27T14:34:54Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "ruby:2.7"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
Used GitLab Runner version
; gitlab-runner --version
Version: 15.9.1
Git revision: d540b510
Git branch: 15-9-stable
GO version: go1.18.10
Built: 2023-02-20T21:03:05+0000
OS/Arch: linux/amd64