How to validate GitHub is communicating with OpenShift cartridge running Jenkins? - github

I have a GitHub hook for a new check-in, but it is not being received by Jenkins (running on a RedHat OpenShift cartridge).
Setup
RedHat OpenShift cartridge running Jenkins
Jenkins plugins in-play
GitHub plugin v1.8
Github Authentication plugin v0.14
Jenkins GIT client plugin v1.4.5
Jenkins GIT plugin v2.0
Public GitHub repository
Debugging
I have narrowed it down specifically to GitHub communicating with OpenShift, but am unsure how to troubleshoot any further, or resolve the issue. To narrow it down, I performed the following steps:
Configured one of each of the following types of Service Hooks in GitHub and captured the results in RequestBin
WebHook URL
Jenkins GitHub Plugin
Jenkins Git Plugin
I then ran Test Hook from GitHub
I took the resultant headers and payload from each RequestBin and manually created a POST request in Fiddler, pointing to the webhook endpoint
I saw some action on Jenkins by logging against com.cloudbees.jenkins.GitHubWebHook
However, the Test Hook from GitHub and checking into the repository never reached the server, at least not as evidenced by the logs.
I believe I have narrowed it down to an SSL issue. GitHub will not post the webhook to an OpenShift configured Jenkins cartridge, because it only responds to SSL/HTTPS. I am not sure of the specifics of how the canned Jenkins cartridge is configured, or how to change whether or not it uses SSL.
It is possible to change whether or not the OpenShift cartridge uses SSL, but I did not want to spend the time to get into it. The solution is to create your own cartridge definition, where you can specify all the settings, specifically which endpoints get created. Here is the OpenShift reference to generate the proper endpoints in case anyone wants to go that route.

I believe I have narrowed it down to an SSL issue. GitHub will not post the webhook to an OpenShift configured Jenkins cartridge, because it only responds to SSL/HTTPS. I am not sure of the specifics of how the canned Jenkins cartridge is configured, or how to change whether or not it uses SSL.
It is possible to change whether or not the OpenShift cartridge uses SSL, but I did not want to spend the time to get into it. The solution is to create your own cartridge definition, where you can specify all the settings, specifically which endpoints get created. Here is the OpenShift reference to generate the proper endpoints in case anyone wants to go that route.

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.

GitHub Could not create service hooks subscription Unable to configure a service on the selected GitHub... Resource not accessible by integration

When I try to update the environment variables on an Azure DevOps release pipeline, I get the error below.
GitHub Could not create service hooks subscription Unable to configure a service on the selected GitHub repository. GitHub returned the error 'Resource not accessible by integration'.
I am an admin on the GitHub repo.
In Get sources, it is currently configured for a GitHub OAuth Service Connection. Another user is able to update the environment variables. I am using GitHub (not enterprise).
Is this an Azure DevOps permission that I do not have?
Is this an Azure DevOps permission that I do not have?
This error message usually comes with GitHub App installation token service connection.
Go Project Settings => Service Connections to check the details of the specific service connection. If your service connection is GitHub App installation token based service connection, then it's expected behavior to meet that issue. Our team are working on adding that support so far, please check this ticket.
Workaround:
1.Create a new service connection with OAuth/PAT method and use it in your pipeline. Since you're admin of the github repo, a Github PAT is more recommended.
2.If you have permission to the service connections and to the pipeline, this issue won't occur. Ask your Azure Devops project admin to via manage security.
After working with ADO tech support, it was discovered that we needed to remove the artifact and trigger definition from the release pipeline, and then re-add it. It is believed that there was cached service connection, and this updated the pointer to the correct service connection.
I was facing a similar issue when attempting to enable CI for a build and found this article and after digging in deeper I discovered that the issue was the actual PAT we created for the automation. What we missed originally was enabling the admin:repo_hook for the repository. This took longer to uncover than it should have, but just wanted to add that, as removing and re-adding things didn't really do anything for us.

How to add use Github Webhooks to deploy changes to a LEMP server running in Individual Docker Containers

I have a server running ubuntu 18.04 running 3 Docker containers for Nginx, PHP, and MySql. Everything seems to be working correctly within the application which right now is just a test wordpress blog. However I am attempting to add Github Webhook deployments and I am a little lost as to how I should proceed. A few options
Should I setup a webserver on the Host system and trigger a php file to run and execute git pull? I suppose I could subdomain it to keep SSL validation constant.
Is there a way to pass ssh keys to one of the containers such as the php one and allow that to pull from the repo? I tried this and ran into user and group permission 1000 issues.
Is there a way for the docker containered application of nginx to execute code on the host server(The naked server running docker)?
Is there a simpler solution that I am not thinking of involving deployments? I would prefer not to use a paid service.
Are you using travis-ci or Jenkins to continuous delivery?
These tools help you to do some change in your server when you do a new pull request over your repo of GitHub.
I will show you one project that I was worked using travis-ci where I could deploy my App on Aws or connecting to one host that has docker installed and make new changes.
I'll share you some continuous delivery articles below
Travis continuous delivery
Jenkins SSH credentials setting
Jenkins from scratch CI/CD
Try to get new knowledge about Continuous Integration and Continuous Delivery, is the best way to automate those kinds of processes

Github Pull Request is not triggering TeamCity

My TeamCity CI has the plugin GitHub Commit Hooks provided by Jetbrains to detect new pull requests and trigger a run. I've installed this plugin and configured it clicking here:
After that, the web hook is created on GitHub but the address is 0000:8111 which is wrong. So I change to the correct DNS and redeliver the request.
It seems to work, the server returns 202 with the message Scheduled checking for changes for 2 VCS roots. (Server time: 20180615T122359.142+0100) but the trigger is not working.
After a while another problem happens, the server starts rejecting the requests and GitHub returns this:
No stored auth data (secret key) found for public key "72WE45221-19fe-433b-9265-66b2168EW6c". Seems hook created not by this TeamCity server. Reinstall hook via TeamCity UI.
Environment:
TeamCity version: 2017.2.4 (build 51228)
GitHub Commit Hooks version: 62
What I can do to solve this issue? Is there any issue with my DNS?
EDIT 1:
Now I am able to trigger the build by commits and solved the secret key issue. But pull requests are not triggering the CI.
To solve the secret key issue, you need to change the Server URL on Global Settings.
A bit of a workaround, but have you tried using a VCS trigger to detect and build pull requests rather than a commit hook? This works the same as any other VCS check in trigger, so if your current configuration is already detecting VCS changes from Github it should be more straightforward to setup.
Pull requests on Github are automatically referenced using the following pattern +:refs/pull/*/head so with a VCS branch specification you can have a TeamCity build project that's dedicated to building pull requests.
See https://blog.jetbrains.com/teamcity/2013/02/automatically-building-pull-requests-from-github-with-teamcity/
I had a similar issue; the solution is to change the TC installation's settings so it's aware of its correct URL, and then re-adding the webhook through the plugin. The setting in question is Administration > Server Administration > Global Settings > Server Url:

Github Enterprise - Plugin for Jenkins

I'm trying to get the post-commit hooks for github enterprise to talk to our internal jenkins server. Been trying for the last several hours and haven't been able to get it working.
What I was able to do is get the github enterprise webhook with url:
http://192.168.10.123:8080/job/Github%20Build%20Test/build
working to kick off a build.
I'm not able to authenticate with github enterprise using either the basic authentication or oauth2 authentication tokens.
Also with manual setup it doesn't seem to work either. Any ideas / help?
I think you may need to wait for v1.41 of the Jenkins GitHub API plugin
See this pull request