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

Orb not working properly for BitBucket #22

Closed
jlenos opened this issue Feb 5, 2019 · 6 comments · Fixed by #37
Closed

Orb not working properly for BitBucket #22

jlenos opened this issue Feb 5, 2019 · 6 comments · Fixed by #37
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest orbtoberfest

Comments

@jlenos
Copy link

jlenos commented Feb 5, 2019

I am trying to use this as the first step in one of my jobs.

queue/until_front_of_line:
  vcs-type: bitbucket

I triggered 2 workflows that utilized the same job.
I expected it not to continue but it still did with the following output.

queues queueable
This build will block until all previous builds complete.
Max Queue Time: 10 minutes.
Only blocking execution if running previous jobs on branch: queues
Attempting to access CircleCI api. If the build process fails after this step, ensure your CIRCLECI_API_KEY is set.
API access successful
Orb parameter block-worflow is false.
Only blocking execution if running previous jobs matching this job: build_release-1
Oldest job: 
This Workflow Timestamp: ""
Oldest Workflow Timestamp: ""
Front of the line, WooHoo!, Build continuing

The This Workflow Timestamp: "" line looked suspicious so I decided to dig into the code.
I found that when calling the API, I was seeing this for all jobs:

"all_commit_details" : [ {
    "committer_date" : "",
    "body" : "",
    "branch" : "queues",
    "author_date" : "2019-02-05T19:25:55+00:00",
    ...

Seeing that this was likely the cause, I went and copied all the code and swapped out committer_date with author_date and also tried queued_at. Both allowed this step to work as intended.
Is it possible to get a new version of this orb that utilizes author_date or queued_at in the case where committer_date is not populated?

@eddiewebb
Copy link
Owner

Thanks for the detailed write up! I'll need to confirm that the 2 suggested dates are authoritative to the ordering of commits on the repo, and if so can swap this out.

@eddiewebb eddiewebb added bug Something isn't working good first issue Good for newcomers labels Feb 5, 2019
@jlenos
Copy link
Author

jlenos commented Apr 25, 2019

@eddiewebb Any update on this issue? We would like to use this Orb as we hit failed deployments at least once a week and having this working would prevent that.

@stevenharman
Copy link

stevenharman commented Aug 5, 2019

This seems odd as committer_date is from Git itself, rather than something added by GitHub/Bitbucket. Specifically, author_date is when commit was originally made But committer_date is changed when commit is modified, e.g., when rebasing the branch, applying a patch, etc...

At least, that's my understanding. Which still leaves me wondering why bitbucket isn't giving that value.

@prashcr
Copy link
Contributor

prashcr commented Oct 6, 2019

From my understanding, both committer_date and author_date are from git:
https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
https://stackoverflow.com/a/11857467

It's quite strange that committer_date is blank, but I don't think we can move further without a repro BitBucket repository/commits.
I don't think we should use author_date as it may be completely different from the committer_date. E.g. commit made 2 weeks ago on branch B was merged into branch A today.
I assume queued_at should be very similar to committer_date, with a slight delay as a commit needs to be processed by VCS and then CircleCI before it's queued.

I'll create a PR that uses queued_at if the committer_date is blank, let me know if there are any concerns.

@eddiewebb
Copy link
Owner

The new v2 API exposes means to get the date the underlying trigger was received, which should be authoritative.

This will be a2 step call to get the pipeline id of the current job, and then get pipeline details, which includes the received date of trigger.

https://eddiewebb.github.io/circleci-samples/ includes API docs.

This new endpoint also should help us eliminate race scenario by collecting status of workflows, and not individual jobs

@eddiewebb
Copy link
Owner

eddiewebb commented Oct 14, 2019

@kobim has contributed a fix that should address this, please anyone who can test and feedback on eddiewebb/queue@dev:37

@bors bors bot closed this as completed in deb8249 Oct 21, 2019
@bors bors bot closed this as completed in #37 Oct 21, 2019
bors bot added a commit that referenced this issue Mar 31, 2023
99: version catchup [semver:patch] r=eddiewebb a=eddiewebb

### THIS IS A BREAKING CHANGE

Per issue #22 , BB did not pass commit specific timing, and so we used worklflow.  

### Motivation, issues

In a world of dynamic config many workflows can start after their initial pipeline, and will not follow in sequential order.  We therefore cant use workflow timing data.

### Description

<!---
  Describe your changes in detail, preferably in an imperative mood,
  i.e., "add `commandA` to `jobB`"
 -->


Co-authored-by: Achilleas Triantafyllou <axilleastriant10@gmail.com>
Co-authored-by: Eddie Webb <ollitech@gmail.com>
Co-authored-by: Eddie Webbinaro <ollitech@gmail.com>
bors bot added a commit that referenced this issue Mar 31, 2023
99: version catchup [semver:patch] r=eddiewebb a=eddiewebb

### THIS IS A BREAKING CHANGE

Per issue #22 , BB did not pass commit specific timing, and so we used worklflow.  

### Motivation, issues

In a world of dynamic config many workflows can start after their initial pipeline, and will not follow in sequential order.  We therefore cant use workflow timing data.

### Description

<!---
  Describe your changes in detail, preferably in an imperative mood,
  i.e., "add `commandA` to `jobB`"
 -->


Co-authored-by: Achilleas Triantafyllou <axilleastriant10@gmail.com>
Co-authored-by: Eddie Webb <ollitech@gmail.com>
Co-authored-by: Eddie Webbinaro <ollitech@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest orbtoberfest
Projects
None yet
4 participants