I have code in gitlab ci yml file:
include:
- project: 'my-group/my-project'
ref: main
file: '.gitlab-ci-template.yml'
but the file .gitlab-ci-template.yml
uses come code from another utils-functions.sh
file (located in the same directory)
during the run of pipeline it can not find utils-functions.sh
how could I fix it ?
I presume you mean that “utils-functions.sh” is located in the my-group/my-project
repository.
In which case what you are trying to do cannot work: GitLab does not merge the repositories when merging pipelines, it merges just the GitLab CI yaml files specifically.
You need to create a job in the ci template file that writes the bash script out to disk:
write-it:
script:
- |
cat > utils.sh << EOF
#!/bin/bash
echo "hello world"
EOF