Hi,
I have a gitlab-ci root in my repo that include locally another CI in subfolder repo.
In this one, I have extended the job created in gitlab-ci root with predefined variable, cf below:
.gitlab-ci.yml in root repo:
---
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
CI_DEBUG_TRACE: "false"
stages:
- build
- push
# - run
.build-job:
stage: build
before_script:
- docker info
script:
- env
- echo "Building Dockerfile $CI_REGISTRY/$STACK:$VERSION on branch $CI_COMMIT_BRANCH"
- VERSION=$(cat $CI_PROJECT_DIR/VERSION | cut -d " " -f1)
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor -cache=true --cache-ttl=6h --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --build-arg --destination $CI_REGISTRY/$STACK:$VERSION
include:
- local: '/administration/agent/agent.gitlab-ci.yml'
agent.gitlab-ci.yml in /administration/agent repo:
---
build-job-agent:
variables:
STACK: "agent"
extends: .build-job
I understood with include that the job running is specified in the agent.gitlab-ci.
CI_BUILD_NAME=build-job-agent in my pipeline
The problem is that all predefined env var are setup like the job was executed from the root gitlab-ci.
For example, CI_PROJECT_DIR has the value of the path root gitlab-ci whereas I would it has the value of the path of agent.gitlab-ci.
I didnt find anyhting about this in documentation or gitlab issues.
Do you have an idea about a solution to override predefined value on extended jobs ?
Thanks