Skip to content

Remote component template file could be in a directory #1705

@jrd

Description

@jrd

Minimal .gitlab-ci.yml illustrating the issue

include:
  - component: $CI_SERVER_FQDN/snake_coders/tools/ci/[email protected]

But the python-tests component is defined in such a structuer:

$ find templates/security
templates/python-tests
templates/python-tests/template.yml
templates/python-tests/README.md

Then
python-tests/template.yml includes another component:

spec:
  component: [sha]
  
---
include:
  - component: $CI_SERVER_FQDN/snake_coders/tools/ci/python-base@$[[ component.sha ]]

The bug only appear when component A includes component B.

The component include is transformed into a project/file component (parser-includes.js file, init function) in the following code:

if (!fs.existsSync(localFileName) && !(await Utils.remoteFileExist(cwd, f, ref, domain, projectPath, gitData.remote.schema, gitData.remote.port))) {
  continue;
}
const fileDoc = {
  include: {
    project: projectPath,
    file: f,
    ref: ref,
    inputs: value.inputs || {},
  },
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    elaborateFurther elaboration is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions