Skip to content

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

@miikamoi

Description

@miikamoi

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": "git@gitlab.com: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": "git@gitlab.com:REDACTED",
    "description": null,
    "homepage": "https://gitlab.com/REDACTED",
    "git_http_url": "https://gitlab.com/REDACTED",
    "git_ssh_url": "git@gitlab.com:REDACTED",
    "visibility_level": 0
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions