-
Notifications
You must be signed in to change notification settings - Fork 675
Description
It should be a simple exercise, but in fact because of all the tokens it is not. There are few issues and I tried few variations, but to no avail. I am trying to trigger pipline and download artifacts of project A to pipeline that is running in project B and then use those artifacts to compile documentation.
Example I assembled based on documentation:
gl = gitlab.Gitlab('https://gitlab.melexis.com', job_token=os.environ['CI_JOB_TOKEN'])
project = gl.projects.get(project_id, lazy=True)
pipeline = project.trigger_pipeline('branchname', 'targetprojecttoken', variables={"VAR1": "True"})
# Start pipeline and wait for completion
while pipeline.finished_at is None:
pipeline.refresh()
time.sleep(1)
So, first problem was that I want to use CI_JOB_TOKEN to trigger the pipeline (not targetprojecttoken). This is something that can be done with curl, but here it does not work (tried with replacing targetprojecttoken with os.environ['CI_JOB_TOKEN'] but I get gitlab.exceptions.GitlabCreateError: 404: 404 Not Found).
Now for second more pressing issue here is that pipeline.refresh() returns gitlab.exceptions.GitlabGetError: 404: 404 Project Not Found although I confirmed that trigger_pipeline did trigger the pipeline.
Expected Behavior
trigger_pipelineshould work withjob_tokengiven toGitlabobject as based on https://docs.gitlab.com/ee/ci/triggers/#ci-job-tokenpipeline.refresh()should refresh status or request token.
Actual Behavior
trigger_pipelineworks withtargetprojecttokeninstead ofjob_tokenpipeline.refresh()returnsgitlab.exceptions.GitlabGetError: 404: 404 Project Not Found
Specifications
- python-gitlab version: 2.0.1
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): private