Jigit timestamp is not in sync with Gitlab

Issue #7 resolved
Marcel Höll created an issue

In the Jigit section in each issue in JIRA, the displayed timestamp is note the same as seen in Gitlab. Are you doing some time conversion or which time is beeing displayed in the Jigit section? Sometimes it is 2 hours more and somtimes 3 or 4.

Comments (9)

  1. Dmitrii Apanasevich repo owner

    Bug is fixed and new version 1.0.5 is on the Marketplace.

    All new commits will be indexed with a correct timestamp. Unfortunately, there is no other way to correct timestamps of already indexed commits than to reindex all repository again. I've added new action "Reindex" to this purpose. This action removes all indexed commits and starts new indexing of a repository.

    Please, confirm that timestamps are ok after the fix.

  2. Marcel Höll reporter

    Now my problem is, that the commits are index, but the branches are switched, so the "master" branch is show as "branch1" in Jira and vice versa in the Jigit config section. Or maybe it is just a displaying issue in Jigit? As I see now, the commits show up right in each Jira issue itself. And also, the time is not correct anyway. In Gitlab it shows up as commited "07 Sep 11:51 am" and in Jira it shows up with "07 Sep 13:51" (maybe from GMT+2).

  3. Dmitrii Apanasevich repo owner

    *Now my problem is, that the commits are index, but the branches are switched, so the "master" branch is show as "branch1" in Jira and vice versa in the Jigit config section. Or maybe it is just a displaying issue in Jigit? *

    I'll answer it later, I have to check the code first.

    And also, the time is not correct anyway. In Gitlab it shows up as commited "07 Sep 11:51 am" and in Jira it shows up with "07 Sep 13:51" (maybe from GMT+2).

    Maybe, it's connected with different time zones in JIRA and GitLab? Add-on should display commit timestamp in the timezone of a JIRA instance. Let's check it.

    You need to call GitLab API with curl (https://curl.haxx.se/). Here is the pattern:

    curl -k --header "PRIVATE-TOKEN: {YOUR_TOKEN}" "{GITLAB_URL}/projects/{REPO_NAME}/repository/commits/{COMMIT_SHA1}"
    

    Replace placeholders with correct values. The only challenge is to replace symbol / in repo name with %2F. You'll get something like this:

    curl -k --header "PRIVATE-TOKEN: it_is_a_secret" "https://gitlab.com/projects/gitlab-org%2Fgitlab-ce/repository/commits/faefeac880a634679db0dc2a74cc9ff938cf9713"
    

    This API call returns all data related to a comment. You can see a commit timestamp in field 'authoted_date'. Please, compare it's value with what GitLab and JIRA display.

  4. Marcel Höll reporter

    Okay, I've tested it all again and checked some commits and timestamps. What I see now is, that with some users the timestamps are incorrect, so I think the timestamps are generated on the local committing machine with wrong timezone settings. I've checked it for right commits with correct time seetings. These commits will be displayed correctly inside Jira.

    But the branches are switch in the config section...

  5. Dmitrii Apanasevich repo owner

    But the branches are switch in the config section...

    Hi!

    Could you please execute a simple query in your JIRA database:

    select propertyvalue
    from propertytext join propertyentry on propertyentry.id = propertytext.id 
    where entity_name = 'com.apanasevich.jira-jigit-plugin'
    

    It'll show you plugin setting in json representation. Don't show me the result, just look for a value in field "defaultBranch" for the repo with such a problem.

    It should look something like this:

    {...,"defaultBranch":"master", ...}

    You can use this link to make json pretty printed for convinience.

  6. Dmitrii Apanasevich repo owner

    Hi!

    There is a new version in the Marketplace, which includes UI changes in configuration page: it displays repositories and branches (except the default branch) in lexicographical order. The default branch is always on the top.

  7. Log in to comment