origin icon indicating copy to clipboard operation
origin copied to clipboard

[OKD 3.11] Testing GitLab Build Trigger - payload includes 3 commits and triggers build based on wrong commit

Open miikamoi opened this issue 6 years ago • 7 comments

Hello you lovely people!

I'm posting in hopes of verifying and/or identifying a bug.

When testing the integration in GitLab to trigger an OpenShift build, the webhook payload sent by GitLab contains an array commits containing the last 3 commits.

OpenShift triggers a build, but clones the oldest commit (which is the last one in the array) and not the newest (meaning it reverts to an older code version)

When instead pushing to the GitLab repository to trigger the webhook, the commit array only contains one entry - the most recent commit - the OpenShift build therefore is OK.

Version

oc v3.11.0+8de5c34 kubernetes v1.10.0+d4cacc0

openshift v3.11.0+1c3e643-87 kubernetes v1.11.0+d4cacc0

Steps To Reproduce

With test from GitLab

  1. Press GitLab build trigger "Test" button
  2. Payload is sent with 3 commits
  3. Build is triggered
  4. Image built with incorrect code

Actual commit to repository

  1. Payload is sent with 1 commit
  2. Build is triggered
  3. Image built with correct code
Current Result

With test - build is potentially initiated with the wrong commit, therefore building the image with outdated code.

Expected Result

When triggering builds when testing the webhook from GitLab the checkout_sha should be used to identify the commit.

Additional Information

JSON Payloads (test and actual commit)

Sensitive information has been redacted

##Payload from test trigger##

{
  "object_kind": "push",
  "event_name": "push",
  "before": "21d9e939eeb4027188eed090463a65297f854480",
  "after": "e011f39148b7c39ec72cb73b5d48a0074d22bb71",
  "ref": "refs/heads/master",
  "checkout_sha": "e011f39148b7c39ec72cb73b5d48a0074d22bb71",
  REDACTED
  },
  "commits": [
    {
      "id": "e011f39148b7c39ec72cb73b5d48a0074d22bb71",
      "message": "REDACTED",
      "timestamp": "2019-09-12T14:28:00Z",
      "url": "https://gitlab.com/REDACTED",
      "author": {
        "name": "REDACTED",
        "email": "REDACTED"
      },
      "added": [],
      "modified": [
        "views/spots/map.jade"
      ],
      "removed": []
    },
    {
      "id": "60a78657b4f808b57e8da21214ba82bb90ab64c9",
      "message": "REDACTED",
      "timestamp": "2019-04-17T21:58:07Z",
      "url": "https://gitlab.com/REDACTED",
      "author": {
        "name": "REDACTED",
        "email": "REDACTED"
      },
      "added": [],
      "modified": [
        "public/spots/map.css",
        "public/spots/map.js",
        "public/stylesheets/style.css",
        "views/spots/map.jade"
      ],
      "removed": []
    },
    {
      "id": "21d9e939eeb4027188eed090463a65297f854480",
      "message": "REDACTED",
      "timestamp": "2019-04-17T21:55:45Z",
      "url": "REDACTED",
      "author": {
        "name": "REDACTED",
        "email": "REDACTED"
      },
      "added": [],
      "modified": [
        "public/spots/map.css",
        "public/spots/map.js",
        "views/spots/map.jade"
      ],
      "removed": []
    }
  ],
  "total_commits_count": 3,
  "push_options": {},
  "repository": {
    "name": "REDACTED",
    "url": "[email protected]:REDACTED",
    "description": null,
    "homepage": "REDACTED",
    "git_http_url": "REDACTED",
    "git_ssh_url": "REDACTED",
    "visibility_level": 0
  }
}

##Payload from actual commit##

{
  "object_kind": "push",
  "event_name": "push",
  "before": "e011f39148b7c39ec72cb73b5d48a0074d22bb71",
  "after": "686e20ccf1d154cd4f29072e802495504950caee",
  "ref": "refs/heads/master",
  "checkout_sha": "686e20ccf1d154cd4f29072e802495504950caee",
  },
  "commits": [
    {
      "id": "686e20ccf1d154cd4f29072e802495504950caee",
      "message": "REDACTED",
      "timestamp": "2019-09-16T14:39:02Z",
      "url": "REDACTED",
      "author": {
        "name": "REDACTED",
        "email": "REDACTED"
      },
      "added": [],
      "modified": [
        "views/spots/map.jade"
      ],
      "removed": []
    }
  ],
  "total_commits_count": 1,
  "push_options": {},
  "repository": {
    "name": "REDACTED",
    "url": "[email protected]:REDACTED",
    "description": null,
    "homepage": "https://gitlab.com/REDACTED",
    "git_http_url": "https://gitlab.com/REDACTED",
    "git_ssh_url": "[email protected]:REDACTED",
    "visibility_level": 0
  }
}

miikamoi avatar Sep 16 '19 16:09 miikamoi

fyi @openshift/openshift-team-developer-experience

adambkaplan avatar Sep 19 '19 19:09 adambkaplan

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Dec 18 '19 22:12 openshift-bot

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten /remove-lifecycle stale

openshift-bot avatar Jan 17 '20 23:01 openshift-bot

/remove-lifecycle rotten

baer95 avatar Jan 18 '20 18:01 baer95

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot avatar Apr 17 '20 19:04 openshift-bot

/remove-lifecycle stale

baer95 avatar Apr 29 '20 09:04 baer95

/lifecycle frozen

baer95 avatar Apr 29 '20 09:04 baer95