Problem to solve
*I’m trying to provide some CI/CD components for other teams to use.
There are 2 components: run-tests and sync-tests.
In run-tests an external test automation tool is called through a shell script.
In sync-tests test results are synced through a little Python Poetry program with several files that I made.
The problem lies in having this shell script and the Python files available in the CI/CD components.
In my component “testcomponents” I have following directory structure:
testcomponents
- .gitlab-ci.yml
- README.md
- templates/
- templates/run-tests
- templates/run-tests/README.md
- templates/run-tests/template.yml
- templates/run-tests/run_tests.sh
- templates/sync-tests/README.md
- templates/sync-tests/template.yml
- templates/sync-tests/pyproject.toml
- templates/sync-tests/poetry.lock
- templates/sync-tests/test-integration
- templates/sync-tests/test-integration/main.py
- templates/sync-tests/test-integration/2 futher subdirectories with files
- What are you seeing, and how does that differ from what you expect to see?
When I call the run-tests component, it cannot find the run_tests.sh file.
For debugging purposes I added an “ls-lha” in the script step of the component run-tests and that gave me this output:
.git
.gitlab-ci.yml
.paths.env (-> environment file I use between the different stages in my main gitlab-ci.yml file)
poetry.lock
pyproject.tml
So indeed the shell script is not present here.
And also some (but not all !) files from the second template are present. Which I find a bit weird.
Maybe only .md, yml and toml files are included?
Steps to reproduce
No steps to reproduce, but according to the answer here, it seems it is not possible to add files:
How to access other files in a GitLab CI/CD component when including it - Stack Overflow
I found this CI/CD component example:
templates · main · Guided Explorations / GitLab CI Components / Hello World Container · GitLab
Which has a shell script that is called.
But apparently this is done by building a Docker container that contains the shell script:
Dockerfile · main · Guided Explorations / GitLab CI Components / Hello World Container · GitLab
Is that really the only way to include files which are in the same directory?
Seems quite cumbersome, confusing and time consuming to do it this way…