How to debug in github CI? - github-actions

It's very weired that my code passes all UT/IT in my laptop, but it encounters errors in github CI.
Would you mind helping to take up some methods to debug in github CI? Or to make code runs in local as same as github?
It's a project about timeseries database, Apache-IoTDB. The error looks like a trivial logical error among ordinary code. Hope it may help diagnose the bug. Thank you very much !

act is a local runner for GitHub Actions workflows and should run nearly identically to the real thing.
Alternatively, the debugging-with-ssh action uses upterm to open an SSH listener within a container to get a shell on a running workflow within GitHub Actions itself.

The question solved directly by merging master(the branch my pull request forward to) again.
The point is, github CI (actions) may be running on the code which is AUTO-MERGED when the pull-request accepted.
So if your code passes all tests locally but failed in CI with different result from your local debugging, try merge the branch which PR forward may solve the problem.
Hope this may hepl you and thanks guys under this question.

Related

Return passing status on Github workflow when using paths-ignore

I'm using a Github workflow to run tests. Because the setup can take a while, we want to skip running the tests when no code was changed. So we are using paths-ignore like this:
on:
pull_request:
branches:
- develop
paths-ignore:
- '*.md'
The problem is that we have a protected branch here that requires a check to pass before a branch can be merged. There seems to be some workarounds https://github.community/t/feature-request-conditional-required-checks/16761/20 but they are pretty clunky. Is there an elegant and idiomatic way to return a passing status here for a job that was essentially skipped?
Elegant and idiomatic, evidently not. The conclusion elsewhere (GitHub community forum, Reddit) is that this is expected behavior, at least right now.
The two main workarounds people seem to be using are:
Run all required status checks on all PRs, even the slow ones. Sigh.
Use paths-filter or a homegrown alternative (example) inside the required workflows, as part of their execution, and skip the actual work and return success if no relevant files were changed.

How to solve a stuck Gitlab CI pipeline?

We've been using Gitlab CI for some months, and in the last 1 week, we've been using the specific runner installed on a VPS. Currently, we are using "shell" as the executor.
Today our pipeline got stuck out of sudden, when we looked into the server free RAM, it's only 48MB out of 996 MB, FYI, we're using CentOS 6.
We've been struggling to get the answers, but we're stuck at the moment, and would like to know :
What's causing the pipeline from getting stuck?
is it true because of low free RAM?
Should we use another executor, perhaps SSH or even docker?
What is the best practices to deal with this kind of problem?
We would appreciate any kind of help or directions.
In my case the pipeline was stuck because the only available runner had the option "Can run untagged jobs" set to "No" and the job was really untagged. One can fix this issue by changing the "Can run untagged jobs" option or by adding a tag to the appropriate section of the ".gitlab-ci.yml" file in the repository. In my case it was section default:tags:.
(It seems that your case is much more complicated. However I've came across this issue twice a month, and I've forgotten the decision at the second time. Thus I've came to this page which looks appropriate to save the decision. Hope the answer will help someone else.)
In my case, the pipeline was stuck because of two things:
The tags specified in the .gitlab-ci.yml do not match those in the runner configuration.
If you specify the simulator in the build command, ensure that you write the right version of the simulator.
Once I did these changes, everything worked well!
Good luck.
In my case, It happened on a container that was off for a couple of days for maintenance reasons, I had to clear runner caches, and it worked!
In my case the windows gitlab-runner service was not running. Starting it solved it.

Concourse CI junit test

I am new to concourse CI. Can someone point me to the right direction? I would like to know how I can run junit using concourse CI. Thanks in advance for your assistance.
-Dd
You should play around with concourse for a little bit to get the hang of things before building your own pipeline. The best resources for learning are the flight school tutorial and the stark and wayne tutorial.
Hopefully these two resources will help you understand how concourse uses containerization to accomplish any automation task you want.
If you need any more help feel free to get on the concourse slack, http://slack.concourse.ci, and ask the developers and other heavy users any questions you have.
Good luck!
Concourse runs its task inside a container, which gives you a shell env. Depending on the container, you have specific tools at your disposal. If you are using a maven image in the task definition e.g.
---
platform: linux
image_resource:
type: docker-image
source: {repository: maven, tag: "3.4"}
then you can execute your unit tests with maven
mvn test
If you want to run it without maven, you can just base the task on any image with java installed. Look at this post: How to run JUnit test cases from the command line

Fetching project code from different repositories

we want to use Hudson for our CI, but our project is made of code coming from different repository. For example:
- org.sourceforce... should be check out from http:/sv/n/rep1.
- org.python.... should be check out from http:/sv/n/rep2.
- com.company.product should be check out from http:/sv/n/rep3.
right now we use an ant script with a get.all target that checkout/update the code from different rep.
So i can create a job that let hudson call our get.all target to fetch out all source code and call a second target to build all. But in that case, how to monitor change in the 3 repositories ?
I'm thinking that I could just not assign any repository in the job configuration and schedule the job to fethc/build at regular time interval, but i feel that i'll miss the idea of CI if build can't be trigger from commit/repository change.
what would be the best way to do ? is there a way to configure project dependencies in hudson ?
I haven't poked at the innards of our Hudson installation too much, but it there is a button under Source Code Management that says "Add more locations..." (if that isn't the default out-of-the-box configuration, let me know and I will dig deeper).
Most of our Hudson builds require at least dozen different SVN repos to be checked out, and Hudson monitors them all automatically. We then have the Build steps invoke ant in the correct order to build of the dependencies.
I assume you're using subversion. If not, then please ignore.
Subversion, at least the newer version of it, supports a concept called 'Externals.'
An external is an API, alternate project, dependency, or whatnot that does not reside in YOUR project repository.
see:http://svnbook.red-bean.com/en/1.1/ch07s04.html

Hudson - save artifacts only when less than 90% passes

I am new at this and I was wondering how I can setup that I save the artifacts, only if less than 90% of the tests have passed.
Any idea how I can do this?
thanks
This is not currently possible with Hudson. What is the motivation to avoid archiving artifacts on every build?
How about a rather simple workaround. You create a post build step (or additional build step) that calls your tests from the command line. Be sure to capture all errors so Hudson don't count it as a failure. Than you evaluate your condition and set the error level accordingly. In addition you need to save reports (probably outside hudson) before you set the error level, so they are available even or only when the build fails.
My assumption here is, that it is OK, not to run the tests when building the app fails. However, you can separate the building and testing in two jobs. See here.