Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Cannot play nor retry job #531

Copy link
Copy link
@stepps

Description

@stepps
Issue body actions

Description of the problem, including code/CLI snippet

I am scripting a few action in our gitlab-ci to be triggered from an in house management application.
I can find the project, pipeline and job as expected, but then play(), retry() and trace() fail with an http 404.
My code:

#!/usr/bin/python
 
import sys
import requests
import gitlab
 
gitlabUrl = 'https://company.gitlab-ce'
gitlabToken = 'mytoken'
gitlabProjectName = "/path/to/my/project"
gitlabPipelineTag = "build-tag"
 
 
gl = gitlab.Gitlab(gitlabUrl, gitlabToken)
project = gl.projects.get(gitlabProjectName)
 
pipelines = project.pipelines.list()
myPipeline = next((x for x in pipelines if x.ref == gitlabPipelineTag), None)
print(myPipeline)
 
myPipelineJobs = myPipeline.jobs.list()
myJob = next((x for x in myPipelineJobs if x.name == 'sync-source:prod'), None)
print(myJob)
 
action = input("Do you want to run the Job? (Y/N)")
if action.lower() == "y":
    myJob.retry()
    # Different tests with trace() and play() yeld the same results

Expected Behavior

I expect the job to be triggered or re-run

Actual Behavior

python job_trigger.py 
<class 'gitlab.v4.objects.ProjectPipeline'> => {'id': 4104, 'sha': '513dd62fe9d69df07e116662407fef6e7e5faeac', 'ref': 'ci-1.2.4', 'status': 'success'}
<class 'gitlab.v4.objects.ProjectPipelineJob'> => {'id': 22138, 'status': 'success', 'stage': 'deploy-prod', 'name': 'sync-source:prod', 'ref': 'ci-1.2.4', 'tag': True, 'coverage': None, 'created_at': '2018-06-13T19:05:48.077Z', 'started_at': '2018-06-13T19:06:58.985Z', 'finished_at': '2018-06-13T19:07:17.506Z', 'duration': 18.52052, 'user': {'id': 8, 'name': 'xxxxxxxxxx', 'username': 'xxxxxxxx', 'state': 'active', 'avatar_url': 'https://secure.gravatar.com/avatar/xxxxxxxxxxxxxxxxx?s=80&d=identicon', 'web_url': 'https://xxxxxxxxxxxxxxxxxxxx', 'created_at': '2018-03-12T15:58:19.940Z', 'bio': None, 'location': None, 'skype': '', 'linkedin': '', 'twitter': '', 'website_url': '', 'organization': None}, 'commit': {'id': '513dd62fe9d69df07e116662407fef6e7e5faeac', 'short_id': '513dd62f', 'title': 'ci test', 'created_at': '2018-06-13T16:05:35.000-03:00', 'parent_ids': ['53c2808c0350c77fe9e3f8dffadee990a0322021'], 'message': 'ci test\n', 'author_name': 'xxxxxxxx', 'author_email': 'xxxxxxxx@xxxail.com', 'authored_date': '2018-06-13T16:05:35.000-03:00', 'committer_name': 'xxxxxxxx', 'committer_email': 'xxxxxxxxxxxxxxx', 'committed_date': '2018-06-13T16:05:35.000-03:00'}, 'pipeline': {'id': 4104, 'sha': '513dd62fe9d69df07e116662407fef6e7e5faeac', 'ref': 'ci-1.2.4', 'status': 'success'}, 'runner': {'id': 18, 'description': 'Runner 14', 'active': True, 'is_shared': True, 'name': 'gitlab-runner', 'online': True, 'status': 'online'}}
Do you want to run the Job? (Y/N)y
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/gitlab/exceptions.py", line 251, in wrapped_f
    return f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/gitlab/v4/objects.py", line 956, in retry
    self.manager.gitlab.http_post(path)
  File "/usr/lib/python3.6/site-packages/gitlab/__init__.py", line 825, in http_post
    post_data=post_data, files=files, **kwargs)
  File "/usr/lib/python3.6/site-packages/gitlab/__init__.py", line 731, in http_request
    response_body=result.content)
gitlab.exceptions.GitlabHttpError: 404: b'{"error":"404 Not Found"}'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "job_trigger.py", line 37, in <module>
    myJob.retry()
  File "/usr/lib/python3.6/site-packages/gitlab/cli.py", line 42, in wrapped_f
    return f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/gitlab/exceptions.py", line 253, in wrapped_f
    raise error(e.error_message, e.response_code, e.response_body)
gitlab.exceptions.GitlabJobRetryError: 404: b'{"error":"404 Not Found"}'`

Specifications

  • python-gitlab version: (installed with pip) 1.4.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): GitLab Community Edition 10.5.2 b951e0d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.