Why is the Build trigger complaining about Webhooks missing - azure-devops

It is time we enabled the Continuous Integration of the build pipeline, so when I went to do just that, i am seeing something strange...
The trigger appears to be enabled? yet theres a message suggesting webhooks are missing to the repo and need to be restored. When i click restore, it fails!
The remote repository’s webhooks are missing or incorrect.
An error occurred while restoring the trigger’s webhook: Could not recreate the subscription. An error was encountered while creating the existing subscription: Unable to configure a service on the selected Bitbucket repository. Bitbucket returned the error 'Your credentials lack one or more required privilege scopes.'.
I asked the admin of the repo to try restoring it because i thought maybe this is a permissions issue, and even he got the error...
This is what the repository settings page shows for both myself and the repo developer/admin...
Do we have to add a webhook manually on bitbucket?

After debugging the issue further with the developer, it appears the app password we created in bitbucket may not have had the "Webhooks" option enabled.
Unfortunately, we cannot edit app passwords in Bitbucket, which is a bad constraint but whatever.
We ended up just creating a new app password, and enabled Webhooks permissions this time, then i updated the service connection with this new app password, and wala, it worked!

Related

GitHub webhook repo is unable to trigger jenkins pipeline

Our Company used to self-host GitLab for source-code management and configured webhook on gitlab to trigger all the project pipelines on jenkins. Initially, the gitlab url was 'https://git.fulcrumdigital.com' and later for an upgraded version, they changed url to 'https://autobuild.fulcrumdigital.com'
Recently, we migrated to 'github.com' and created an organization. The source codes for various projects are found under this organization, which is private. Now, when I try to configure webhooks for these projects, I see that they deliver as intended to jenkins, but jenkins doesn't trigger the respective project's build. Instead, it gives out a message as shown below.
jenkins-github webhook error
I don't find any info regarding this webhook on global configuration page.
Here is a snapshot of jenkins logs
jenkins logs
I don't face this webhook issue for newly created pipeline-projects on jenkins. I face this issue for older pipeline-projects that already had their webhook configured earlier for gitlab.
Help me to resolve this issue and make jenkins trigger build from github webhook for older pipeline-projects.
Did you try force regenerating the webhooks?
Go to Manage Jenkins > Configure System > GitHub plugin > Advance > Re-registers hooks for all jobs.
I had this problem myself. The first thing you want to do is go to Manage Jenkins -> Configure System scroll down to the GitHub section and click on "Advanced". You will see this:
It's important to have access to your Jenkins log (I'm running Jenkins with Docker). When I clicked on Re-register hooks for all jobs, I got the following error:
In my case, the error mentioned something with my access token. So, I checked my Github personal access token and it turned out, I need to turn on Read and Write for Webhook:
Now, go back to Jenkins and click on Re-register hooks for all jobs again, and on the next push, the build was automatically triggered.

Heroku/Github set up connection issue?

I am doing an exercise where I've a forked repository, and started a heroku account, did "create a new app" and "deploy with github" but when I go to connect to github, a red error message pops up saying "Error: remote could not connect or was closed."
I have had no problems connecting github to other services, and I've found other people with connection issues, but more along the lines of "why isn't my app working" and mine is" why can't i link the two so I can continue with this exercise?"
Any help is greatly appreciated.
I've followed the instructions after setting up a heroku account, having an app repository fork on github, confirming my email, "create a new app" option on heroku, and on the ensuing "deploy" tab, clicked on the "connect github" option. I expected it to work.
Yes this is a known issue and caused by some data breach related to Github Authorization. Security measures have taken place and Github authorization has been disabled until further notice. Please see
https://github.blog/2022-04-15-security-alert-stolen-oauth-user-tokens/
And based on this ongoing incident,
As reported yesterday, revocation of all OAuth tokens from the Heroku
Dashboard GitHub integration is complete. Until further notice, we
will not issue OAuth tokens from the Heroku Dashboard. These actions,
based on our current understanding of the issue, should prevent
unauthorized access to your GitHub repositories.
We will continue to work with GitHub to provide additional guidance on
how to review your GitHub logs for evidence of exfiltration or
malicious activity. Please reach out to security#salesforce.com with
any information that may assist us with our ongoing investigation.
Please continue to visit status.heroku.com for the latest updates.
If you still want to deploy, you can switch from GitHub to Git quite easily, please read this: https://help.heroku.com/CKVOUPSY/how-to-switch-deployment-method-from-github-to-heroku-git-with-all-the-changes-app-code-available-in-a-github-repo

Unauthorized Response from Azure DevOps

Our client is using for Azure DevOps for code repository. I've been able to connect and pull/push code for a year without issue.
I started on a new project for this client that uses the ADO Artifacts for a NuGet store. My windows login for this project is different than my ADO account so when I build the solution in VisualStudio I get asked for credentials for the NuGet store. I enter my credentials and it immediately asks me again for creds. It does this 4 or 5 times then finally fails.
Minutes to hours later, I can no longer pull/push code from the Git repos. I've tried switching to a PAT but same result. I can get into ADO through a browser and see the repositories. I'm an org admin but can't see users and permissions during this time. If I wait a few hours, it will start working again. I verified my user is NOT locked in AzureAD. I get denied on all devices (on and off client network).
I think I've fixed the issue of the NuGet authentication but does anyone know if there's a "lock out" feature in ADO that I'm missing? If so, is there a way to "unlock" the user when this happens.
The error I get back in Git seems to be a standard failed authentication:
fatal: Authentication failed for 'https://****.visualstudio.com/DefaultCollection/projectname/_git/repo-name/'

Azure Devops clone This is not a valid source path in source tree

I have managed to finally add my devops account in sourcetree using the https://orgname.visualstudio.com path
Now I am having issues cloning the repository
I am using the path that devops gives me
https://orgname#dev.azure.com/orgname/MyProject/_git/MyRepo
but I get an error saying
This is not a valid source
The details reveal authentication issues... Yet it authenticated fine when adding the account.
What is going on? Does the azure account have to be the default account?
I managed to fix this by changing from the sourcetree embedded git to my system git Tools>Options>Git>Git Version>Select System. Afterwards when trying again it prompted me to login on my organization domain with 2 factor as if logging in on the devops web app directly.
My system Git is using manager-core for the credential management which is probably not the same system which the embedded version used.
I tried the above solutions (and more) but for me what in the end solved the problem was that the git-password I first wrongly entered when I tried to access the repo had been saved in Keychain (MacOS) and when I tried again this password was used without giving me the option to type it in again. I deleted the password to the Azure DevOps project in Keychain and then got prompted to enter the password again whereafter I pasted the Personal Access Token (!!) generated in Azure Devops and it finally worked!
It could happen when you entered wrong credentials and you don't get asked again, try this:
Go to : Sourtree->Preferences->Advance (tab)
Under: "Default usernames for URLs which do not include one:" delete your wrong credentials.
Try accessing your repo again with right credentials.
This is not the issue which caused by Azure devops. No matter https://xxx.visualstudio.com, or the URL which like dev.azure.com, they should all available git source.
For me, I just try with multi different git URLs, and found the few of URLs are failed with same error with you. But it prompt This is a git repository after I exit the SourceTree and re-configure the clone with same URL which encountered the error previously.
This seems be the most common Sourcetree problem which encountered by many users, not just the URL of azure devops that you occurred.
Check this thread, and try with its recommend way:
Open source tree, Tools -> Options -> Click on Git Tab -> Update
Embedded Git.
Or, consider the method I used: exit the Sourcetree, and re-configure the clone with same URL. (Not recommend since this can not permanently solve this issue)

AWS CodeBuild Github webhook does not update status of PullRequest

Using the official guide, created build project to run tests on GitHub PullRequests creation. The webhook is correctly shown on GitHub, builds are being triggered in Codebuild, however, the build status is not shown in Github, despite the option Report build status is set true. If I correctly understood the tutorial, Codebuild has native support of GitHub, and after successful creation of a webhook, the new verification check should be added for PR submission automatically, any suggestions to make this work?
It should work automatically. If builds are triggering but codebuild is not reporting back on the status, then it sounds like the codebuild project no longer has permission to the repo. You could try adding the GitHub source to codebuild again.
"Report build status" actually has no effect when triggered by a webhook, and should always report back in theory (https://docs.aws.amazon.com/codebuild/latest/userguide/change-project.html). It's set to false for my project and always updates the pull requests.
Ensure the GitHub user has write access to the repository, and if you're using a Personal Access Token (PAT), ensure the repo:status scope is granted:
Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.
https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/
(I experienced this issue recently. The PAT had the necessary scopes granted but the GitHub user had read-only access to the repository. Granting the GitHub user write permission solved the problem.)