CloudBuild Github PR workflow is queued and its running indefinitely - google-cloud-build

I have a cloudbuild.yaml file in my code. I have configured it in a manner where for each pull request, a cloud run url is hosted with prefix as PR_NUMBER from Github and the cloudrun url will be like
https://PR_NUMBER---app-abcd123-uc.a.run.app
Once the URL is tested, code will be merged into dev.
Problem: After a pull request, a build trigger is initiated in cloudbuild and it was finished in 7 minutes. But in the Github, it shows that it has been queued and still running for more than 12 hours. Its costing money in github for running. I am trying to cancel it. But I could not see any option in github to cancel it.
Any idea what could be the reason behind this issue of build got queued in github even though its finished inside cloud build google platform.?

Related

Ignoring github actions when automatically deploying on heroku with "Wait for CI" enabled

Question Summary
Is it possible to have "Wait for CI to pass before deploy" enabled on Heroku and have it wait for CircleCI only, not any Github Actions?
Details
WE have a heroku setup linked to a github repository (not using the heroku git repo) which is set to automatically deploy from the default branch when CI (CircleCI) passes. On the github repo we have a job that runs SonarQube over the repository.
The CI job itself takes ~7 minutes, but the SonarQube job is longer, taking upwards of 15 minutes to run.
Our issue is that Heroku appears to be waiting for the GHA job to finish before running the automatic deployment, which is not what I want. Analysis is separate to tests passing.
Tried
Originally, the GHA job was set to autorun on pushes to master. We thought that might be the issue, so changed the setup so that the GHA job only runs on a repository action, which we then triggered from a job on CircleCI on pushes to master. So the CCI job runs to completion in seconds, leaving the GHA to run. Heroku is still waiting.
Ideas
It seems sensible to trigger the deploys from CircleCI jobs after the tests have all passed, but the APIs for heroku seem more focused on deploying by pushing to heroku repos, rather than triggering a build from a github repo.
Move completely to containerised builds rather than building on Heroku (longer term that's the plan, but we'd like to claw back the dead build time before that)

How can i remove Azure Pipeline Build from GitHub checks

I just setup CI/CD for a GitHub repo.
The CI build which validates a pull request is setup up as GitHub Action.
The CD build (which should run after the pull request was merged) is setup using Azure Pipelines as i would like to use the artifacts generated as a trigger for a Release Pipeline using Azure Pipelines as well.
The only thing that's still bugging me is, that the CD Build is also triggering automatically for a pull request and i can't figure out where i can configure those checks.
The checks currently running when a pull request is created are the following:
I want to get rid of the Continous Delivery Build here.
I tried to configure the branch protection rules but this has no effect:
On the Azure Pipeline side i completely disabled the triggers:
But this also has no visible effect to me.
I tested Disable pull request validation in the Triggers of the azure devops pipeline. On my side, it works well, and the build pipeline validation check is not displayed in the github pull request.
You can first check whether the pipeline source repo that you set the "Disable pull request validation" option corresponds to the github repo that created the pull request. Then try a few more times, it is possible that the settings are not applied immediately.
In addition, as workaround you can opt out of pull request validation entirely by specifying pr: none in yaml. Please refer to this official document.
# no PR triggers
pr: none

Took more time to initiate CI job when GitLab merge request created

I am using the Gitlab version of GitLab Community Edition 10.3.5.
For Gitlab integration with CI, I have written the Gitlab webhook and using it for CI using Jenkins.
While creating a new merge request in Gitlab, it's taking more time to initiate the Jenkins job nowadays.
While test the webhook in Gitlab, its executed successfully and also got the success message as below.
Hook executed successfully: HTTP 200
But, we are not getting post data values from the configured webhook in Gitlab project quickly and it's taking much time to update the post data values
Due to this, Jenkin's job took more time to initiate and run.
Note that there is no issue with Jenkins and Gitlab server access. It is very fast and active. Job initiating in Jenkins and delay in delivering the post data values to the webhook when MR created making the problem. How to resolve this?
Any suggestions would be much appreciated.
Thanks in advance.

How to push from Gitlab to Github with webhooks

My Google-fu is failing me for what seems obvious if I can only find the right manual.
I have a Gitlab server which was installed by our hosting provider
The Gitlab server has many projects.
For some of these projects, I want that Gitlab automatically pushes to a remote repository (in this case Github) every time there is a push from a local client to Gitlab.
Like this: client --> gitlab --> github
Any tags and branches should also be pushed.
AFAICT I have 3 options:
Configure the local client with two remotes, and push simultaneous to Gitlab and Github. I want to avoid this because developers.
Add a git post-receive hook in the repository on the Gitlab server. This would be most flexible (I have sufficient Linux experience to write shell scripts as git hooks) and I have found documentation on how to do this, but I want to avoid this too because then the hosting provider will need to give me shell access.
I use webhooks in Gitlab. I am unfamiliar with what the very basics of webhooks are, and I am unable to locate understandable documentation or even a simple step-by-step example. This is the documentation from Gitlab that I found and I do not understand it: http://demo.gitlab.com/help/web_hooks/web_hooks
I would appreciate good pointers, and I will summarize and document a solution when I find it.
EDIT
I'm using this Ruby code for a web hook:
class PewPewPew < Sinatra::Base
post '/pew' do
push = JSON.parse(request.body.read)
puts "I got some JSON: #{push.inspect}"
end
end
Next: find out how to tell the gitlab server that it has to push a repository. I am going back to the GitLab API.
EDIT
I think I have an idea. On the server where I run the webhook, I pull from GitLab and then I push to Github. I can even do some "magic" (running tests, building jars, deploying to Artifactory,...) before I push to GitHub. In fact it would be great if Jenkins were able to push to a remote repository after a succesful build, then I wouldn't need to write my own webhook, because I'm pretty sure Jenkins already provides a webhook for Gitlab, either native or via a plugin. But I don't know. Yet.
EDIT
I solved it in Jenkins.
You can set more than one git remote in an Jenkins job. I used Git Publisher as a Post-Build Action and it worked like a charm, exactly what I wanted.
would work of course.
is possible but dangerous because GitLab shell automatically symlinks hooks into repositories for you, and those are necessary for permission checks: https://github.com/gitlabhq/gitlab-shell/tree/823aba63e444afa2f45477819770fec3cb5f0159/hooks so I'd rather stay away from it.
Web hooks are not suitable directly: they make an HTTP request with fixed format on certain events, in your case push, not Git protocol requests.
Of course, you could write a server that consumes the hook, clones and pushes, but a service (single push and no deployment) or GitLab CI (already implements hook management) would be strictly better solutions.
services are a the best option if someone implements it: live in the source tree, would do a single push, and require no extra deployment overhead.
GitLab CI or othe CIs like Jenkins are the best option currently available. They are essentially already implemented server for the webhooks, which automatically clone for you: all you have to do then is to push from them.
The keywords you want to Google for are "gitlab mirror github". That has led me to: Gitlab repository mirroring for instance. There seems to be no perfect, easy solution today.
Also this has already been proposed at the feature request forum at: http://feedback.gitlab.com/forums/176466-general/suggestions/4614663-automatic-push-to-remote-mirror-repo-after-push-to Always check there ;) Go and upvote the request.
The key difficulty now is how to store the push credentials.
I solved it in Jenkins. You can set more than one git remote in an Jenkins job. I used Git Publisher as a Post-Build Action and it worked like a charm, exactly what I wanted.
I added "-publisher" jobs that run after "" is built successfully. I could have done it in one job, but I decided to split it up. The build jobs are triggered by a web hook in GitLab; the publisher jobs are using a #daily schedule from the BuildResultTrigger plugin.

Gitlab hook on opening merge request

I have a buildbot server and Gitlab. I could not figure out, to trigger builds whenever a merge request is opened on Gitlab. The purpose should be, that buildbot writes a comment back to the merge request whenever a build succeeds or fails (where as the build is done on the merge request + the upstream branch).
Any hints how to trigger that?
Thanks!
The Gitlab team actually merged some stuff in to make it possible to fire web hooks whenever a merge request is opened or updated:
see https://github.com/gitlabhq/gitlabhq/pull/5881 and
https://github.com/gitlabhq/gitlabhq/issues/1137
You could implement a service like the one for GitLab CI. This actually posts back to the merge-request whether GitLab CI passed or failed the test-suite.
I implemented one and am contributing it back to the buildbot project, see https://github.com/buildbot/buildbot/pull/1820
It uses webhooks and posts comments back to the merge request to show build status.

Resources