Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate record on build #2819

Open
viraptor opened this issue Jun 22, 2018 · 1 comment
Open

Duplicate record on build #2819

viraptor opened this issue Jun 22, 2018 · 1 comment

Comments

@viraptor
Copy link
Contributor

I got an error (on 2 different deploys) with:

ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_releases_on_project_id_and_number"
DETAIL: Key (project_id, number)=(72, 3) already exists.
: INSERT INTO "releases" ("project_id", "commit", "number", "author_id", "author_type", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"
+ 67 non-project frames
  68 File "/var/www/samson/releases/1/app/models/release_service.rb" line 8 in release
  69 File "/var/www/samson/releases/1/app/controllers/integrations/base_controller.rb" line 63 in find_or_create_release
  70 File "/var/www/samson/releases/1/app/controllers/integrations/base_controller.rb" line 20 in create

The request was started from buildkite integration. Slightly sanitized event is:

{
  "event": "build.finished",
  "build": {
    "id": "90827f6f-56e1-4706-8a12-e2adf73686b4",
    "url": "https://api.buildkite.com/v2/organizations/.../builds/1219",
    "web_url": "https://buildkite.com/.../builds/1219",
    "number": 1219,
    "state": "passed",
    "blocked": false,
    "message": "Merge pull request #269 from ...,
    "commit": "0969ba12595870e21a4fdf369b5a6ded577e7f48",
    "branch": "master",
    "tag": null,
    "source": "webhook",
    "creator": {
      "id": "b70c9d1f-a345-4a1c-990f-f51fce36ff5e",
      "name": "...",
      "email": "...",
      "avatar_url": "https://www.gravatar.com/avatar/...",
      "created_at": "2015-03-02 05:04:56 UTC"
    },
    "created_at": "2018-06-05 01:38:26 UTC",
    "scheduled_at": "2018-06-05 01:38:26 UTC",
    "started_at": "2018-06-05 01:43:07 UTC",
    "finished_at": "2018-06-05 01:45:41 UTC",
    "meta_data": {
      "buildkite:git:commit": "commit 0969ba12595870e21a4fdf369b5a6ded577e7f48\nMerge: e81c28d 8b06306\nAuthor: ...\nAuthorDate: Tue Jun 5 11:38:24 2018 +1000\nCommit: GitHub <noreply@github.com>\nCommitDate: Tue Jun 5 11:38:24 2018 +1000\n\n Merge pull request #269 from ..."
    },
    "pull_request": null
  },
  "pipeline": {
    "id": "989b955c-702e-4e10-b94f-91abbac80c63",
    "url": "https://api.buildkite.com/v2/organizations/...",
    "web_url": "https://buildkite.com/...",
    "name": "...",
    "description": ":dollar:",
    "slug": "...",
    "repository": "git@github.com:....git",
    "branch_configuration": null,
    "default_branch": "master",
    "skip_queued_branch_builds": false,
    "skip_queued_branch_builds_filter": null,
    "cancel_running_branch_builds": false,
    "cancel_running_branch_builds_filter": null,
    "provider": {
      "id": "github",
      "settings": {
        "trigger_mode": "code",
        "build_pull_requests": true,
        "pull_request_branch_filter_enabled": false,
        "skip_pull_request_builds_for_existing_commits": true,
        "build_pull_request_forks": false,
        "build_tags": false,
        "publish_commit_status": true,
        "publish_commit_status_per_step": false,
        "repository": "..."
      },
      "webhook_url": "https://webhook.buildkite.com/deliver/..."
    },
    "builds_url": "https://api.buildkite.com/v2/organizations/.../builds",
    "badge_url": "https://badge.buildkite.com/....svg",
    "created_at": "2017-03-27 05:12:27 UTC",
    "env": {},
    "scheduled_builds_count": 0,
    "running_builds_count": 0,
    "scheduled_jobs_count": 0,
    "running_jobs_count": 4,
    "waiting_jobs_count": 0,
    "steps": [
      {
        "type": "script",
        "name": ":pipeline:",
        "command": "buildkite-agent pipeline upload",
        "artifact_paths": "",
        "branch_configuration": "",
        "env": {},
        "timeout_in_minutes": null,
        "agent_query_rules": [
          "queue=platform-docker-spot"
        ],
        "concurrency": null,
        "parallelism": null
      }
    ]
  },
  "sender": {
    "id": "b70c9d1f-a345-4a1c-990f-f51fce36ff5e",
    "name": "..."
  }
}

Version v2235
I don't really know the conditions why it happened. Happy to provide more details if needed.

@grosser
Copy link
Contributor

grosser commented Jun 22, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants