Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do you add custom HTTP headers to a webhook? Edited

I'm trying to mirror a bitbucket repo to gitlab and need to add a custom header, PRIVATE-TOKEN, containing my gitlab access token, in order to invoke gitlab's mirror pull API:  https://gitlab.com/help/api/projects.md#start-the-pull-mirroring-process-for-a-project-starter.

There's no option for it in the webhook creation dialog.  How can I do that?

-matthew

 

1 answer

1 accepted

1 vote
Answer accepted
Dario B Atlassian Team Mar 04, 2020

Hi @Matthew Adams ,

Welcome to the Atlassian Community!

Even if there is no possibility at the moment to add custom headers to Bitbucket Webhooks, the way to send authenticated WebHooks to Gitlab seems to be described in the below documentation page (from Gitlab):

  • Using GitLab CI/CD with a Bitbucket Cloud repository
    1. In GitLab create a CI/CD for external repo, select Repo by URL and create the project.

      Create project

      GitLab will import the repository and enable Pull Mirroring.

    2. In GitLab create a Personal Access Token with api scope. This will be used to authenticate requests from the web hook that will be created in Bitbucket to notify GitLab of new commits.

    3. In Bitbucket, from Settings > Webhooks, create a new web hook to notify GitLab of new commits.

      The web hook URL should be set to the GitLab API to trigger pull mirroring, using the Personal Access Token we just generated for authentication.

      https://gitlab.com/api/v4/projects/<PROJECT_ID>/mirror/pull?private_token=<PERSONAL_ACCESS_TOKEN>
      

      The web hook Trigger should be set to ‘Repository Push’.

      4. [....]

 

 

Together with the above one, you may want to also review below liks:

 

 

For the rest, it might be worth also mentioning that:

  1. Two way integration can also be achieved by using the add-on: "Sync Bitbucket with GitLab"
  2. There are the below feature requests open in our system that you may want to vote for, and watch for updates:

 

I hope this helps.

 

Cheers,
Dario

Hi @Dario B

Thanks for the suggestion.  Adding the query string argument `private_token` to the gitlab url actually worked.  Thanks!

-matthew

Like Dario B likes this

There is a compromise in this solution:  the GitLab token is viewable in clear text by anyone who can see the project settings.

I'll see if I can chime in on the issues linked herein.

Like Dario B likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

533 views 4 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you