- Notifications
You must be signed in to change notification settings - Fork676
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 completionwhile pipeline.finished_at is None: pipeline.refresh() time.sleep(1)
So, first problem was that I want to useCI_JOB_TOKEN
to trigger the pipeline (nottargetprojecttoken
). This is something that can be done with curl, but here it does not work (tried with replacingtargetprojecttoken
withos.environ['CI_JOB_TOKEN']
but I getgitlab.exceptions.GitlabCreateError: 404: 404 Not Found
).
Now for second more pressing issue here is thatpipeline.refresh()
returnsgitlab.exceptions.GitlabGetError: 404: 404 Project Not Found
although I confirmed thattrigger_pipeline
did trigger the pipeline.
Expected Behavior
trigger_pipeline
should work withjob_token
given toGitlab
object as based onhttps://docs.gitlab.com/ee/ci/triggers/#ci-job-tokenpipeline.refresh()
should refresh status or request token.
Actual Behavior
trigger_pipeline
works withtargetprojecttoken
instead ofjob_token
pipeline.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