I have a .gitlab-ci.yaml
with the extends
directive, which works on the gitlab-ci, but I cannot test it with gitlab-runner exec
, it looks like the extends
is ignored by gitlab-runner
.
I have two files, like:
# .2extend.yml
.job2extend:
image: some/docker/img
stage: test
script:
- echo do things with "${myvar}"
and
# .gitlab-ci.yml
include:
- project: 'project/to/extend'
ref: master
file: '.2extend.yml'
myjob:
extends: .job2extend
variables:
myvar: 'My Variable'
This is the error I'm having:
$ gitlab-runner exec docker myjob
Runtime platform arch=amd64 os=linux pid=29785 revision=45d9c1d6 version=12.4.0~beta.1935.g45d9c1d6
FATAL: missing 'script' for job
The job I am extending from, have both script
and image
directives.
I have come to this issue which has the same problem as I do.
So, there is workaround to do this while the issue is not solved?
Here is the definition from GitLab documentation: extends defines entry names that a job that uses extends inherits from. It's an alternative to using YAML anchors and is a little more flexible and readable. So, when is it useful? It is useful when you want to be DRY and keep your setup cleanly.
The Kubernetes executor allows you to use an existing Kubernetes cluster for your builds. The executor will call the Kubernetes cluster API and create a new Pod (with build container and services containers) for each GitLab CI job.
While Jenkins boasts of a large plugin shelf, Gitlab is a comprehensive DevOps tool. While multiple plugins do your job efficiently, integration and management of these plugins might become a challenge when the project scales up. Gitlab offers SLA support.
It seems gitlab-runner exec
has some limitations, before using this functional please check with Limitations of gitlab-runner exec
As you can see for now extends
is not listed in the table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With